hbridge13 2.1.0.0
H-Bridge 13 Click Driver

API for configuring and manipulating H-Bridge 13 Click driver. More...

Topics

 H-Bridge 13 Registers List
 List of registers of H-Bridge 13 Click driver.
 
 H-Bridge 13 Registers Settings
 Settings for registers of H-Bridge 13 Click driver.
 
 H-Bridge 13 MikroBUS Map
 MikroBUS pin mapping of H-Bridge 13 Click driver.
 

Functions

void hbridge13_cfg_setup (hbridge13_cfg_t *cfg)
 H-Bridge 13 configuration object setup function.
 
err_t hbridge13_init (hbridge13_t *ctx, hbridge13_cfg_t *cfg)
 H-Bridge 13 initialization function.
 
err_t hbridge13_default_cfg (hbridge13_t *ctx)
 H-Bridge 13 default configuration function.
 
err_t hbridge13_generic_write (hbridge13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 13 I2C writing function.
 
err_t hbridge13_generic_read (hbridge13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 13 I2C reading function.
 
err_t hbridge13_write_reg (hbridge13_t *ctx, uint8_t reg, uint8_t data_out)
 H-Bridge 13 write register function.
 
err_t hbridge13_read_reg (hbridge13_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 13 read register function.
 
err_t hbridge13_set_pins (hbridge13_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 13 set output pin state function.
 
err_t hbridge13_set_duty_cycle (hbridge13_t *ctx, float duty_cycle)
 H-Bridge 13 sets PWM duty cycle.
 
err_t hbridge13_pwm_stop (hbridge13_t *ctx)
 H-Bridge 13 stop PWM module.
 
err_t hbridge13_pwm_start (hbridge13_t *ctx)
 H-Bridge 13 start PWM module.
 
err_t hbridge13_set_brake (hbridge13_t *ctx)
 H-Bridge 13 set brake function.
 
err_t hbridge13_set_coast (hbridge13_t *ctx)
 H-Bridge 13 set coast function.
 
err_t hbridge13_set_direction (hbridge13_t *ctx, uint8_t dir_set, uint8_t speed)
 H-Bridge 13 set direction function.
 
err_t hbridge13_read_raw_adc (hbridge13_t *ctx, uint16_t *raw_adc)
 H-Bridge 13 read raw ADC value function.
 
err_t hbridge13_read_voltage (hbridge13_t *ctx, float *voltage)
 H-Bridge 13 read voltage level function.
 
err_t hbridge13_set_vref (hbridge13_t *ctx, float vref)
 H-Bridge 13 set vref function.
 
err_t hbridge13_get_an_voltage (hbridge13_t *ctx, float *voltage, uint8_t an_sel)
 H-Bridge 13 get xIPROPI voltage function.
 
err_t hbridge13_get_flt_state (hbridge13_t *ctx, uint8_t *pin_state)
 H-Bridge 13 get nFAULT state function.
 

Detailed Description

API for configuring and manipulating H-Bridge 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

◆ hbridge13_cfg_setup()

void hbridge13_cfg_setup ( hbridge13_cfg_t * cfg)

H-Bridge 13 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge13_default_cfg()

err_t hbridge13_default_cfg ( hbridge13_t * ctx)

H-Bridge 13 default configuration function.

This function executes a default configuration of H-Bridge 13 click board.

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

◆ hbridge13_generic_read()

err_t hbridge13_generic_read ( hbridge13_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

H-Bridge 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 hbridge13_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.

◆ hbridge13_generic_write()

err_t hbridge13_generic_write ( hbridge13_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

H-Bridge 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 hbridge13_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.

◆ hbridge13_get_an_voltage()

err_t hbridge13_get_an_voltage ( hbridge13_t * ctx,
float * voltage,
uint8_t an_sel )

H-Bridge 13 get xIPROPI voltage function.

This function is used to get xIPROPI voltage of H-Bridge 13 click driver.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[out]voltage: Output voltage.
[in]an_sel: Selection between AIPROPI and BIPROPI.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge13_get_flt_state()

err_t hbridge13_get_flt_state ( hbridge13_t * ctx,
uint8_t * pin_state )

H-Bridge 13 get nFAULT state function.

This function is used to get state of the nFAULT pin of H-Bridge 13 click driver.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[out]pin_state: nFAULT pin state.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge13_init()

err_t hbridge13_init ( hbridge13_t * ctx,
hbridge13_cfg_t * cfg )

H-Bridge 13 initialization function.

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

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

◆ hbridge13_pwm_start()

err_t hbridge13_pwm_start ( hbridge13_t * ctx)

H-Bridge 13 start PWM module.

This function starts the PWM module output.

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

◆ hbridge13_pwm_stop()

err_t hbridge13_pwm_stop ( hbridge13_t * ctx)

H-Bridge 13 stop PWM module.

This function stops the PWM module output.

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

◆ hbridge13_read_raw_adc()

err_t hbridge13_read_raw_adc ( hbridge13_t * ctx,
uint16_t * raw_adc )

H-Bridge 13 read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge13_read_reg()

err_t hbridge13_read_reg ( hbridge13_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 13 read register function.

This function is used to read byte of data into the selected register by using I2C serial interface.

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

◆ hbridge13_read_voltage()

err_t hbridge13_read_voltage ( hbridge13_t * ctx,
float * voltage )

H-Bridge 13 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ hbridge13_set_brake()

err_t hbridge13_set_brake ( hbridge13_t * ctx)

H-Bridge 13 set brake function.

This function is used to place outputs into brakeing mode.

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

◆ hbridge13_set_coast()

err_t hbridge13_set_coast ( hbridge13_t * ctx)

H-Bridge 13 set coast function.

This function is used to place outputs into coasting mode.

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

◆ hbridge13_set_direction()

err_t hbridge13_set_direction ( hbridge13_t * ctx,
uint8_t dir_set,
uint8_t speed )

H-Bridge 13 set direction function.

This function is used to set motor direction and speed.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[in]dir_set: Direction selection.
[in]speed: Speed value in percentages.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge13_set_duty_cycle()

err_t hbridge13_set_duty_cycle ( hbridge13_t * ctx,
float duty_cycle )

H-Bridge 13 sets PWM duty cycle.

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

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

◆ hbridge13_set_pins()

err_t hbridge13_set_pins ( hbridge13_t * ctx,
uint8_t set_mask,
uint8_t clr_mask )

H-Bridge 13 set output pin state function.

This function is used to change state of the output pins.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[in]set_mask: High state pins.
[in]clr_mask: Low state pins.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge13_set_vref()

err_t hbridge13_set_vref ( hbridge13_t * ctx,
float vref )

H-Bridge 13 set vref function.

This function sets the voltage reference for H-Bridge 13 click driver.

Parameters
[in]ctx: Click context object. See hbridge13_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with hbridge13_init is 3.3V.

◆ hbridge13_write_reg()

err_t hbridge13_write_reg ( hbridge13_t * ctx,
uint8_t reg,
uint8_t data_out )

H-Bridge 13 write register function.

This function is used to write byte of data into the selected register by using I2C serial interface.

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