brushless21 2.0.0.0
brushless21.h File Reference

This file contains API for Brushless 21 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_pwm.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  brushless21_t
 Brushless 21 Click context object. More...
 
struct  brushless21_cfg_t
 Brushless 21 Click configuration object. More...
 

Macros

#define BRUSHLESS21_EEPROM_USER_0   0x06
 Brushless 21 EEPROM Map.
 
#define BRUSHLESS21_EEPROM_USER_1   0x07
 
#define BRUSHLESS21_EEPROM_RATED_SPEED_DIR   0x08
 
#define BRUSHLESS21_EEPROM_ACCELERATION_AND_RES   0x09
 
#define BRUSHLESS21_EEPROM_CURRENT   0x0A
 
#define BRUSHLESS21_EEPROM_MODE   0x0B
 
#define BRUSHLESS21_EEPROM_PID_P_AND_INDUCTANCE   0x0C
 
#define BRUSHLESS21_EEPROM_PID_I_AND_DELAY   0x0D
 
#define BRUSHLESS21_EEPROM_LOCK_AND_SOFT_CTRL   0x0F
 
#define BRUSHLESS21_EEPROM_OCP_FCSPEED_ACDEC_BUF_FLT   0x10
 
#define BRUSHLESS21_EEPROM_SPEED_AND_FG   0x11
 
#define BRUSHLESS21_EEPROM_IPD_CURRENT_THR   0x12
 
#define BRUSHLESS21_EEPROM_RATED_VOLTAGE   0x14
 
#define BRUSHLESS21_EEPROM_SLIGHT_MOVE_LOW_DUTY_THR   0x15
 
#define BRUSHLESS21_EEPROM_CLOSED_LOOP_TIME   0x16
 
#define BRUSHLESS21_EEPROM_CONTROL   0xA1
 
#define BRUSHLESS21_EEPROM_ADDRESS   0xA2
 
#define BRUSHLESS21_EEPROM_DATA_IN   0xA3
 
#define BRUSHLESS21_REG_RATED_SPEED_DIR   0x48
 Brushless 21 Register Map.
 
#define BRUSHLESS21_REG_ACCELERATION_AND_RES   0x49
 
#define BRUSHLESS21_REG_CURRENT   0x4A
 
#define BRUSHLESS21_REG_MODE   0x4B
 
#define BRUSHLESS21_REG_PID_P_AND_INDUCTANCE   0x4C
 
#define BRUSHLESS21_REG_PID_I_AND_DELAY   0x4D
 
#define BRUSHLESS21_REG_LOCK_AND_SOFT_CTRL   0x4F
 
#define BRUSHLESS21_REG_OCP_FCSPEED_ACDEC_BUF_FLT   0x50
 
#define BRUSHLESS21_REG_SPEED_AND_FG   0x51
 
#define BRUSHLESS21_REG_IPD_CURRENT_THR   0x52
 
#define BRUSHLESS21_REG_RATED_VOLTAGE   0x54
 
#define BRUSHLESS21_REG_SLIGHT_MOVE_LOW_DUTY_THR   0x55
 
#define BRUSHLESS21_REG_CLOSED_LOOP_TIME   0x56
 
#define BRUSHLESS21_REG_READBACK_MOTOR_SPEED   0x78
 
#define BRUSHLESS21_REG_READBACK_BUS_CURRENT   0x79
 
#define BRUSHLESS21_REG_READBACK_Q_AXIS_CURRENT   0x7A
 
#define BRUSHLESS21_REG_READBACK_VBB   0x7B
 
#define BRUSHLESS21_REG_READBACK_TEMPERATURE   0x7C
 
#define BRUSHLESS21_REG_READBACK_CONTROL_DEMAND   0x7D
 
#define BRUSHLESS21_REG_READBACK_CONTROL_COMMAND   0x7E
 
#define BRUSHLESS21_DIR_REVERSE   0
 Brushless 21 direction setting.
 
#define BRUSHLESS21_DIR_FORWARD   1
 
