brushless14 2.0.0.0
Brushless 14 Click Driver

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

Topics

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

Functions

void brushless14_cfg_setup (brushless14_cfg_t *cfg)
 Brushless 14 configuration object setup function.
 
err_t brushless14_init (brushless14_t *ctx, brushless14_cfg_t *cfg)
 Brushless 14 initialization function.
 
err_t brushless14_default_cfg (brushless14_t *ctx)
 Brushless 14 default configuration function.
 
err_t brushless14_set_duty_cycle (brushless14_t *ctx, float duty_cycle)
 Brushless 14 sets PWM duty cycle.
 
err_t brushless14_pwm_stop (brushless14_t *ctx)
 Brushless 14 stop PWM module.
 
err_t brushless14_pwm_start (brushless14_t *ctx)
 Brushless 14 start PWM module.
 
err_t brushless14_dac_write (brushless14_t *ctx, uint8_t reg, uint16_t in_data)
 DAC write function.
 
err_t brushless14_dac_read (brushless14_t *ctx, uint8_t reg, uint16_t *out_data)
 DAC reading function.
 
err_t brushless14_set_adj0 (brushless14_t *ctx, uint16_t m_voltage)
 Set Adjusted input 0.
 
err_t brushless14_set_adj1 (brushless14_t *ctx, uint16_t m_voltage)
 Set Adjusted input 1.
 
err_t brushless14_set_adj2 (brushless14_t *ctx, uint16_t m_voltage)
 Set Adjusted input 2.
 
err_t brushless14_set_adj3 (brushless14_t *ctx, uint16_t m_voltage)
 Set Adjusted input 3.
 
err_t brushless14_set_fpwm (brushless14_t *ctx, uint16_t m_voltage)
 Set PWM frequency select input.
 
err_t brushless14_set_la (brushless14_t *ctx, uint16_t m_voltage)
 Set lead angle setting input.
 
err_t brushless14_port_expander_write (brushless14_t *ctx, uint8_t reg, uint8_t in_data)
 Port expander write function.
 
err_t brushless14_port_expander_read (brushless14_t *ctx, uint8_t reg, uint8_t *out_data)
 Port expander reading function.
 
err_t brushless14_set_slop (brushless14_t *ctx, uint8_t state)
 Set soft switching select.
 
err_t brushless14_set_rot (brushless14_t *ctx, uint8_t state)
 Set rotation speed of lead angle switching.
 
err_t brushless14_set_fst (brushless14_t *ctx, uint8_t state)
 Set forced commutation frequency select.
 
err_t brushless14_set_sel_adj (brushless14_t *ctx, uint8_t state)
 Set PWM duty function setting.
 
err_t brushless14_set_lap (brushless14_t *ctx, uint8_t state)
 Set overlapping commutation select.
 
err_t brushless14_get_fg_out (brushless14_t *ctx, uint8_t *state)
 Get rotation speed.
 
err_t brushless14_get_ld_out (brushless14_t *ctx, uint8_t *state)
 Get lock detection signal.
 
uint8_t brushless14_get_int (brushless14_t *ctx)
 Get port expadner interrupt.
 
void brushless14_set_dir (brushless14_t *ctx, uint8_t state)
 Set dirrection pin state.
 

Detailed Description

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

◆ brushless14_cfg_setup()

void brushless14_cfg_setup ( brushless14_cfg_t * cfg)

Brushless 14 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ brushless14_dac_read()

err_t brushless14_dac_read ( brushless14_t * ctx,
uint8_t reg,
uint16_t * out_data )

DAC reading function.

This function reads a word from the register for the DAC IC.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]reg: Start register address.
[out]out_data: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_dac_write()

err_t brushless14_dac_write ( brushless14_t * ctx,
uint8_t reg,
uint16_t in_data )

DAC write function.

This function writes a word to the register for the DAC IC.

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

◆ brushless14_default_cfg()

err_t brushless14_default_cfg ( brushless14_t * ctx)

Brushless 14 default configuration function.

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

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

◆ brushless14_get_fg_out()

err_t brushless14_get_fg_out ( brushless14_t * ctx,
uint8_t * state )

