brushless23  2.0.0.0
Data Structures | Macros | Enumerations | Functions
brushless23.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  brushless23_t
 Brushless 23 Click context object. More...
 
struct  brushless23_cfg_t
 Brushless 23 Click configuration object. More...
 

Macros

#define BRUSHLESS23_REG_STATUS   0x00
 Brushless 23 register map. More...
 
#define BRUSHLESS23_REG_USER_ID   0x01
 
#define BRUSHLESS23_REG_STOP_DUTY   0x02
 
#define BRUSHLESS23_REG_START_DUTY   0x03
 
#define BRUSHLESS23_REG_CHANGE_DUTY   0x04
 
#define BRUSHLESS23_REG_MAX_DUTY   0x05
 
#define BRUSHLESS23_REG_START_RPM_MSB   0x06
 
#define BRUSHLESS23_REG_START_RPM_LSB   0x07
 
#define BRUSHLESS23_REG_8   0x08
 
#define BRUSHLESS23_REG_9   0x09
 
#define BRUSHLESS23_REG_10   0x0A
 
#define BRUSHLESS23_REG_11   0x0B
 
#define BRUSHLESS23_REG_KIX_KI   0x0C
 
#define BRUSHLESS23_REG_KPX_KP   0x0D
 
#define BRUSHLESS23_REG_14   0x0E
 
#define BRUSHLESS23_REG_15   0x0F
 
#define BRUSHLESS23_REG_16   0x10
 
#define BRUSHLESS23_REG_17   0x11
 
#define BRUSHLESS23_REG_18   0x12
 
#define BRUSHLESS23_REG_19   0x13
 
#define BRUSHLESS23_REG_TRE_PRETIP_TIP   0x14
 
#define BRUSHLESS23_REG_LA_FMAX_FST   0x15
 
#define BRUSHLESS23_REG_FPWM_DEADTIME   0x16
 
#define BRUSHLESS23_REG_ISD_OCP_SRC_SINK   0x17
 
#define BRUSHLESS23_REG_COMP_HYS   0x18
 
#define BRUSHLESS23_REG_SLAVE_ADRS   0x19
 
#define BRUSHLESS23_REG_SPD_MSB   0x1B
 
#define BRUSHLESS23_REG_SPD_LSB   0x1C
 
#define BRUSHLESS23_REG_HZ_CNT_MSB   0x1D
 
#define BRUSHLESS23_REG_HZ_CNT_LSB   0x1E
 
#define BRUSHLESS23_REG_NVM_W_R   0x56
 
#define BRUSHLESS23_REG_NVM_ST   0x57
 
#define BRUSHLESS23_DUTY_CYCLE_MIN_PCT   0.0
 Brushless 23 open loop setting for option 3. More...
 
#define BRUSHLESS23_DUTY_CYCLE_MAX_PCT   1.0
 
#define BRUSHLESS23_START_DUTY_MIN_PCT   0.0
 
#define BRUSHLESS23_START_DUTY_20_PCT   0.2
 
#define BRUSHLESS23_START_DUTY_MAX_PCT   0.498
 
#define BRUSHLESS23_STOP_DUTY_MIN_PCT   0.0
 
#define BRUSHLESS23_STOP_DUTY_18_PCT   0.18
 
#define BRUSHLESS23_STOP_DUTY_MAX_PCT   0.496
 
#define BRUSHLESS23_MAX_DUTY_MIN_PCT   0.502
 
#define BRUSHLESS23_MAX_DUTY_90_PCT   0.9
 
#define BRUSHLESS23_MAX_DUTY_MAX_PCT   1.0
 
#define BRUSHLESS23_CHANGE_DUTY_MIN_PCT   0.004
 
#define BRUSHLESS23_CHANGE_DUTY_90_PCT   0.9
 
#define BRUSHLESS23_CHANGE_DUTY_MAX_PCT   0.996
 
#define BRUSHLESS23_START_RPM_MIN_PCT   0.0
 
#define BRUSHLESS23_START_RPM_10_PCT   0.1
 
#define BRUSHLESS23_START_RPM_MAX_PCT   0.498
 
#define BRUSHLESS23_SPEED_SLOP_1_MSB   0x0F
 
#define BRUSHLESS23_SPEED_SLOP_1_LSB   0xF8
 
#define BRUSHLESS23_SPEED_SLOP_2_MSB   0x15
 
