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"
51 #include "drv_i2c_master.h"
73 #define BRUSHLESS26_REG_INPUT_PORT 0x00
74 #define BRUSHLESS26_REG_OUTPUT_PORT 0x01
75 #define BRUSHLESS26_REG_POLARITY_INV 0x02
76 #define BRUSHLESS26_REG_CONFIG 0x03
94 #define BRUSHLESS26_TR_COM_STATE_COAST 0x00
95 #define BRUSHLESS26_TR_COM_STATE_1 0x01
96 #define BRUSHLESS26_TR_COM_STATE_2 0x02
97 #define BRUSHLESS26_TR_COM_STATE_3 0x03
98 #define BRUSHLESS26_TR_COM_STATE_4 0x04
99 #define BRUSHLESS26_TR_COM_STATE_5 0x05
100 #define BRUSHLESS26_TR_COM_STATE_6 0x06
101 #define BRUSHLESS26_TR_COM_STATE_BRAKE 0x07
107 #define BRUSHLESS26_NONE_PIN 0x00
108 #define BRUSHLESS26_INLC_PIN 0x01
109 #define BRUSHLESS26_INHC_PIN 0x02
110 #define BRUSHLESS26_INLB_PIN 0x04
111 #define BRUSHLESS26_INHB_PIN 0x08
112 #define BRUSHLESS26_INLA_PIN 0x10
113 #define BRUSHLESS26_INHA_PIN 0x20
114 #define BRUSHLESS26_SLP_PIN 0x40
115 #define BRUSHLESS26_ALL_OUTPUT_PIN 0x3F
116 #define BRUSHLESS26_ALL_PIN 0x7F
122 #define BRUSHLESS26_MODE_6X_PWM 0x01
123 #define BRUSHLESS26_MODE_3X_PWM 0x00
129 #define BRUSHLESS26_DIR_CW 0x01
130 #define BRUSHLESS26_DIR_CCW 0x00
136 #define BRUSHLESS26_PIN_STATE_LOW 0x00
137 #define BRUSHLESS26_PIN_STATE_HIGH 0x01
143 #define BRUSHLESS26_SPEED_MIN 0
144 #define BRUSHLESS26_SPEED_MAX 100
145 #define BRUSHLESS26_NUM_PIN_TOGGLE 8
146 #define BRUSHLESS26_ROUND_TO_NEAREAST_INT 0.5
157 #define BRUSHLESS26_COM_SEQ_DURATION_FOR_SPEED_MAX 20.293
158 #define BRUSHLESS26_COM_SEQ_DURATION_SPEED_STEP ( 20.351 - BRUSHLESS26_COM_SEQ_DURATION_FOR_SPEED_MAX )
165 #define BRUSHLESS26_DEVICE_ADDRESS_A1A0_00 0x70
166 #define BRUSHLESS26_DEVICE_ADDRESS_A1A0_01 0x71
167 #define BRUSHLESS26_DEVICE_ADDRESS_A1A0_10 0x72
168 #define BRUSHLESS26_DEVICE_ADDRESS_A1A0_11 0x73
186 #define BRUSHLESS26_MAP_MIKROBUS( cfg, mikrobus ) \
187 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
188 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
189 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
190 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT )
458 #endif // BRUSHLESS26_H
@ BRUSHLESS26_OK
Definition: brushless26.h:240
uint8_t slave_address
Definition: brushless26.h:211
err_t brushless26_drive_motor(brushless26_t *ctx, uint8_t dir, uint8_t speed, uint32_t time_ms)
Brushless 26 drive motor function.
err_t brushless26_read_reg(brushless26_t *ctx, uint8_t reg, uint8_t *data_out)
Brushless 26 read register function.
uint8_t brushless26_get_flt_pin(brushless26_t *ctx)
Brushless 26 get fault pin function.
void brushless26_set_rst_pin(brushless26_t *ctx, uint8_t pin_state)
Brushless 26 set rst pin function.
pin_name_t rst
Definition: brushless26.h:226
pin_name_t flt
Definition: brushless26.h:227
Brushless 26 Click configuration object.
Definition: brushless26.h:222
Brushless 26 Click context object.
Definition: brushless26.h:200
digital_in_t flt
Definition: brushless26.h:205
uint8_t mode
Definition: brushless26.h:213
err_t brushless26_set_pins(brushless26_t *ctx, uint8_t set_mask, uint8_t clr_mask)
Brushless 26 set pins function.
i2c_master_t i2c
Definition: brushless26.h:208
pin_name_t sda
Definition: brushless26.h:224
pin_name_t scl
Definition: brushless26.h:223
err_t brushless26_generic_write(brushless26_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Brushless 26 I2C writing function.
err_t brushless26_write_reg(brushless26_t *ctx, uint8_t reg, uint8_t data_in)
Brushless 26 write register function.
err_t brushless26_default_cfg(brushless26_t *ctx)
Brushless 26 default configuration function.
err_t brushless26_generic_read(brushless26_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Brushless 26 I2C reading function.
uint32_t i2c_speed
Definition: brushless26.h:229
err_t brushless26_init(brushless26_t *ctx, brushless26_cfg_t *cfg)
Brushless 26 initialization function.
void brushless26_reset_port_exp(brushless26_t *ctx)
Brushless 26 reset port expander function.
err_t brushless26_set_trap_com_state(brushless26_t *ctx, uint8_t state)
Brushless 26 set trapezoidal com state function.
err_t brushless26_perform_com_seq(brushless26_t *ctx, uint8_t dir, uint8_t speed)
Brushless 26 perform com sequence function.
digital_out_t rst
Definition: brushless26.h:202
brushless26_return_value_t
Brushless 26 Click return value data.
Definition: brushless26.h:239
void brushless26_cfg_setup(brushless26_cfg_t *cfg)
Brushless 26 configuration object setup function.
@ BRUSHLESS26_ERROR
Definition: brushless26.h:241
uint8_t i2c_address
Definition: brushless26.h:230
err_t brushless26_toggle_pin(brushless26_t *ctx, uint8_t pin_mask, uint8_t speed)
Brushless 26 toggle pin function.