dcmotor21  2.0.0.0
dcmotor21.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef DCMOTOR21_H
29 #define DCMOTOR21_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 
68 #define DCMOTOR21_OUT_LOW 0x00
69 #define DCMOTOR21_OUT_HIGH 0x01
70 #define DCMOTOR21_OUT_HIGH_Z 0x02
71  // dcmotor21_set
73 
88 #define DCMOTOR21_MAP_MIKROBUS( cfg, mikrobus ) \
89  cfg.hn1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
90  cfg.ln1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
91  cfg.hn2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
92  cfg.ln2 = MIKROBUS( mikrobus, MIKROBUS_INT )
93  // dcmotor21_map // dcmotor21
96 
101 typedef struct
102 {
103  digital_out_t hn1;
104  digital_out_t ln1;
105  digital_out_t hn2;
106  digital_out_t ln2;
108 } dcmotor21_t;
109 
114 typedef struct
115 {
116  pin_name_t hn1;
117  pin_name_t ln1;
118  pin_name_t hn2;
119  pin_name_t ln2;
122 
127 typedef enum
128 {
130  DCMOTOR21_ERROR = -1
131 
133 
150 
166 
178 
190 void dcmotor21_set_out_1 ( dcmotor21_t *ctx, uint8_t state );
191 
203 void dcmotor21_set_out_2 ( dcmotor21_t *ctx, uint8_t state );
204 
205 #ifdef __cplusplus
206 }
207 #endif
208 #endif // DCMOTOR21_H
209  // dcmotor21
211 
212 // ------------------------------------------------------------------------ END
dcmotor21_t::ln1
digital_out_t ln1
Definition: dcmotor21.h:104
dcmotor21_cfg_t::hn2
pin_name_t hn2
Definition: dcmotor21.h:118
dcmotor21_set_out_1
void dcmotor21_set_out_1(dcmotor21_t *ctx, uint8_t state)
DC Motor 21 set out 1 function.
dcmotor21_t::hn2
digital_out_t hn2
Definition: dcmotor21.h:105
dcmotor21_default_cfg
void dcmotor21_default_cfg(dcmotor21_t *ctx)
DC Motor 21 default configuration function.
dcmotor21_t
DC Motor 21 Click context object.
Definition: dcmotor21.h:102
dcmotor21_init
err_t dcmotor21_init(dcmotor21_t *ctx, dcmotor21_cfg_t *cfg)
DC Motor 21 initialization function.
DCMOTOR21_OK
@ DCMOTOR21_OK
Definition: dcmotor21.h:129
dcmotor21_cfg_t::ln2
pin_name_t ln2
Definition: dcmotor21.h:119
dcmotor21_return_value_t
dcmotor21_return_value_t
DC Motor 21 Click return value data.
Definition: dcmotor21.h:128
dcmotor21_cfg_t::ln1
pin_name_t ln1
Definition: dcmotor21.h:117
dcmotor21_set_out_2
void dcmotor21_set_out_2(dcmotor21_t *ctx, uint8_t state)
DC Motor 21 set out 2 function.
dcmotor21_cfg_t::hn1
pin_name_t hn1
Definition: dcmotor21.h:116
dcmotor21_t::ln2
digital_out_t ln2
Definition: dcmotor21.h:106
DCMOTOR21_ERROR
@ DCMOTOR21_ERROR
Definition: dcmotor21.h:130
dcmotor21_cfg_t
DC Motor 21 Click configuration object.
Definition: dcmotor21.h:115
dcmotor21_t::hn1
digital_out_t hn1
Definition: dcmotor21.h:103
dcmotor21_cfg_setup
void dcmotor21_cfg_setup(dcmotor21_cfg_t *cfg)
DC Motor 21 configuration object setup function.