#define BRUSHLESS21_MOTOR_SPEED_HZ   0.530
 Brushless 21 calculation values.
 
#define BRUSHLESS21_VBB_MAX   20
 
#define BRUSHLESS21_VBB_RESOLUTION   0xFF
 
#define BRUSHLESS21_TEMPERATURE_OFFSET   73
 
#define BRUSHLESS21_I2C_DUTY_RESOLUTION   0x01FF
 
#define BRUSHLESS21_DUTY_CONTROLLED_BY_I2C_BIT   0x0200
 
#define BRUSHLESS21_DEF_FREQ   5000
 Brushless 21 default PWM frequency.
 
#define BRUSHLESS21_SET_DEV_ADDR   0x55
 Brushless 21 device address setting.
 
#define BRUSHLESS21_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  brushless21_drv_t { BRUSHLESS21_DRV_SEL_GPIO , BRUSHLESS21_DRV_SEL_I2C }
 Brushless 21 Click driver selector. More...
 
enum  brushless21_return_value_t { BRUSHLESS21_OK = 0 , BRUSHLESS21_ERROR = -1 }
 Brushless 21 Click return value data. More...
 

Functions

void brushless21_cfg_setup (brushless21_cfg_t *cfg)
 Brushless 21 configuration object setup function.
 
void brushless21_drv_interface_selection (brushless21_cfg_t *cfg, brushless21_drv_t drv_sel)
 Brushless 21 driver interface setup function.
 
err_t brushless21_init (brushless21_t *ctx, brushless21_cfg_t *cfg)
 Brushless 21 initialization function.
 
err_t brushless21_default_cfg (brushless21_t *ctx)
 Brushless 21 default configuration function.
 
err_t brushless21_pwm_stop (brushless21_t *ctx)
 Brushless 21 stop PWM module.
 
err_t brushless21_pwm_start (brushless21_t *ctx)
 Brushless 21 start PWM module.
 
err_t brushless21_set_duty_cycle (brushless21_t *ctx, float duty_cycle)
 Brushless 21 set duty cycle function.
 
err_t brushless21_write_register (brushless21_t *ctx, uint8_t reg, uint16_t data_in)
 Brushless 21 write register function.
 
err_t brushless21_read_register (brushless21_t *ctx, uint8_t reg, uint16_t *data_out)
 Brushless 21 read register function.
 
void brushless21_enable_device (brushless21_t *ctx)
 Brushless 21 enable device function.
 
void brushless21_disable_device (brushless21_t *ctx)
 Brushless 21 disable device function.
 
uint8_t brushless21_get_fg_pin (brushless21_t *ctx)
 Brushless 21 get fg pin function.
 
err_t brushless21_get_temperature (brushless21_t *ctx, int8_t *temperature)
 Brushless 21 get temperature function.
 
err_t brushless21_get_motor_speed (brushless21_t *ctx, float *motor_speed_hz)
 Brushless 21 get motor speed function.
 
err_t brushless21_get_vbb_voltage (brushless21_t *ctx, float *vbb_voltage)
 Brushless 21 get vbb voltage function.
 
err_t brushless21_set_direction (brushless21_t *ctx, uint8_t direction)
 Brushless 21 set direction function.
 
err_t brushless21_switch_direction (brushless21_t *ctx)
 Brushless 21 switch direction function.
 

Detailed Description

This file contains API for Brushless 21 Click Driver.

Enumeration Type Documentation

◆ brushless21_drv_t

Brushless 21 Click driver selector.

Selects target driver interface of Brushless 21 Click driver.

Enumerator
BRUSHLESS21_DRV_SEL_GPIO 

GPIO driver descriptor.

BRUSHLESS21_DRV_SEL_I2C 

I2C driver descriptor.

◆ brushless21_return_value_t

Brushless 21 Click return value data.

Predefined enum values for driver return values.

Enumerator
BRUSHLESS21_OK 
BRUSHLESS21_ERROR