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"
74#define BRUSHLESS22_DIGIPOT_MAX_VALUE 100000ul
75#define BRUSHLESS22_DIGIPOT_RESOLUTION 257
76#define BRUSHLESS22_ROUND_TO_NEAREST_INT 0.5
77#define BRUSHLESS22_SLEW_RATE_RES_MAX 47000
78#define BRUSHLESS22_SLEW_RATE_RES_DEFAULT 10000
79#define BRUSHLESS22_SLEW_RATE_RES_MIN 4700
80#define BRUSHLESS22_RPROG_3900 3900
81#define BRUSHLESS22_RPROG_24000 24000
82#define BRUSHLESS22_RPROG_ADDRESS 0x10
89#define BRUSHLESS22_ADDR_A2A1A0_000 0x28
90#define BRUSHLESS22_ADDR_A2A1A0_001 0x29
91#define BRUSHLESS22_ADDR_A2A1A0_010 0x2A
92#define BRUSHLESS22_ADDR_A2A1A0_011 0x2B
93#define BRUSHLESS22_ADDR_A2A1A0_100 0x2C
94#define BRUSHLESS22_ADDR_A2A1A0_101 0x2D
95#define BRUSHLESS22_ADDR_A2A1A0_110 0x2E
96#define BRUSHLESS22_ADDR_A2A1A0_111 0x2F
102#define BRUSHLESS22_DIR_FORWARD 0
103#define BRUSHLESS22_DIR_REVERSE 1
109#define BRUSHLESS22_DEF_FREQ 50000
127#define BRUSHLESS22_MAP_MIKROBUS( cfg, mikrobus ) \
128 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
129 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
130 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
131 cfg.rt = MIKROBUS( mikrobus, MIKROBUS_AN ); \
132 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_RST ); \
133 cfg.ss = MIKROBUS( mikrobus, MIKROBUS_CS ); \
134 cfg.fg = MIKROBUS( mikrobus, MIKROBUS_INT );
brushless22_return_value_t
Brushless 22 Click return value data.
Definition brushless22.h:197
@ BRUSHLESS22_OK
Definition brushless22.h:198
@ BRUSHLESS22_ERROR
Definition brushless22.h:199
err_t brushless22_pwm_start(brushless22_t *ctx)
Brushless 22 start PWM module.
uint8_t brushless22_get_fg_pin(brushless22_t *ctx)
Brushless 22 get fd pin function.
void brushless22_set_direction(brushless22_t *ctx, uint8_t dir)
Brushless 22 set direction function.
void brushless22_set_normal_regulation(brushless22_t *ctx)
Brushless 22 set normal regulation function.
err_t brushless22_set_duty_cycle(brushless22_t *ctx, float duty_cycle)
Brushless 22 sets PWM duty cycle.
err_t brushless22_pwm_stop(brushless22_t *ctx)
Brushless 22 stop PWM module.
err_t brushless22_init(brushless22_t *ctx, brushless22_cfg_t *cfg)
Brushless 22 initialization function.
err_t brushless22_default_cfg(brushless22_t *ctx)
Brushless 22 default configuration function.
void brushless22_set_low_load_regulation(brushless22_t *ctx)
Brushless 22 set low load regulation function.
void brushless22_cfg_setup(brushless22_cfg_t *cfg)
Brushless 22 configuration object setup function.
err_t brushless22_set_slew_rate_resistance(brushless22_t *ctx, uint16_t res_ohm)
Brushless 22 set slew rate resistance function.
void brushless22_set_soft_start(brushless22_t *ctx)
Brushless 22 set soft start function.
void brushless22_switch_direction(brushless22_t *ctx)
Brushless 22 switch direction function.
err_t brushless22_set_rprog(brushless22_t *ctx, uint16_t res_ohm)
Brushless 22 set rprog function.
void brushless22_set_strong_start(brushless22_t *ctx)
Brushless 22 set strong start function.
Brushless 22 Click configuration object.
Definition brushless22.h:173
pin_name_t fg
Definition brushless22.h:182
pin_name_t ss
Definition brushless22.h:181
uint32_t i2c_speed
Definition brushless22.h:186
pin_name_t rt
Definition brushless22.h:183
uint32_t dev_pwm_freq
Definition brushless22.h:188
pin_name_t dir
Definition brushless22.h:180
pin_name_t scl
Definition brushless22.h:175
pin_name_t pwm
Definition brushless22.h:177
pin_name_t sda
Definition brushless22.h:176
uint8_t i2c_address
Definition brushless22.h:187
Brushless 22 Click driver selector.
Definition brushless22.h:149
uint32_t pwm_freq
Definition brushless22.h:164
digital_out_t rt
Definition brushless22.h:153
i2c_master_t i2c
Definition brushless22.h:159
digital_out_t ss
Definition brushless22.h:152
uint8_t slave_address
Definition brushless22.h:163
digital_in_t fg
Definition brushless22.h:156
pwm_t pwm
Definition brushless22.h:160
digital_out_t dir
Definition brushless22.h:151