dcmotor17  2.0.0.0
dcmotor17.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 DCMOTOR17_H
29 #define DCMOTOR17_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 
57 #define dcmotor17_retval_t uint8_t
58 
59 #define DCMOTOR17_OK 0x00
60 #define DCMOTOR17_ERROR 0xFF
61  // retval_flag
63 
73 #define DCMOTOR17_SEL_OUT_A 0
74 #define DCMOTOR17_SEL_OUT_B 1
75  // sel_out
77 
87 #define DCMOTOR17_SEL_MODE_STANDBY 0
88 #define DCMOTOR17_SEL_MODE_NORMAL 1
89  // mode
91 
106 #define DCMOTOR17_MAP_MIKROBUS( cfg, mikrobus ) \
107  cfg.i1a = MIKROBUS( mikrobus, MIKROBUS_AN ); \
108  cfg.i2a = MIKROBUS( mikrobus, MIKROBUS_RST ); \
109  cfg.stby = MIKROBUS( mikrobus, MIKROBUS_CS ); \
110  cfg.i1b = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
111  cfg.i2b = MIKROBUS( mikrobus, MIKROBUS_INT )
112  // dcmotor17_map // dcmotor17
115 
120 typedef struct
121 {
122  digital_out_t i1a;
123  digital_out_t i2a;
124  digital_out_t stby;
125  digital_out_t i1b;
126  digital_out_t i2b;
127 } dcmotor17_t;
128 
133 typedef struct
134 {
135  pin_name_t i1a;
136  pin_name_t i2a;
137  pin_name_t stby;
138  pin_name_t i1b;
139  pin_name_t i2b;
142 
159 
175 
188 
199 
210 
225 
240 
255 
267 
268 #ifdef __cplusplus
269 }
270 #endif
271 #endif // DCMOTOR17_H
272  // dcmotor17
274 
275 // ------------------------------------------------------------------------ END
dcmotor17_cfg_t::stby
pin_name_t stby
Definition: dcmotor17.h:137
dcmotor17_set_mode
dcmotor17_retval_t dcmotor17_set_mode(dcmotor17_t *ctx, uint8_t op_mode)
DC Motor 17 set operating mode function.
dcmotor17_cfg_t
DC Motor 17 Click configuration object.
Definition: dcmotor17.h:134
dcmotor17_standby_mode
void dcmotor17_standby_mode(dcmotor17_t *ctx)
DC Motor 17 set to standby operating mode function.
dcmotor17_normal_mode
void dcmotor17_normal_mode(dcmotor17_t *ctx)
DC Motor 17 set to normal operating mode function.
dcmotor17_stop
dcmotor17_retval_t dcmotor17_stop(dcmotor17_t *ctx, uint8_t sel_out)
DC Motor 17 stop motor function.
dcmotor17_forward
dcmotor17_retval_t dcmotor17_forward(dcmotor17_t *ctx, uint8_t sel_out)
DC Motor 17 forward function.
dcmotor17_cfg_t::i1b
pin_name_t i1b
Definition: dcmotor17.h:138
dcmotor17_t::i1a
digital_out_t i1a
Definition: dcmotor17.h:122
dcmotor17_reverse
dcmotor17_retval_t dcmotor17_reverse(dcmotor17_t *ctx, uint8_t sel_out)
DC Motor 17 reverse function.
dcmotor17_default_cfg
void dcmotor17_default_cfg(dcmotor17_t *ctx)
DC Motor 17 default configuration function.
dcmotor17_t::i1b
digital_out_t i1b
Definition: dcmotor17.h:125
dcmotor17_retval_t
#define dcmotor17_retval_t
DC Motor 17 error code settings.
Definition: dcmotor17.h:57
dcmotor17_cfg_t::i2a
pin_name_t i2a
Definition: dcmotor17.h:136
dcmotor17_t::i2b
digital_out_t i2b
Definition: dcmotor17.h:126
dcmotor17_t::stby
digital_out_t stby
Definition: dcmotor17.h:124
dcmotor17_cfg_setup
void dcmotor17_cfg_setup(dcmotor17_cfg_t *cfg)
DC Motor 17 configuration object setup function.
dcmotor17_cfg_t::i1a
pin_name_t i1a
Definition: dcmotor17.h:135
dcmotor17_init
err_t dcmotor17_init(dcmotor17_t *ctx, dcmotor17_cfg_t *cfg)
DC Motor 17 initialization function.
dcmotor17_t
DC Motor 17 Click context object.
Definition: dcmotor17.h:121
dcmotor17_cfg_t::i2b
pin_name_t i2b
Definition: dcmotor17.h:139
dcmotor17_t::i2a
digital_out_t i2a
Definition: dcmotor17.h:123