brushless20 2.1.0.0
brushless20.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  brushless20_t
 Brushless 20 Click context object. More...
 
struct  brushless20_cfg_t
 Brushless 20 Click configuration object. More...
 

Macros

#define BRUSHLESS20_REG_INPUT   0x00
 Brushless 20 PCA9538A registers.
 
#define BRUSHLESS20_REG_OUTPUT   0x01
 
#define BRUSHLESS20_REG_POLARITY   0x02
 
#define BRUSHLESS20_REG_CONFIG   0x03
 
#define BRUSHLESS20_NONE_PIN   0x00
 Brushless 20 PCA9538A pin mask.
 
#define BRUSHLESS20_IN1_PIN   0x01
 
#define BRUSHLESS20_EN1_PIN   0x02
 
#define BRUSHLESS20_IN2_PIN   0x04
 
#define BRUSHLESS20_EN2_PIN   0x08
 
#define BRUSHLESS20_IN3_PIN   0x10
 
#define BRUSHLESS20_EN3_PIN   0x20
 
#define BRUSHLESS20_NRST_PIN   0x40
 
#define BRUSHLESS20_FLT_PIN   0x80
 
#define BRUSHLESS20_ALL_PINS   0xFF
 
#define BRUSHLESS20_DEFAULT_CONFIG   0x80
 Brushless 20 PCA9538A pin direction config.
 
#define BRUSHLESS20_DIR_CW   0
 Brushless 20 direction setting.
 
#define BRUSHLESS20_DIR_CCW   1
 
#define BRUSHLESS20_PIN_LOW_LEVEL   0
 Brushless 20 pin logic level setting.
 
#define BRUSHLESS20_PIN_HIGH_LEVEL   1
 
#define BRUSHLESS20_TR_COM_STATE_COAST   0
 Brushless 20 trapezoidal (120 percents) commutation state settings.
 
#define BRUSHLESS20_TR_COM_STATE_1   1
 
#define BRUSHLESS20_TR_COM_STATE_2   2
 
#define BRUSHLESS20_TR_COM_STATE_3   3
 
#define BRUSHLESS20_TR_COM_STATE_4   4
 
#define BRUSHLESS20_TR_COM_STATE_5   5
 
#define BRUSHLESS20_TR_COM_STATE_6   6
 
#define BRUSHLESS20_TR_COM_STATE_BRAKE   7
 
#define BRUSHLESS20_SPEED_MIN   0
 Brushless 20 driving speed and time settings.
 
#define BRUSHLESS20_SPEED_MAX   100
 
#define BRUSHLESS20_NUM_PIN_TOGGLE   8
 
#define BRUSHLESS20_ROUND_TO_NEAREAST_INT   0.5
 
#define BRUSHLESS20_COM_SEQ_DURATION_FOR_SPEED_MAX   24.729
 Brushless 20 commutation sequance duration settings.
 
#define BRUSHLESS20_COM_SEQ_DURATION_SPEED_STEP   ( 29.4361 - BRUSHLESS20_COM_SEQ_DURATION_FOR_SPEED_MAX )
 
#define BRUSHLESS20_DEVICE_ADDRESS_A1A0_00   0x70
 Brushless 20 device address setting.
 
#define BRUSHLESS20_DEVICE_ADDRESS_A1A0_01   0x71
 
#define BRUSHLESS20_DEVICE_ADDRESS_A1A0_10   0x72
 
#define BRUSHLESS20_DEVICE_ADDRESS_A1A0_11   0x73
 
#define BRUSHLESS20_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  brushless20_return_value_t { BRUSHLESS20_OK = 0 , BRUSHLESS20_ERROR = -1 }
 Brushless 20 Click return value data. More...
 

Functions

void brushless20_cfg_setup (brushless20_cfg_t *cfg)
 Brushless 20 configuration object setup function.
 
err_t brushless20_init (brushless20_t *ctx, brushless20_cfg_t *cfg)
 Brushless 20 initialization function.
 
err_t brushless20_default_cfg (brushless20_t *ctx)
 Brushless 20 default configuration function.
 
err_t brushless20_write_register (brushless20_t *ctx, uint8_t reg, uint8_t data_in)
 Brushless 20 write register function.
 
err_t brushless20_read_register (brushless20_t *ctx, uint8_t reg, uint8_t *data_out)
 Brushless 20 read register function.
 
err_t brushless20_set_pins (brushless20_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 Brushless 20 set pins function.
 
err_t brushless20_get_fault_pin (brushless20_t *ctx)
 Brushless 20 get fault pin function.
 
void brushless20_reset_port_expander (brushless20_t *ctx)
 Brushless 20 reset port expander function.
 
void brushless20_set_rst_pin (brushless20_t *ctx, uint8_t state)
 Brushless 20 set rst pin function.
 
void brushless20_enter_sleep_mode (brushless20_t *ctx)
 Brushless 20 enter sleep mode function.
 
void brushless20_exit_sleep_mode (brushless20_t *ctx)
 Brushless 20 exit sleep mode function.
 
uint8_t brushless20_get_int_pin (brushless20_t *ctx)
 Brushless 20 get int pin function.
 
err_t brushless20_set_trapezoidal_com_state (brushless20_t *ctx, uint8_t state)
 Brushless 20 set trapezoidal com state function.
 
err_t brushless20_toggle_pin (brushless20_t *ctx, uint8_t pin_mask, uint8_t speed)
 Brushless 20 toggle pin function.
 
err_t brushless20_perform_com_sequence (brushless20_t *ctx, uint8_t dir, uint8_t speed)
 Brushless 20 perform com sequence function.
 
err_t brushless20_drive_motor (brushless20_t *ctx, uint8_t dir, uint8_t speed, uint32_t time_ms)
 Brushless 20 drive motor function.
 

Detailed Description

This file contains API for Brushless 20 Click Driver.

Enumeration Type Documentation

◆ brushless20_return_value_t

Brushless 20 Click return value data.

Predefined enum values for driver return values.

Enumerator
BRUSHLESS20_OK 
BRUSHLESS20_ERROR