brushless8 2.0.0.0
Brushless 8 Click Driver

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

Topics

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

Functions

void brushless8_cfg_setup (brushless8_cfg_t *cfg)
 Brushless 8 configuration object setup function.
 
BRUSHLESS8_RETVAL brushless8_init (brushless8_t *ctx, brushless8_cfg_t *cfg)
 Brushless 8 initialization function.
 
BRUSHLESS8_RETVAL brushless8_default_cfg (brushless8_t *ctx)
 Brushless 8 default configuration function.
 
void brushless8_dac_write_data (brushless8_t *ctx, uint8_t reg, uint16_t write_data)
 Brushless 8 I2C write function.
 
uint16_t brushless8_dac_read_data (brushless8_t *ctx, uint8_t reg)
 Brushless 8 I2C read function.
 
uint8_t brushless8_get_fg (brushless8_t *ctx)
 Brushless 8 fg state.
 
void brushless8_set_direction (brushless8_t *ctx, uint8_t status)
 Brushless 8 dir pin setting.
 
void brushless8_set_reset (brushless8_t *ctx, uint8_t status)
 Brushless 8 rst pin setting.
 
int8_t brushless8_set_dac_vout (brushless8_t *ctx, uint8_t dac_chn, uint16_t vout)
 Brushless 8 I2C function for setting vout.
 
void brushless8_set_duty_cycle (brushless8_t *ctx, float duty_cycle)
 Sets PWM duty cycle.
 
void brushless8_pwm_stop (brushless8_t *ctx)
 Stops PWM module.
 
void brushless8_pwm_start (brushless8_t *ctx)
 Starts PWM module.
 
BRUSHLESS8_RETVAL brushless8_read_adc (brushless8_t *ctx, uint16_t *data_out)
 ADC read function.
 
BRUSHLESS8_RETVAL brushless8_read_an_voltage (brushless8_t *ctx, float *data_out)
 AN voltage read function.
 

Detailed Description

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

◆ brushless8_cfg_setup()

void brushless8_cfg_setup ( brushless8_cfg_t * cfg)

Brushless 8 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfgClick configuration structure. See brushless8_cfg_t object definition for detailed explanation.

Default values:

Function Default value
SCL pin HAL_PIN_NC (invalid pin)
SDA pin HAL_PIN_NC (invalid pin)
DIR pin HAL_PIN_NC (invalid pin)
AN pin HAL_PIN_NC (invalid pin)
RST pin HAL_PIN_NC (invalid pin)
PWM pin HAL_PIN_NC (invalid pin)
FG pin HAL_PIN_NC (invalid pin)
I2C baud rate 100000bps
I2C slave address 0x47
PWM frequency 18kHz
ADC resolution 12-bit
ADC vref 2.5V
Default mode BRUSHLESS8_PWM
Returns
Nothing.
Note
All used pins will be set to default state – NOT CONNECTED.

◆ brushless8_dac_read_data()

uint16_t brushless8_dac_read_data ( brushless8_t * ctx,
uint8_t reg )

Brushless 8 I2C read function.

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

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]regStart register address.
Returns
Output read data.

See #err_t definition for detailed explanation.

Note
None.

◆ brushless8_dac_write_data()

void brushless8_dac_write_data ( brushless8_t * ctx,
uint8_t reg,
uint16_t write_data )

Brushless 8 I2C write function.

This function writes 16 bits of data from the selected register by using I2C serial interface.

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]regStart register address.
[in]write_dataData to be written.

See #err_t definition for detailed explanation.

Note
None.

◆ brushless8_default_cfg()

BRUSHLESS8_RETVAL brushless8_default_cfg ( brushless8_t * ctx)

Brushless 8 default configuration function.

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

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

◆ brushless8_get_fg()

uint8_t brushless8_get_fg ( brushless8_t * ctx)

Brushless 8 fg state.

This function reads fg pin input state.

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
Returns
  • 0 - logical state low,
  • 1 - logical state high.
Note
None.

◆ brushless8_init()

BRUSHLESS8_RETVAL brushless8_init ( brushless8_t * ctx,
brushless8_cfg_t * cfg )

Brushless 8 initialization function.

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

Parameters
[out]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]cfgClick configuration structure. See brushless8_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ brushless8_pwm_start()

void brushless8_pwm_start ( brushless8_t * ctx)

Starts PWM module.

Parameters
ctxClick object. @description This function starts the PWM module.

◆ brushless8_pwm_stop()

void brushless8_pwm_stop ( brushless8_t * ctx)

Stops PWM module.

Parameters
ctxClick object. @description This function stops the PWM module.

◆ brushless8_read_adc()

BRUSHLESS8_RETVAL brushless8_read_adc ( brushless8_t * ctx,
uint16_t * data_out )

ADC read function.

Parameters
[in]ctxClick object.
[out]data_outBuffer where read data is to be placed.
Returns
  • 0 - Ok,
  • -1 - Error. @description This function reads the ADC converted data.

◆ brushless8_read_an_voltage()

BRUSHLESS8_RETVAL brushless8_read_an_voltage ( brushless8_t * ctx,
float * data_out )

AN voltage read function.

Parameters
ctxClick object.
data_outBuffer where read data is to be placed.
Returns
  • 0 - Ok,
  • -1 - Error. @description This function reads and calculates the voltage level of the AN pin.

◆ brushless8_set_dac_vout()

int8_t brushless8_set_dac_vout ( brushless8_t * ctx,
uint8_t dac_chn,
uint16_t vout )

Brushless 8 I2C function for setting vout.

This function writes adequate vout value to appropriate dac_chn channel.

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]dac_chnAdequate channel.
[in]voutOutput voltage.
Returns
Function returns BRUSHLESS8_OK.
Note
None.

◆ brushless8_set_direction()

void brushless8_set_direction ( brushless8_t * ctx,
uint8_t status )

Brushless 8 dir pin setting.

This function sets dir pin output to status setting.

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]statusOutput value setting.
  • 0 - digital out high,
  • 1 - digital out low.
Note
None.

◆ brushless8_set_duty_cycle()

void brushless8_set_duty_cycle ( brushless8_t * ctx,
float duty_cycle )

Sets PWM duty cycle.

Parameters
ctxClick object.
duty_cyclePWM Duty cycle value. @description This function sets the PWM duty cycle value to duty_cycle.

◆ brushless8_set_reset()

void brushless8_set_reset ( brushless8_t * ctx,
uint8_t status )

Brushless 8 rst pin setting.

This function sets rst pin output to status setting.

Parameters
[in]ctxClick context object. See brushless8_t object definition for detailed explanation.
[in]statusOutput value setting.
  • 0 - digital out high,
  • 1 - digital out low.
Note
None.