brushless13 2.1.0.0
Brushless 13 Click Driver

API for configuring and manipulating Brushless 13 Click driver. More...

Topics

 Brushless 13 Registers List
 List of registers of Brushless 13 Click driver.
 
 Brushless 13 Registers Settings
 Settings for registers of Brushless 13 Click driver.
 
 Brushless 13 MikroBUS Map
 MikroBUS pin mapping of Brushless 13 Click driver.
 

Functions

void brushless13_cfg_setup (brushless13_cfg_t *cfg)
 Brushless 13 configuration object setup function.
 
err_t brushless13_init (brushless13_t *ctx, brushless13_cfg_t *cfg)
 Brushless 13 initialization function.
 
err_t brushless13_default_cfg (brushless13_t *ctx)
 Brushless 13 default configuration function.
 
err_t brushless13_generic_write (brushless13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Brushless 13 I2C writing function.
 
err_t brushless13_generic_read (brushless13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Brushless 13 I2C reading function.
 
void brushless13_set_rst_pin (brushless13_t *ctx, uint8_t pin_state)
 Brushless 13 set rst pin function.
 
uint8_t brushless13_get_flt_state (brushless13_t *ctx)
 Brushless 13 get flt pin function.
 
void brushless13_set_mode (brushless13_t *ctx, uint8_t mode_sel)
 Brushless 13 set mode pin function.
 
void brushless13_reset_port_exp (brushless13_t *ctx)
 Brushless 13 reset port expander function.
 
uint8_t brushless13_get_flt_pin (brushless13_t *ctx)
 Brushless 13 get fault pin function.
 
err_t brushless13_write_reg (brushless13_t *ctx, uint8_t reg, uint8_t data_in)
 Brushless 13 write register function.
 
err_t brushless13_read_reg (brushless13_t *ctx, uint8_t reg, uint8_t *data_out)
 Brushless 13 read register function.
 
err_t brushless13_set_pins (brushless13_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 Brushless 13 set pins function.
 
err_t brushless13_set_trap_com_state (brushless13_t *ctx, uint8_t state)
 Brushless 13 set trapezoidal com state function.
 
err_t brushless13_toggle_pin (brushless13_t *ctx, uint8_t pin_mask, uint8_t speed)
 Brushless 13 toggle pin function.
 
err_t brushless13_perform_com_seq (brushless13_t *ctx, uint8_t dir, uint8_t speed)
 Brushless 13 perform com sequence function.
 
err_t brushless13_drive_motor (brushless13_t *ctx, uint8_t dir, uint8_t speed, uint32_t time_ms)
 Brushless 13 drive motor function.
 

Detailed Description

API for configuring and manipulating Brushless 13 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ brushless13_cfg_setup()

void brushless13_cfg_setup ( brushless13_cfg_t * cfg)

Brushless 13 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See brushless13_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ brushless13_default_cfg()

err_t brushless13_default_cfg ( brushless13_t * ctx)

Brushless 13 default configuration function.

This function executes a default configuration of Brushless 13 click board.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ brushless13_drive_motor()

err_t brushless13_drive_motor ( brushless13_t * ctx,
uint8_t dir,
uint8_t speed,
uint32_t time_ms )

Brushless 13 drive motor function.

This function drives the motor for a desired time by performing multiple commutation sequences for the selected rotation direction at a desired speed.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]dir: Rotation direction.
[in]speed: Speed (0-100).
[in]time_ms: Driving time in milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_generic_read()

err_t brushless13_generic_read ( brushless13_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Brushless 13 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_generic_write()

err_t brushless13_generic_write ( brushless13_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Brushless 13 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_get_flt_pin()

uint8_t brushless13_get_flt_pin ( brushless13_t * ctx)

Brushless 13 get fault pin function.

This function returns the fault pin logic state.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
Returns
State of the FLT pin.
Note
None.

◆ brushless13_get_flt_state()

uint8_t brushless13_get_flt_state ( brushless13_t * ctx)

Brushless 13 get flt pin function.

This function reads FLT pin logic state.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]state: State of the RST pin.
Returns
  • 0 - Fault state,
  • 1 - No fault state.
Note
None.

◆ brushless13_init()

err_t brushless13_init ( brushless13_t * ctx,
brushless13_cfg_t * cfg )

Brushless 13 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See brushless13_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_perform_com_seq()

err_t brushless13_perform_com_seq ( brushless13_t * ctx,
uint8_t dir,
uint8_t speed )

Brushless 13 perform com sequence function.

This function performs a single commutation sequence for the selected rotation direction at a desired speed.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]dir: Rotation direction.
[in]speed: Speed (0-100).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_read_reg()

err_t brushless13_read_reg ( brushless13_t * ctx,
uint8_t reg,
uint8_t * data_out )

Brushless 13 read register function.

This function reads data from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_reset_port_exp()

void brushless13_reset_port_exp ( brushless13_t * ctx)

Brushless 13 reset port expander function.

This function resets the port expander by toggling the RST pin.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ brushless13_set_mode()

void brushless13_set_mode ( brushless13_t * ctx,
uint8_t mode_sel )

Brushless 13 set mode pin function.

This function sets the mod pin logic state, regulating operation mode.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]mode_sel: Mode selection.
Returns
None.
Note
None.

◆ brushless13_set_pins()

err_t brushless13_set_pins ( brushless13_t * ctx,
uint8_t set_mask,
uint8_t clr_mask )

Brushless 13 set pins function.

This function sets and clears the value of the selected pins of PCA9538A port expander.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]clr_mask: Pin clear mask.
[in]set_mask: Pin set mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_set_rst_pin()

void brushless13_set_rst_pin ( brushless13_t * ctx,
uint8_t pin_state )

Brushless 13 set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]state: State of the RST pin.
Returns
None.
Note
None.

◆ brushless13_set_trap_com_state()

err_t brushless13_set_trap_com_state ( brushless13_t * ctx,
uint8_t state )

Brushless 13 set trapezoidal com state function.

This function sets the pin state for the selected trapezoidal commutation state.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]state: Trapezoidal commutation state (0-7) - BRUSHLESS26_TR_COM_STATE_x macros.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_toggle_pin()

err_t brushless13_toggle_pin ( brushless13_t * ctx,
uint8_t pin_mask,
uint8_t speed )

Brushless 13 toggle pin function.

This function toggles the selected pin of port expander BRUSHLESS26_NUM_PIN_TOGGLE times with a delay of (speed + 1) * 100us between each toggle.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]pin_mask: Pin to toggle mask.
[in]speed: Speed (0-100).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless13_write_reg()

err_t brushless13_write_reg ( brushless13_t * ctx,
uint8_t reg,
uint8_t data_in )

Brushless 13 write register function.

This function writes a desired data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See brushless13_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.