Go to the documentation of this file.
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
52 #include "drv_i2c_master.h"
74 #define BRUSHLESS10_DAC_REG_DEVICE_CONFIG 0x01
75 #define BRUSHLESS10_DAC_REG_STATUS_TRIGGER 0x02
76 #define BRUSHLESS10_DAC_REG_BRDCAST 0x03
77 #define BRUSHLESS10_DAC_REG_DACA_DATA_LA 0x08
78 #define BRUSHLESS10_DAC_REG_DACB_DATA_MIN_SP 0x09
79 #define BRUSHLESS10_DAC_REG_DACC_DATA_SEL_LD 0x0A
80 #define BRUSHLESS10_DAC_REG_DACD_DATA_FPWM 0x0B
81 #define BRUSHLESS10_DAC_REG_DACE_DATA_SEL_LA 0x0C
82 #define BRUSHLESS10_DAC_REG_DACF_DATA_SEL_FG 0x0D
83 #define BRUSHLESS10_DAC_REG_DACG_DATA_SEL_SP 0x0E
84 #define BRUSHLESS10_DAC_REG_DACH_DATA_CW_CCW 0x0F
102 #define BRUSHLESS10_DAC_CHA_LA 0
103 #define BRUSHLESS10_DAC_CHB_MIN_SP 1
104 #define BRUSHLESS10_DAC_CHC_SEL_LD 2
105 #define BRUSHLESS10_DAC_CHD_FPWM 3
106 #define BRUSHLESS10_DAC_CHE_SEL_LA 4
107 #define BRUSHLESS10_DAC_CHF_SEL_FG 5
108 #define BRUSHLESS10_DAC_CHG_SEL_SP 6
109 #define BRUSHLESS10_DAC_CHH_CW_CCW 7
115 #define BRUSHLESS10_LA0_STEP_0 88
116 #define BRUSHLESS10_LA0_STEP_1 234
117 #define BRUSHLESS10_LA0_STEP_2 332
118 #define BRUSHLESS10_LA0_STEP_3 430
119 #define BRUSHLESS10_LA0_STEP_4 527
120 #define BRUSHLESS10_LA0_STEP_5 625
121 #define BRUSHLESS10_LA0_STEP_6 723
122 #define BRUSHLESS10_LA0_STEP_7 820
123 #define BRUSHLESS10_LA0_STEP_8 918
124 #define BRUSHLESS10_LA0_STEP_9 1016
125 #define BRUSHLESS10_LA0_STEP_10 1113
126 #define BRUSHLESS10_LA0_STEP_11 1211
127 #define BRUSHLESS10_LA0_STEP_12 1309
128 #define BRUSHLESS10_LA0_STEP_13 1406
129 #define BRUSHLESS10_LA0_STEP_14 1504
130 #define BRUSHLESS10_LA0_STEP_15 1602
131 #define BRUSHLESS10_LA0_STEP_16 1699
132 #define BRUSHLESS10_LA0_STEP_17 1797
133 #define BRUSHLESS10_LA0_STEP_18 1894
134 #define BRUSHLESS10_LA0_STEP_19 1992
135 #define BRUSHLESS10_LA0_STEP_20 2090
136 #define BRUSHLESS10_LA0_STEP_21 2187
137 #define BRUSHLESS10_LA0_STEP_22 2285
138 #define BRUSHLESS10_LA0_STEP_23 2383
139 #define BRUSHLESS10_LA0_STEP_24 2480
140 #define BRUSHLESS10_LA0_STEP_25 2578
141 #define BRUSHLESS10_LA0_STEP_26 2676
142 #define BRUSHLESS10_LA0_STEP_27 2773
143 #define BRUSHLESS10_LA0_STEP_28 2871
144 #define BRUSHLESS10_LA0_STEP_29 2969
145 #define BRUSHLESS10_LA0_STEP_30 3066
146 #define BRUSHLESS10_LA0_STEP_31 4062
147 #define BRUSHLESS10_LA1_STEP_0 234
148 #define BRUSHLESS10_LA1_STEP_1 673
149 #define BRUSHLESS10_LA1_STEP_2 1064
150 #define BRUSHLESS10_LA1_STEP_3 1455
151 #define BRUSHLESS10_LA1_STEP_4 1845
152 #define BRUSHLESS10_LA1_STEP_5 2236
153 #define BRUSHLESS10_LA1_STEP_6 2627
154 #define BRUSHLESS10_LA1_STEP_7 3916
160 #define BRUSHLESS10_MIN_SP_STEP_0 136
161 #define BRUSHLESS10_MIN_SP_STEP_1 478
162 #define BRUSHLESS10_MIN_SP_STEP_2 869
163 #define BRUSHLESS10_MIN_SP_STEP_3 1259
164 #define BRUSHLESS10_MIN_SP_STEP_4 1650
165 #define BRUSHLESS10_MIN_SP_STEP_5 2041
166 #define BRUSHLESS10_MIN_SP_STEP_6 2431
167 #define BRUSHLESS10_MIN_SP_STEP_7 2822
168 #define BRUSHLESS10_MIN_SP_STEP_8 3916
174 #define BRUSHLESS10_FPWM_STEP_0 478
175 #define BRUSHLESS10_FPWM_STEP_1 1455
176 #define BRUSHLESS10_FPWM_STEP_2 2431
177 #define BRUSHLESS10_FPWM_STEP_3 3965
183 #define BRUSHLESS10_SEL_LD_STEP_0 478
184 #define BRUSHLESS10_SEL_LD_STEP_1 1455
185 #define BRUSHLESS10_SEL_LD_STEP_2 2431
186 #define BRUSHLESS10_SEL_LD_STEP_3 3965
192 #define BRUSHLESS10_SEL_FG_STEP_0 967
193 #define BRUSHLESS10_SEL_FG_STEP_1 3476
199 #define BRUSHLESS10_SEL_SP_STEP_0 478
200 #define BRUSHLESS10_SEL_SP_STEP_1 1943
201 #define BRUSHLESS10_SEL_SP_STEP_2 3965
207 #define BRUSHLESS10_SEL_LA_STEP_0 478
208 #define BRUSHLESS10_SEL_LA_STEP_1 1943
209 #define BRUSHLESS10_SEL_LA_STEP_2 3965
215 #define BRUSHLESS10_CW_CCW_0 0
216 #define BRUSHLESS10_CW_CCW_1 5000
222 #define BRUSHLESS10_DAC_VREF 5000
223 #define BRUSHLESS10_DAC_RESOLUTION 256
224 #define BRUSHLESS10_DAC_ROUND_TO_INT 0.5f
230 #define BRUSHLESS10_DAC_CONFIG_PDN_ALL 0x0100
231 #define BRUSHLESS10_DAC_CONFIG_PDN_CHA 0x0001
232 #define BRUSHLESS10_DAC_CONFIG_PDN_CHB 0x0002
233 #define BRUSHLESS10_DAC_CONFIG_PDN_CHC 0x0004
234 #define BRUSHLESS10_DAC_CONFIG_PDN_CHD 0x0008
235 #define BRUSHLESS10_DAC_CONFIG_PDN_CHE 0x0010
236 #define BRUSHLESS10_DAC_CONFIG_PDN_CHF 0x0020
237 #define BRUSHLESS10_DAC_CONFIG_PDN_CHG 0x0040
238 #define BRUSHLESS10_DAC_CONFIG_PDN_CHH 0x0080
239 #define BRUSHLESS10_DAC_CONFIG_ENABLE_ALL_CH 0x0000
245 #define BRUSHLESS10_DAC_DEVICE_ID 0x0500
246 #define BRUSHLESS10_DAC_DEVICE_ID_MASK 0x0FC0
247 #define BRUSHLESS10_DAC_SW_RESET 0x000A
253 #define BRUSHLESS10_DEF_FREQ 50000
260 #define BRUSHLESS10_DAC_DEVICE_ADDRESS_BROADCAST 0x47
261 #define BRUSHLESS10_DAC_DEVICE_ADDRESS_0 0x48
262 #define BRUSHLESS10_DAC_DEVICE_ADDRESS_1 0x49
280 #define BRUSHLESS10_MAP_MIKROBUS( cfg, mikrobus ) \
281 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
282 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
283 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
284 cfg.fg_out = MIKROBUS( mikrobus, MIKROBUS_AN ); \
285 cfg.brake = MIKROBUS( mikrobus, MIKROBUS_RST ); \
286 cfg.ld_out = MIKROBUS( mikrobus, MIKROBUS_INT );
574 #endif // BRUSHLESS10_H
pin_name_t scl
Definition: brushless10.h:325
err_t brushless10_default_cfg(brushless10_t *ctx)
Brushless 10 default configuration function.
Brushless 10 Click configuration object.
Definition: brushless10.h:323
uint8_t brushless10_get_fg_out_pin(brushless10_t *ctx)
Brushless 10 get fg out pin function.
digital_out_t brake
Definition: brushless10.h:298
err_t brushless10_dac_write(brushless10_t *ctx, uint8_t reg, uint16_t data_in)
Brushless 10 DAC write function.
digital_in_t ld_out
Definition: brushless10.h:302
uint8_t brushless10_get_ld_out_pin(brushless10_t *ctx)
Brushless 10 get ld out pin function.
pin_name_t sda
Definition: brushless10.h:326
@ BRUSHLESS10_ERROR
Definition: brushless10.h:348
pin_name_t brake
Definition: brushless10.h:331
err_t brushless10_dac_set_data(brushless10_t *ctx, uint8_t channel, uint8_t data_in)
Brushless 10 DAC set data function.
pin_name_t ld_out
Definition: brushless10.h:332
err_t brushless10_pwm_stop(brushless10_t *ctx)
Brushless 10 stop PWM module.
void brushless10_cfg_setup(brushless10_cfg_t *cfg)
Brushless 10 configuration object setup function.
uint32_t dev_pwm_freq
Definition: brushless10.h:335
err_t brushless10_set_duty_cycle(brushless10_t *ctx, float duty_cycle)
Brushless 10 sets PWM duty cycle.
void brushless10_release_brake(brushless10_t *ctx)
Brushless 10 release brake function.
void brushless10_pull_brake(brushless10_t *ctx)
Brushless 10 pull brake function.
err_t brushless10_dac_read(brushless10_t *ctx, uint8_t reg, uint16_t *data_out)
Brushless 10 DAC read function.
uint32_t i2c_speed
Definition: brushless10.h:336
uint32_t pwm_freq
Definition: brushless10.h:308
err_t brushless10_pwm_start(brushless10_t *ctx)
Brushless 10 start PWM module.
err_t brushless10_dac_sw_reset(brushless10_t *ctx)
Brushless 10 DAC sw reset function.
i2c_master_t i2c
Definition: brushless10.h:311
uint8_t slave_address
Definition: brushless10.h:314
pwm_t pwm
Definition: brushless10.h:305
brushless10_return_value_t
Brushless 10 Click return value data.
Definition: brushless10.h:346
uint8_t i2c_address
Definition: brushless10.h:337
err_t brushless10_dac_check_com(brushless10_t *ctx)
Brushless 10 DAC check com function.
err_t brushless10_dac_set_vout(brushless10_t *ctx, uint8_t channel, uint16_t vout_mv)
Brushless 10 DAC set vout function.
pin_name_t fg_out
Definition: brushless10.h:330
Brushless 10 Click context object.
Definition: brushless10.h:296
@ BRUSHLESS10_OK
Definition: brushless10.h:347
err_t brushless10_init(brushless10_t *ctx, brushless10_cfg_t *cfg)
Brushless 10 initialization function.
pin_name_t pwm
Definition: brushless10.h:327
digital_in_t fg_out
Definition: brushless10.h:301