hbridge16 2.1.0.0
H-Bridge 16 Click Driver

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

Topics

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

Functions

void hbridge16_cfg_setup (hbridge16_cfg_t *cfg)
 H-Bridge 16 configuration object setup function.
 
err_t hbridge16_init (hbridge16_t *ctx, hbridge16_cfg_t *cfg)
 H-Bridge 16 initialization function.
 
err_t hbridge16_default_cfg (hbridge16_t *ctx)
 H-Bridge 16 default configuration function.
 
err_t hbridge16_generic_write (hbridge16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 16 I2C writing function.
 
err_t hbridge16_generic_read (hbridge16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 16 I2C reading function.
 
void hbridge16_reset_port_exp (hbridge16_t *ctx)
 H-Bridge 16 reset port expander function.
 
uint8_t hbridge16_get_int_pin (hbridge16_t *ctx)
 H-Bridge 16 get Interrupt pin function.
 
void hbridge16_set_slp_pin (hbridge16_t *ctx, uint8_t pin_state)
 H-Bridge 15 set Sleep pin function.
 
err_t hbridge16_write_reg (hbridge16_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 16 write register function.
 
err_t hbridge16_read_reg (hbridge16_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 16 read register function.
 
err_t hbridge16_set_pins (hbridge16_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 16 set pins function.
 
err_t hbridge16_set_mode (hbridge16_t *ctx, uint8_t mode_sel)
 H-Bridge 16 set mode function.
 
err_t hbridge16_set_out_state (hbridge16_t *ctx, uint8_t out_state)
 H-Bridge 16 set output function.
 

Detailed Description

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

◆ hbridge16_cfg_setup()

void hbridge16_cfg_setup ( hbridge16_cfg_t * cfg)

H-Bridge 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge16_default_cfg()

err_t hbridge16_default_cfg ( hbridge16_t * ctx)

H-Bridge 16 default configuration function.

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

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

◆ hbridge16_generic_read()

err_t hbridge16_generic_read ( hbridge16_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

H-Bridge 16 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 hbridge16_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.

◆ hbridge16_generic_write()

err_t hbridge16_generic_write ( hbridge16_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

H-Bridge 16 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 hbridge16_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.

◆ hbridge16_get_int_pin()

uint8_t hbridge16_get_int_pin ( hbridge16_t * ctx)

H-Bridge 16 get Interrupt pin function.

This function is used to get Interrupt pin state.

Parameters
[in]ctx: Click context object. See hbridge16_t object definition for detailed explanation.
Returns
  • 0 - Pin state low,
  • 1 - Pin state high.
Note
None.

◆ hbridge16_init()

err_t hbridge16_init ( hbridge16_t * ctx,
hbridge16_cfg_t * cfg )

H-Bridge 16 initialization function.

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

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

◆ hbridge16_read_reg()

err_t hbridge16_read_reg ( hbridge16_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 16 read register function.

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

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

◆ hbridge16_reset_port_exp()

void hbridge16_reset_port_exp ( hbridge16_t * ctx)

H-Bridge 16 reset port expander function.

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

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

◆ hbridge16_set_mode()

err_t hbridge16_set_mode ( hbridge16_t * ctx,
uint8_t mode_sel )

H-Bridge 16 set mode function.

This function sets interface mode.

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

◆ hbridge16_set_out_state()

err_t hbridge16_set_out_state ( hbridge16_t * ctx,
uint8_t out_state )

H-Bridge 16 set output function.

This function is used to set output state of the H-Bridge 16 click board.

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

◆ hbridge16_set_pins()

err_t hbridge16_set_pins ( hbridge16_t * ctx,
uint8_t set_mask,
uint8_t clr_mask )

H-Bridge 16 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 hbridge16_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.

◆ hbridge16_set_slp_pin()

void hbridge16_set_slp_pin ( hbridge16_t * ctx,
uint8_t pin_state )

H-Bridge 15 set Sleep pin function.

This function is used to set state of the Sleep pin.

Parameters
[in]ctx: Click context object. See #hbridge15_t object definition for detailed explanation.
[in]pin_state: Pin state.
Returns
None.
Note
None.

◆ hbridge16_write_reg()

err_t hbridge16_write_reg ( hbridge16_t * ctx,
uint8_t reg,
uint8_t data_in )

H-Bridge 16 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 hbridge16_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.