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 "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
58 #define DCMOTOR21_OUT_LOW 0x00
59 #define DCMOTOR21_OUT_HIGH 0x01
60 #define DCMOTOR21_OUT_HIGH_Z 0x02
61  // dcmotor21_set
63 
78 #define DCMOTOR21_MAP_MIKROBUS( cfg, mikrobus ) \
79  cfg.hn1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
80  cfg.ln1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
81  cfg.hn2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
82  cfg.ln2 = MIKROBUS( mikrobus, MIKROBUS_INT )
83  // dcmotor21_map // dcmotor21
86 
91 typedef struct
92 {
93  digital_out_t hn1;
94  digital_out_t ln1;
95  digital_out_t hn2;
96  digital_out_t ln2;
98 } dcmotor21_t;
99 
104 typedef struct
105 {
106  pin_name_t hn1;
107  pin_name_t ln1;
108  pin_name_t hn2;
109  pin_name_t ln2;
112 
117 typedef enum
118 {
120  DCMOTOR21_ERROR = -1
121 
123 
140 
156 
168 
180 void dcmotor21_set_out_1 ( dcmotor21_t *ctx, uint8_t state );
181 
193 void dcmotor21_set_out_2 ( dcmotor21_t *ctx, uint8_t state );
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 #endif // DCMOTOR21_H
199  // dcmotor21
201 
202 // ------------------------------------------------------------------------ END
dcmotor21_t::ln1
digital_out_t ln1
Definition: dcmotor21.h:94
dcmotor21_cfg_t::hn2
pin_name_t hn2
Definition: dcmotor21.h:108
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:95
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:92
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:119
dcmotor21_cfg_t::ln2
pin_name_t ln2
Definition: dcmotor21.h:109
dcmotor21_return_value_t
dcmotor21_return_value_t
DC Motor 21 Click return value data.
Definition: dcmotor21.h:118
dcmotor21_cfg_t::ln1
pin_name_t ln1
Definition: dcmotor21.h:107
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:106
dcmotor21_t::ln2
digital_out_t ln2
Definition: dcmotor21.h:96
DCMOTOR21_ERROR
@ DCMOTOR21_ERROR
Definition: dcmotor21.h:120
dcmotor21_cfg_t
DC Motor 21 Click configuration object.
Definition: dcmotor21.h:105
dcmotor21_t::hn1
digital_out_t hn1
Definition: dcmotor21.h:93
dcmotor21_cfg_setup
void dcmotor21_cfg_setup(dcmotor21_cfg_t *cfg)
DC Motor 21 configuration object setup function.