brushless21 2.0.0.0
Brushless 21 Click Driver

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

Topics

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

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

API for configuring and manipulating Brushless 21 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

◆ brushless21_cfg_setup()

void brushless21_cfg_setup ( brushless21_cfg_t * cfg)

Brushless 21 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ brushless21_default_cfg()

err_t brushless21_default_cfg ( brushless21_t * ctx)

Brushless 21 default configuration function.

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

Parameters
[in]ctx: Click context object. See brushless21_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.

◆ brushless21_disable_device()

void brushless21_disable_device ( brushless21_t * ctx)

Brushless 21 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ brushless21_drv_interface_selection()

void brushless21_drv_interface_selection ( brushless21_cfg_t * cfg,
brushless21_drv_t drv_sel )

Brushless 21 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See brushless21_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See brushless21_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ brushless21_enable_device()

void brushless21_enable_device ( brushless21_t * ctx)

Brushless 21 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ brushless21_get_fg_pin()

uint8_t brushless21_get_fg_pin ( brushless21_t * ctx)

Brushless 21 get fg pin function.

This function returns the FG pin logic state.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
Returns
Pin logic state.
Note
This function can only be used when the click is configured in GPIO mode.

◆ brushless21_get_motor_speed()

err_t brushless21_get_motor_speed ( brushless21_t * ctx,
float * motor_speed_hz )

Brushless 21 get motor speed function.

This function reads the motor speed in Hz.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[out]motor_speed_hz: Motor speed in Hz.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_get_temperature()

err_t brushless21_get_temperature ( brushless21_t * ctx,
int8_t * temperature )

Brushless 21 get temperature function.

This function reads the chip internal temperature in Celsius.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[out]temperature: Temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_get_vbb_voltage()

err_t brushless21_get_vbb_voltage ( brushless21_t * ctx,
float * vbb_voltage )

Brushless 21 get vbb voltage function.

This function reads the VBB voltage.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[out]vbb_voltage: VBB voltage.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_init()

err_t brushless21_init ( brushless21_t * ctx,
brushless21_cfg_t * cfg )

Brushless 21 initialization function.

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

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

◆ brushless21_pwm_start()

err_t brushless21_pwm_start ( brushless21_t * ctx)

Brushless 21 start PWM module.

This function starts the PWM module output.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in GPIO mode.

◆ brushless21_pwm_stop()

err_t brushless21_pwm_stop ( brushless21_t * ctx)

Brushless 21 stop PWM module.

This function stops the PWM module output.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in GPIO mode.

◆ brushless21_read_register()

err_t brushless21_read_register ( brushless21_t * ctx,
uint8_t reg,
uint16_t * data_out )

Brushless 21 read register function.

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

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data (16-bit).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_set_direction()

err_t brushless21_set_direction ( brushless21_t * ctx,
uint8_t direction )

Brushless 21 set direction function.

This function sets the motor direction.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[in]direction:
  • 0 - Reverse,
  • 1 - Forward.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_set_duty_cycle()

err_t brushless21_set_duty_cycle ( brushless21_t * ctx,
float duty_cycle )

Brushless 21 set duty cycle function.

This function sets the duty cycle in percentages ( Range[ 0..1 ] ).

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[in]duty_cycle: Duty cycle.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ brushless21_switch_direction()

err_t brushless21_switch_direction ( brushless21_t * ctx)

Brushless 21 switch direction function.

This function switches the motor direction by toggling the DIR bit.

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.

◆ brushless21_write_register()

err_t brushless21_write_register ( brushless21_t * ctx,
uint8_t reg,
uint16_t data_in )

Brushless 21 write register function.

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

Parameters
[in]ctx: Click context object. See brushless21_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written (16-bit).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can only be used when the click is configured in I2C mode.