#define BRUSHLESS23_SPEED_SLOP_2_LSB   0xF0
 
#define BRUSHLESS23_OPEN_LOOP   0x01
 
#define BRUSHLESS23_TSPSEL_PWM_DUTY   0x10
 
#define BRUSHLESS23_ALERTINV_LOW   0x02
 
#define BRUSHLESS23_NO_STOP_BIT_MASK   0x80
 
#define BRUSHLESS23_DIR_CW   0
 Brushless 23 direction setting. More...
 
#define BRUSHLESS23_DIR_CCW   1
 
#define BRUSHLESS23_SBY_STANDBY   0
 Brushless 23 standby pin setting. More...
 
#define BRUSHLESS23_SBY_NORMAL_OPERATION   1
 
#define BRUSHLESS23_SPEED_FREQUENCY   250000.0
 Brushless 23 motor speed frequency calculation. More...
 
#define BRUSHLESS23_DEVICE_ADDRESS_ID2ID1_00   0x29
 Brushless 23 device address setting. More...
 
#define BRUSHLESS23_DEVICE_ADDRESS_ID2ID1_01   0x29
 
#define BRUSHLESS23_DEVICE_ADDRESS_ID2ID1_10   0x2D
 
#define BRUSHLESS23_DEVICE_ADDRESS_ID2ID1_11   0x32
 
#define BRUSHLESS23_DEF_FREQ   5000
 Brushless 23 default PWM frequency. More...
 
#define BRUSHLESS23_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  brushless23_return_value_t { BRUSHLESS23_OK = 0, BRUSHLESS23_ERROR = -1 }
 Brushless 23 Click return value data. More...
 

Functions

void brushless23_cfg_setup (brushless23_cfg_t *cfg)
 Brushless 23 configuration object setup function. More...
 
err_t brushless23_init (brushless23_t *ctx, brushless23_cfg_t *cfg)
 Brushless 23 initialization function. More...
 
err_t brushless23_default_cfg (brushless23_t *ctx)
 Brushless 23 default configuration function. More...
 
err_t brushless23_write_register (brushless23_t *ctx, uint8_t reg, uint8_t data_in)
 Brushless 23 write register function. More...
 
err_t brushless23_read_register (brushless23_t *ctx, uint8_t reg, uint8_t *data_out)
 Brushless 23 read register function. More...
 
err_t brushless23_pwm_set_duty_cycle (brushless23_t *ctx, float duty_cycle)
 Brushless 23 sets PWM duty cycle. More...
 
err_t brushless23_pwm_stop (brushless23_t *ctx)
 Brushless 23 stop PWM module. More...
 
err_t brushless23_pwm_start (brushless23_t *ctx)
 Brushless 23 start PWM module. More...
 
err_t brushless23_read_an_pin_value (brushless23_t *ctx, uint16_t *data_out)
 Brushless 23 read AN pin value function. More...
 
err_t brushless23_read_an_pin_voltage (brushless23_t *ctx, float *data_out)
 Brushless 23 read AN pin voltage level function. More...
 
void brushless23_set_sby_pin (brushless23_t *ctx, uint8_t state)
 Brushless 23 set sby pin function. More...
 
void brushless23_set_direction (brushless23_t *ctx, uint8_t dir)
 Brushless 23 set direction function. More...
 
void brushless23_switch_direction (brushless23_t *ctx)
 Brushless 23 switch direction function. More...
 
uint8_t brushless23_get_int_pin (brushless23_t *ctx)
 Brushless 22 get int pin function. More...
 
err_t brushless23_get_motor_speed (brushless23_t *ctx, float *motor_speed_hz)
 Brushless 23 get motor speed function. More...
 
err_t brushless23_set_start_duty (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set start duty function. More...
 
err_t brushless23_set_stop_duty (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set stop duty function. More...
 
err_t brushless23_set_max_duty (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set max duty function. More...
 
err_t brushless23_set_change_duty (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set change duty function. More...
 
err_t brushless23_set_start_rpm (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set start rpm function. More...
 
err_t brushless23_set_duty_cycle (brushless23_t *ctx, float duty_cycle)
 Brushless 23 set duty cycle function. More...
 

Detailed Description

This file contains API for Brushless 23 Click Driver.

Enumeration Type Documentation

◆ brushless23_return_value_t

Brushless 23 Click return value data.

Predefined enum values for driver return values.

Enumerator
BRUSHLESS23_OK 
BRUSHLESS23_ERROR