brushless12  2.0.0.0
brushless12.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 BRUSHLESS12_H
29 #define BRUSHLESS12_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
48 #define BRUSHLESS12_ENABLE 1
49 #define BRUSHLESS12_DISABLE 0
50 #define BRUSHLESS12_START 1
51 #define BRUSHLESS12_BRAKE 0
52 #define BRUSHLESS12_DIR_FORWARD 1
53 #define BRUSHLESS12_DIR_REVERSE 0
54  // brushless12_set
61 
76 #define BRUSHLESS12_MAP_MIKROBUS( cfg, mikrobus ) \
77  cfg.brk = MIKROBUS( mikrobus, MIKROBUS_RST ); \
78  cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
79  cfg.dir = MIKROBUS( mikrobus, MIKROBUS_PWM );
80  // brushless12_map // brushless12
83 
88 typedef struct
89 {
90  digital_out_t brk;
91  digital_out_t en;
92  digital_out_t dir;
95 
100 typedef struct
101 {
102  pin_name_t brk;
103  pin_name_t en;
104  pin_name_t dir;
107 
112 typedef enum
113 {
115  BRUSHLESS12_ERROR = -1
116 
118 
135 
151 
166 
175 void brushless12_set_brake ( brushless12_t *ctx, uint8_t state );
176 
185 void brushless12_set_direction ( brushless12_t *ctx, uint8_t state );
186 
195 void brushless12_set_enable ( brushless12_t *ctx, uint8_t state );
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 #endif // BRUSHLESS12_H
201  // brushless12
203 
204 // ------------------------------------------------------------------------ END
brushless12_cfg_t
Brushless 12 Click configuration object.
Definition: brushless12.h:101
brushless12_init
err_t brushless12_init(brushless12_t *ctx, brushless12_cfg_t *cfg)
Brushless 12 initialization function.
BRUSHLESS12_ERROR
@ BRUSHLESS12_ERROR
Definition: brushless12.h:115
brushless12_return_value_t
brushless12_return_value_t
Brushless 12 Click return value data.
Definition: brushless12.h:113
brushless12_default_cfg
err_t brushless12_default_cfg(brushless12_t *ctx)
Brushless 12 default configuration function.
brushless12_t::en
digital_out_t en
Definition: brushless12.h:91
brushless12_t::dir
digital_out_t dir
Definition: brushless12.h:92
BRUSHLESS12_OK
@ BRUSHLESS12_OK
Definition: brushless12.h:114
brushless12_cfg_setup
void brushless12_cfg_setup(brushless12_cfg_t *cfg)
Brushless 12 configuration object setup function.
brushless12_cfg_t::en
pin_name_t en
Definition: brushless12.h:103
brushless12_t::brk
digital_out_t brk
Definition: brushless12.h:90
brushless12_set_brake
void brushless12_set_brake(brushless12_t *ctx, uint8_t state)
Brushless 12 set BRK pin state function.
brushless12_set_direction
void brushless12_set_direction(brushless12_t *ctx, uint8_t state)
Brushless 12 set F/R pin state function.
brushless12_cfg_t::brk
pin_name_t brk
Definition: brushless12.h:102
brushless12_cfg_t::dir
pin_name_t dir
Definition: brushless12.h:104
brushless12_t
Brushless 12 Click context object.
Definition: brushless12.h:89
brushless12_set_enable
void brushless12_set_enable(brushless12_t *ctx, uint8_t state)
Brushless 12 set EN pin state function.