Get rotation speed.

This function gets rotation speed.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_get_int()

uint8_t brushless14_get_int ( brushless14_t * ctx)

Get port expadner interrupt.

This function gets interrupt signal from port expander pin.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
Returns
Interrupt pin state

◆ brushless14_get_ld_out()

err_t brushless14_get_ld_out ( brushless14_t * ctx,
uint8_t * state )

Get lock detection signal.

This function gets lock detection signal.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_init()

err_t brushless14_init ( brushless14_t * ctx,
brushless14_cfg_t * cfg )

Brushless 14 initialization function.

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

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

◆ brushless14_port_expander_read()

err_t brushless14_port_expander_read ( brushless14_t * ctx,
uint8_t reg,
uint8_t * out_data )

Port expander reading function.

This function reads a byte from the register for the Port expander IC.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]reg: Start register address.
[out]out_data: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_port_expander_write()

err_t brushless14_port_expander_write ( brushless14_t * ctx,
uint8_t reg,
uint8_t in_data )

Port expander write function.

This function writes a byte to the register for the Port expander IC.

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

◆ brushless14_pwm_start()

err_t brushless14_pwm_start ( brushless14_t * ctx)

Brushless 14 start PWM module.

This function starts the PWM module output.

Parameters
[out]ctx: Click context object. See brushless14_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_pwm_stop()

err_t brushless14_pwm_stop ( brushless14_t * ctx)

Brushless 14 stop PWM module.

This function stops the PWM module output.

Parameters
[out]ctx: Click context object. See brushless14_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_adj0()

err_t brushless14_set_adj0 ( brushless14_t * ctx,
uint16_t m_voltage )

Set Adjusted input 0.

This function sets adjusted input 0 voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_adj1()

err_t brushless14_set_adj1 ( brushless14_t * ctx,
uint16_t m_voltage )

Set Adjusted input 1.

This function sets adjusted input 1 voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_adj2()

err_t brushless14_set_adj2 ( brushless14_t * ctx,
uint16_t m_voltage )

Set Adjusted input 2.

This function sets adjusted input 2 voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_adj3()

err_t brushless14_set_adj3 ( brushless14_t * ctx,
uint16_t m_voltage )

Set Adjusted input 3.

This function sets adjusted input 3 voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_dir()

void brushless14_set_dir ( brushless14_t * ctx,
uint8_t state )

Set dirrection pin state.

This function sets CW/CCW pin state that changes rotation direction.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
Nothing.

◆ brushless14_set_duty_cycle()

err_t brushless14_set_duty_cycle ( brushless14_t * ctx,
float duty_cycle )

Brushless 14 sets PWM duty cycle.

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

Parameters
[out]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]duty_ratio: PWM duty_ratio.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_fpwm()

err_t brushless14_set_fpwm ( brushless14_t * ctx,
uint16_t m_voltage )

Set PWM frequency select input.

This function sets PWM frequency select input voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_fst()

err_t brushless14_set_fst ( brushless14_t * ctx,
uint8_t state )

Set forced commutation frequency select.

This function sets forced commutation frequency select.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_la()

err_t brushless14_set_la ( brushless14_t * ctx,
uint16_t m_voltage )

Set lead angle setting input.

This function sets lead angle setting input voltage level.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]m_voltage: Voltage level to be set in mV.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_lap()

err_t brushless14_set_lap ( brushless14_t * ctx,
uint8_t state )

Set overlapping commutation select.

This function sets overlapping commutation select.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_rot()

err_t brushless14_set_rot ( brushless14_t * ctx,
uint8_t state )

Set rotation speed of lead angle switching.

This function sets rotation speed of lead angle switching.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_sel_adj()

err_t brushless14_set_sel_adj ( brushless14_t * ctx,
uint8_t state )

Set PWM duty function setting.

This function sets PWM duty function setting.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ brushless14_set_slop()

err_t brushless14_set_slop ( brushless14_t * ctx,
uint8_t state )

Set soft switching select.

This function sets soft switching select.

Parameters
[in]ctx: Click context object. See brushless14_t object definition for detailed explanation.
[in]state: Logic state.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.