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 "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 
67 #define dcmotor17_retval_t uint8_t
68 
69 #define DCMOTOR17_OK 0x00
70 #define DCMOTOR17_ERROR 0xFF
71  // retval_flag
73 
83 #define DCMOTOR17_SEL_OUT_A 0
84 #define DCMOTOR17_SEL_OUT_B 1
85  // sel_out
87 
97 #define DCMOTOR17_SEL_MODE_STANDBY 0
98 #define DCMOTOR17_SEL_MODE_NORMAL 1
99  // mode
101 
116 #define DCMOTOR17_MAP_MIKROBUS( cfg, mikrobus ) \
117  cfg.i1a = MIKROBUS( mikrobus, MIKROBUS_AN ); \
118  cfg.i2a = MIKROBUS( mikrobus, MIKROBUS_RST ); \
119  cfg.stby = MIKROBUS( mikrobus, MIKROBUS_CS ); \
120  cfg.i1b = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
121  cfg.i2b = MIKROBUS( mikrobus, MIKROBUS_INT )
122  // dcmotor17_map // dcmotor17
125 
130 typedef struct
131 {
132  digital_out_t i1a;
133  digital_out_t i2a;
134  digital_out_t stby;
135  digital_out_t i1b;
136  digital_out_t i2b;
137 } dcmotor17_t;
138 
143 typedef struct
144 {
145  pin_name_t i1a;
146  pin_name_t i2a;
147  pin_name_t stby;
148  pin_name_t i1b;
149  pin_name_t i2b;
152 
169 
185 
198 
209 
220 
235 
250 
265 
277 
278 #ifdef __cplusplus
279 }
280 #endif
281 #endif // DCMOTOR17_H
282  // dcmotor17
284 
285 // ------------------------------------------------------------------------ END
dcmotor17_cfg_t::stby
pin_name_t stby
Definition: dcmotor17.h:147
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:144
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:148
dcmotor17_t::i1a
digital_out_t i1a
Definition: dcmotor17.h:132
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:135
dcmotor17_retval_t
#define dcmotor17_retval_t
DC Motor 17 error code settings.
Definition: dcmotor17.h:67
dcmotor17_cfg_t::i2a
pin_name_t i2a
Definition: dcmotor17.h:146
dcmotor17_t::i2b
digital_out_t i2b
Definition: dcmotor17.h:136
dcmotor17_t::stby
digital_out_t stby
Definition: dcmotor17.h:134
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:145
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:131
dcmotor17_cfg_t::i2b
pin_name_t i2b
Definition: dcmotor17.h:149
dcmotor17_t::i2a
digital_out_t i2a
Definition: dcmotor17.h:133