Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
38 #include "drv_i2c_master.h"
60 #define BRUSHLESS21_EEPROM_USER_0 0x06
61 #define BRUSHLESS21_EEPROM_USER_1 0x07
62 #define BRUSHLESS21_EEPROM_RATED_SPEED_DIR 0x08
63 #define BRUSHLESS21_EEPROM_ACCELERATION_AND_RES 0x09
64 #define BRUSHLESS21_EEPROM_CURRENT 0x0A
65 #define BRUSHLESS21_EEPROM_MODE 0x0B
66 #define BRUSHLESS21_EEPROM_PID_P_AND_INDUCTANCE 0x0C
67 #define BRUSHLESS21_EEPROM_PID_I_AND_DELAY 0x0D
68 #define BRUSHLESS21_EEPROM_LOCK_AND_SOFT_CTRL 0x0F
69 #define BRUSHLESS21_EEPROM_OCP_FCSPEED_ACDEC_BUF_FLT 0x10
70 #define BRUSHLESS21_EEPROM_SPEED_AND_FG 0x11
71 #define BRUSHLESS21_EEPROM_IPD_CURRENT_THR 0x12
72 #define BRUSHLESS21_EEPROM_RATED_VOLTAGE 0x14
73 #define BRUSHLESS21_EEPROM_SLIGHT_MOVE_LOW_DUTY_THR 0x15
74 #define BRUSHLESS21_EEPROM_CLOSED_LOOP_TIME 0x16
75 #define BRUSHLESS21_EEPROM_CONTROL 0xA1
76 #define BRUSHLESS21_EEPROM_ADDRESS 0xA2
77 #define BRUSHLESS21_EEPROM_DATA_IN 0xA3
83 #define BRUSHLESS21_REG_RATED_SPEED_DIR 0x48
84 #define BRUSHLESS21_REG_ACCELERATION_AND_RES 0x49
85 #define BRUSHLESS21_REG_CURRENT 0x4A
86 #define BRUSHLESS21_REG_MODE 0x4B
87 #define BRUSHLESS21_REG_PID_P_AND_INDUCTANCE 0x4C
88 #define BRUSHLESS21_REG_PID_I_AND_DELAY 0x4D
89 #define BRUSHLESS21_REG_LOCK_AND_SOFT_CTRL 0x4F
90 #define BRUSHLESS21_REG_OCP_FCSPEED_ACDEC_BUF_FLT 0x50
91 #define BRUSHLESS21_REG_SPEED_AND_FG 0x51
92 #define BRUSHLESS21_REG_IPD_CURRENT_THR 0x52
93 #define BRUSHLESS21_REG_RATED_VOLTAGE 0x54
94 #define BRUSHLESS21_REG_SLIGHT_MOVE_LOW_DUTY_THR 0x55
95 #define BRUSHLESS21_REG_CLOSED_LOOP_TIME 0x56
96 #define BRUSHLESS21_REG_READBACK_MOTOR_SPEED 0x78
97 #define BRUSHLESS21_REG_READBACK_BUS_CURRENT 0x79
98 #define BRUSHLESS21_REG_READBACK_Q_AXIS_CURRENT 0x7A
99 #define BRUSHLESS21_REG_READBACK_VBB 0x7B
100 #define BRUSHLESS21_REG_READBACK_TEMPERATURE 0x7C
101 #define BRUSHLESS21_REG_READBACK_CONTROL_DEMAND 0x7D
102 #define BRUSHLESS21_REG_READBACK_CONTROL_COMMAND 0x7E
121 #define BRUSHLESS21_DIR_REVERSE 0
122 #define BRUSHLESS21_DIR_FORWARD 1
128 #define BRUSHLESS21_MOTOR_SPEED_HZ 0.530
129 #define BRUSHLESS21_VBB_MAX 20
130 #define BRUSHLESS21_VBB_RESOLUTION 0xFF
131 #define BRUSHLESS21_TEMPERATURE_OFFSET 73
132 #define BRUSHLESS21_I2C_DUTY_RESOLUTION 0x01FF
133 #define BRUSHLESS21_DUTY_CONTROLLED_BY_I2C_BIT 0x0200
139 #define BRUSHLESS21_DEF_FREQ 5000
146 #define BRUSHLESS21_SET_DEV_ADDR 0x55
164 #define BRUSHLESS21_MAP_MIKROBUS( cfg, mikrobus ) \
165 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
166 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
167 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
168 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
169 cfg.fg = MIKROBUS( mikrobus, MIKROBUS_INT );
468 #endif // BRUSHLESS21_H
void brushless21_enable_device(brushless21_t *ctx)
Brushless 21 enable device function.
pwm_t pwm
Definition: brushless21.h:198
i2c_master_t i2c
Definition: brushless21.h:199
uint8_t slave_address
Definition: brushless21.h:202
pin_name_t pwm
Definition: brushless21.h:215
Brushless 21 Click configuration object.
Definition: brushless21.h:213
pin_name_t scl
Definition: brushless21.h:216
err_t brushless21_set_duty_cycle(brushless21_t *ctx, float duty_cycle)
Brushless 21 set duty cycle function.
uint32_t dev_pwm_freq
Definition: brushless21.h:224
void brushless21_disable_device(brushless21_t *ctx)
Brushless 21 disable device function.
uint8_t i2c_address
Definition: brushless21.h:226
err_t brushless21_read_register(brushless21_t *ctx, uint8_t reg, uint16_t *data_out)
Brushless 21 read register function.
err_t brushless21_pwm_start(brushless21_t *ctx)
Brushless 21 start PWM module.
brushless21_drv_t drv_sel
Definition: brushless21.h:228
digital_out_t en
Definition: brushless21.h:192
err_t brushless21_default_cfg(brushless21_t *ctx)
Brushless 21 default configuration function.
err_t brushless21_get_temperature(brushless21_t *ctx, int8_t *temperature)
Brushless 21 get temperature function.
err_t brushless21_write_register(brushless21_t *ctx, uint8_t reg, uint16_t data_in)
Brushless 21 write register function.
Brushless 21 Click context object.
Definition: brushless21.h:190
void brushless21_cfg_setup(brushless21_cfg_t *cfg)
Brushless 21 configuration object setup function.
err_t brushless21_set_direction(brushless21_t *ctx, uint8_t direction)
Brushless 21 set direction function.
void brushless21_drv_interface_selection(brushless21_cfg_t *cfg, brushless21_drv_t drv_sel)
Brushless 21 driver interface setup function.
err_t brushless21_get_motor_speed(brushless21_t *ctx, float *motor_speed_hz)
Brushless 21 get motor speed function.
err_t brushless21_switch_direction(brushless21_t *ctx)
Brushless 21 switch direction function.
pin_name_t fg
Definition: brushless21.h:221
uint32_t i2c_speed
Definition: brushless21.h:225
@ BRUSHLESS21_ERROR
Definition: brushless21.h:239
err_t brushless21_init(brushless21_t *ctx, brushless21_cfg_t *cfg)
Brushless 21 initialization function.
pin_name_t sda
Definition: brushless21.h:217
@ BRUSHLESS21_DRV_SEL_I2C
Definition: brushless21.h:181
brushless21_return_value_t
Brushless 21 Click return value data.
Definition: brushless21.h:237
uint32_t pwm_freq
Definition: brushless21.h:201
pin_name_t en
Definition: brushless21.h:220
brushless21_drv_t drv_sel
Definition: brushless21.h:204
err_t brushless21_get_vbb_voltage(brushless21_t *ctx, float *vbb_voltage)
Brushless 21 get vbb voltage function.
err_t brushless21_pwm_stop(brushless21_t *ctx)
Brushless 21 stop PWM module.
@ BRUSHLESS21_OK
Definition: brushless21.h:238
uint8_t brushless21_get_fg_pin(brushless21_t *ctx)
Brushless 21 get fg pin function.
@ BRUSHLESS21_DRV_SEL_GPIO
Definition: brushless21.h:180
digital_in_t fg
Definition: brushless21.h:195
brushless21_drv_t
Brushless 21 Click driver selector.
Definition: brushless21.h:179