38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40#include "drv_i2c_master.h"
53#define BRUSHLESS7_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
56 cfg.cmo = MIKROBUS( mikrobus, MIKROBUS_AN ); \
57 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_RST ); \
58 cfg.sby = MIKROBUS( mikrobus, MIKROBUS_CS ); \
59 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
60 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
67#define BRUSHLESS7_RETVAL uint8_t
69#define BRUSHLESS7_OK 0x00
70#define BRUSHLESS7_INIT_ERROR 0xFF
77#define BRUSHLESS7_SLAVE_ADDR_ID2_LOW_ID1_LOW 0x29
78#define BRUSHLESS7_SLAVE_ADDR_ID2_LOW_ID1_HIGH 0x29
79#define BRUSHLESS7_SLAVE_ADDR_ID2_HIGH_ID1_LOW 0x2D
80#define BRUSHLESS7_SLAVE_ADDR_ID2_HIGH_ID1_HIGH 0x32
87#define BRUSHLESS7_REG_0 0
88#define BRUSHLESS7_REG_1 1
89#define BRUSHLESS7_REG_2 2
90#define BRUSHLESS7_REG_3 3
91#define BRUSHLESS7_REG_4 4
92#define BRUSHLESS7_REG_5 5
93#define BRUSHLESS7_REG_6 6
94#define BRUSHLESS7_REG_7 7
95#define BRUSHLESS7_REG_8 8
96#define BRUSHLESS7_REG_9 9
97#define BRUSHLESS7_REG_10 10
98#define BRUSHLESS7_REG_11 11
99#define BRUSHLESS7_REG_12 12
100#define BRUSHLESS7_REG_13 13
101#define BRUSHLESS7_REG_14 14
102#define BRUSHLESS7_REG_15 15
103#define BRUSHLESS7_REG_16 16
104#define BRUSHLESS7_REG_17 17
105#define BRUSHLESS7_REG_18 18
106#define BRUSHLESS7_REG_19 19
107#define BRUSHLESS7_REG_20 20
108#define BRUSHLESS7_REG_21 21
109#define BRUSHLESS7_REG_22 22
110#define BRUSHLESS7_REG_23 23
111#define BRUSHLESS7_REG_24 24
112#define BRUSHLESS7_REG_25 25
113#define BRUSHLESS7_REG_26 26
114#define BRUSHLESS7_REG_27 27
115#define BRUSHLESS7_REG_28 28
116#define BRUSHLESS7_REG_29 29
117#define BRUSHLESS7_REG_30 30
118#define BRUSHLESS7_REG_86 86
119#define BRUSHLESS7_REG_87 87
126#define BRUSHLESS7_DEV_ERROR 0xFF
127#define BRUSHLESS7_DEV_OK 0x00
134#define BRUSHLESS7_MAX_SPEED_4096 0x00
135#define BRUSHLESS7_MAX_SPEED_8192 0x02
136#define BRUSHLESS7_MAX_SPEED_16384 0x04
137#define BRUSHLESS7_MAX_SPEED_32768 0x06
144#define BRUSHLESS7_CTRL_TYPE_RPM 0xAA
145#define BRUSHLESS7_CTRL_TYPE_DUTY 0xBB
146#define BRUSHLESS7_CTRL_TYPE_STOP 0xCC
153#define BRUSHLESS7_DIR_CW 0xDD
154#define BRUSHLESS7_DIR_CCW 0xEE
161#define BRUSHLESS7_ZERO 0
168#define BRUSHLESS7_START_DUTY_MAX 49.8
169#define BRUSHLESS7_START_DUTY_AMP 512
176#define BRUSHLESS7_STOP_DUTY_MAX 49.6
177#define BRUSHLESS7_STOP_DUTY_AMP 256
178#define BRUSHLESS7_STOP_DUTY_MASK 0x80
185#define BRUSHLESS7_CHANGE_DUTY_MIN 0.4
186#define BRUSHLESS7_CHANGE_DUTY_MAX 99.6
187#define BRUSHLESS7_CHANGE_DUTY_AMP 256
194#define BRUSHLESS7_MAX_DUTY_MIN 50.2
195#define BRUSHLESS7_MAX_DUTY_MAX 100.0
196#define BRUSHLESS7_MAX_DUTY_AMP 512
197#define BRUSHLESS7_MAX_DUTY_DEC 257
204#define BRUSHLESS7_START_RPM_MAX 4095
205#define BRUSHLESS7_START_RPM_SHIFT 4
206#define BRUSHLESS7_START_RPM_MASK 0x0F
213#define BRUSHLESS7_MAX_SPEED_RMP_MASK 0xF9
220#define BRUSHLESS7_PRECENTAGE_DIV 100
227#define BRUSHLESS7_DEF_FREQ 5000
#define BRUSHLESS7_RETVAL
Definition: brushless7.h:67
void brushless7_cfg_setup(brushless7_cfg_t *cfg)
Config Object Initialization function.
uint8_t brushless7_start_duty(brushless7_t *ctx, float duty_ptc)
Function for setting start duty of device.
void brushless7_set_sby_pin_state(brushless7_t *ctx, uint8_t state)
Generic function for setting SBY pin state.
uint8_t brushless7_get_int_pin_state(brushless7_t *ctx)
Generic function for getting INT pin state.
void brushless7_pwm_start(brushless7_t *ctx)
Start PWM module.
uint8_t brushless7_start_rpm(brushless7_t *ctx, uint16_t rpm_val)
Function for setting start rpm parameter of device.
void brushless7_set_duty_cycle(brushless7_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
uint8_t brushless7_rotating_direction(brushless7_t *ctx, uint8_t direction_rot)
Function for setting rotation direction.
void brushless7_generic_read(brushless7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void brushless7_toggle_dir_pin_state(brushless7_t *ctx)
Generic function for toggling DIR pin state.
BRUSHLESS7_RETVAL brushless7_init(brushless7_t *ctx, brushless7_cfg_t *cfg)
Initialization function.
uint8_t brushless7_max_speed_rpm(brushless7_t *ctx, uint8_t max_speed_rpm)
Function for setting max rpm parameter of device.
uint8_t brushless7_control_mode_set(brushless7_t *ctx, uint8_t ctrl_type)
Function for setting type of device control.
uint8_t brushless7_max_duty(brushless7_t *ctx, float duty_ptc)
Function for setting max duty of device.
uint8_t brushless7_change_duty(brushless7_t *ctx, float duty_ptc)
Function for changeing duty of device.
uint8_t brushless7_stop_duty(brushless7_t *ctx, float duty_ptc)
Function for setting stop duty of device.
void brushless7_default_cfg(brushless7_t *ctx)
Click Default Configuration function.
void brushless7_generic_write(brushless7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void brushless7_pwm_stop(brushless7_t *ctx)
Stop PWM module.
Click configuration structure definition.
Definition: brushless7.h:268
pin_name_t cmo
Definition: brushless7.h:277
uint32_t i2c_speed
Definition: brushless7.h:285
uint32_t dev_pwm_freq
Definition: brushless7.h:284
pin_name_t dir
Definition: brushless7.h:278
pin_name_t scl
Definition: brushless7.h:271
pin_name_t int_pin
Definition: brushless7.h:280
pin_name_t pwm
Definition: brushless7.h:273
pin_name_t sda
Definition: brushless7.h:272
pin_name_t sby
Definition: brushless7.h:279
uint8_t i2c_address
Definition: brushless7.h:286
Click ctx object definition.
Definition: brushless7.h:241
uint32_t pwm_freq
Definition: brushless7.h:259
digital_in_t cmo
Definition: brushless7.h:249
digital_in_t int_pin
Definition: brushless7.h:250
i2c_master_t i2c
Definition: brushless7.h:255
digital_out_t sby
Definition: brushless7.h:245
uint8_t slave_address
Definition: brushless7.h:260
pwm_t pwm
Definition: brushless7.h:254
digital_out_t dir
Definition: brushless7.h:244