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
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51
62#define BRUSHLESS12_ENABLE 1
63#define BRUSHLESS12_DISABLE 0
64#define BRUSHLESS12_START 1
65#define BRUSHLESS12_BRAKE 0
66#define BRUSHLESS12_DIR_FORWARD 1
67#define BRUSHLESS12_DIR_REVERSE 0
68
74 // brushless12_set
75
90#define BRUSHLESS12_MAP_MIKROBUS( cfg, mikrobus ) \
91 cfg.brk = MIKROBUS( mikrobus, MIKROBUS_RST ); \
92 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
93 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_PWM );
94
95 // brushless12_map
96 // brushless12
97
102typedef struct
103{
104 digital_out_t brk;
105 digital_out_t en;
106 digital_out_t dir;
109
114typedef struct
115{
116 pin_name_t brk;
117 pin_name_t en;
118 pin_name_t dir;
121
132
149
165
180
189void brushless12_set_brake ( brushless12_t *ctx, uint8_t state );
190
199void brushless12_set_direction ( brushless12_t *ctx, uint8_t state );
200
209void brushless12_set_enable ( brushless12_t *ctx, uint8_t state );
210
211#ifdef __cplusplus
212}
213#endif
214#endif // BRUSHLESS12_H
215
216 // brushless12
217
218// ------------------------------------------------------------------------ END
brushless12_return_value_t
Brushless 12 Click return value data.
Definition brushless12.h:127
@ BRUSHLESS12_OK
Definition brushless12.h:128
@ BRUSHLESS12_ERROR
Definition brushless12.h:129
void brushless12_cfg_setup(brushless12_cfg_t *cfg)
Brushless 12 configuration object setup function.
err_t brushless12_default_cfg(brushless12_t *ctx)
Brushless 12 default configuration function.
void brushless12_set_direction(brushless12_t *ctx, uint8_t state)
Brushless 12 set F/R pin state function.
void brushless12_set_brake(brushless12_t *ctx, uint8_t state)
Brushless 12 set BRK pin state function.
err_t brushless12_init(brushless12_t *ctx, brushless12_cfg_t *cfg)
Brushless 12 initialization function.
void brushless12_set_enable(brushless12_t *ctx, uint8_t state)
Brushless 12 set EN pin state function.
Brushless 12 Click configuration object.
Definition brushless12.h:115
pin_name_t dir
Definition brushless12.h:118
pin_name_t en
Definition brushless12.h:117
pin_name_t brk
Definition brushless12.h:116
Brushless 12 Click context object.
Definition brushless12.h:103
digital_out_t brk
Definition brushless12.h:104
digital_out_t en
Definition brushless12.h:105
digital_out_t dir
Definition brushless12.h:106