hbridge14 2.1.0.0
H-Bridge 14 Click Driver

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

Topics

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

Functions

void hbridge14_cfg_setup (hbridge14_cfg_t *cfg)
 H-Bridge 14 configuration object setup function.
 
err_t hbridge14_init (hbridge14_t *ctx, hbridge14_cfg_t *cfg)
 H-Bridge 14 initialization function.
 
err_t hbridge14_default_cfg (hbridge14_t *ctx)
 H-Bridge 14 default configuration function.
 
err_t hbridge14_generic_write (hbridge14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 14 data writing function.
 
err_t hbridge14_generic_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 14 data reading function.
 
void hbridge14_set_in1_pin (hbridge14_t *ctx, uint8_t pin_state)
 H-Bridge 14 set IN1 pin function.
 
void hbridge14_set_rst_pin (hbridge14_t *ctx, uint8_t pin_state)
 H-Bridge 14 set RST pin function.
 
uint8_t hbridge14_get_ip_pin (hbridge14_t *ctx)
 H-Bridge 14 get IP pin function.
 
uint8_t hbridge14_get_int_pin (hbridge14_t *ctx)
 H-Bridge 14 get INT pin function.
 
err_t hbridge14_register_write (hbridge14_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 14 data register writing function.
 
err_t hbridge14_register_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 14 data register reading function.
 
err_t hbridge14_port_expander_write (hbridge14_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 14 port ecpander write register function.
 
err_t hbridge14_port_expander_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 14 port ecpander read register function.
 
err_t hbridge14_set_pins (hbridge14_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 14 set pins function.
 
err_t hbridge14_disable_state (hbridge14_t *ctx, uint8_t dis_state)
 H-Bridge 14 control disable function.
 
err_t hbridge14_sleep_state (hbridge14_t *ctx, uint8_t sleep_state)
 H-Bridge 14 control sleep function.
 
err_t hbridge14_drive_motor (hbridge14_t *ctx, uint8_t state)
 H-Bridge 14 drive motor function.
 

Detailed Description

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

◆ hbridge14_cfg_setup()

void hbridge14_cfg_setup ( hbridge14_cfg_t * cfg)

H-Bridge 14 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge14_default_cfg()

err_t hbridge14_default_cfg ( hbridge14_t * ctx)

H-Bridge 14 default configuration function.

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

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

◆ hbridge14_disable_state()

err_t hbridge14_disable_state ( hbridge14_t * ctx,
uint8_t dis_state )

H-Bridge 14 control disable function.

This function sets the state of the DIS pin, enabling or disabling outputs.

Parameters
[in]ctx: Click context object. See hbridge14_t object definition for detailed explanation.
[in]dis_state: State of the DIS pin.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge14_drive_motor()

err_t hbridge14_drive_motor ( hbridge14_t * ctx,
uint8_t state )

H-Bridge 14 drive motor function.

This function sets motor driver into the selected state.

Parameters
[in]ctx: Click context object. See hbridge14_t object definition for detailed explanation.
[in]state: State of the driver.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge14_generic_read()

err_t hbridge14_generic_read ( hbridge14_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

H-Bridge 14 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

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

◆ hbridge14_generic_write()

err_t hbridge14_generic_write ( hbridge14_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

H-Bridge 14 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

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

◆ hbridge14_get_int_pin()

uint8_t hbridge14_get_int_pin ( hbridge14_t * ctx)

H-Bridge 14 get INT pin function.

This function is used to get state of the INT pin.

Parameters
[in]ctx: Click context object. See hbridge14_t object definition for detailed explanation.
Returns
State of the INT pin.
Note
None.

◆ hbridge14_get_ip_pin()

uint8_t hbridge14_get_ip_pin ( hbridge14_t * ctx)

H-Bridge 14 get IP pin function.

This function is used to get state of the IP pin.

Parameters
[in]ctx: Click context object. See hbridge14_t object definition for detailed explanation.
Returns
State of the IP pin.
Note
None.

◆ hbridge14_init()

err_t hbridge14_init ( hbridge14_t * ctx,
hbridge14_cfg_t * cfg )

H-Bridge 14 initialization function.

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

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

◆ hbridge14_port_expander_read()

err_t hbridge14_port_expander_read ( hbridge14_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 14 port ecpander read register function.

This function reads a data byte from the selected register of the port expander.

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

◆ hbridge14_port_expander_write()

err_t hbridge14_port_expander_write ( hbridge14_t * ctx,
uint8_t reg,
uint8_t data_in )

H-Bridge 14 port ecpander write register function.

This function writes a data byte into the selected register of the port expander.

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

◆ hbridge14_register_read()

err_t hbridge14_register_read ( hbridge14_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 14 data register reading function.

This function reads a data byte from the selected register by using SPI serial interface.

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

◆ hbridge14_register_write()

err_t hbridge14_register_write ( hbridge14_t * ctx,
uint8_t reg,
uint8_t data_in )

H-Bridge 14 data register writing function.

This function writes a data byte into the selected register by using SPI serial interface.

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

◆ hbridge14_set_in1_pin()

void hbridge14_set_in1_pin ( hbridge14_t * ctx,
uint8_t pin_state )

H-Bridge 14 set IN1 pin function.

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

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

◆ hbridge14_set_pins()

err_t hbridge14_set_pins ( hbridge14_t * ctx,
uint8_t set_mask,
uint8_t clr_mask )

H-Bridge 14 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 hbridge14_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.

◆ hbridge14_set_rst_pin()

void hbridge14_set_rst_pin ( hbridge14_t * ctx,
uint8_t pin_state )

H-Bridge 14 set RST pin function.

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

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

◆ hbridge14_sleep_state()

err_t hbridge14_sleep_state ( hbridge14_t * ctx,
uint8_t sleep_state )

H-Bridge 14 control sleep function.

This function sets the state of the SLP pin, enabling or disabling sleep mode.

Parameters
[in]ctx: Click context object. See hbridge14_t object definition for detailed explanation.
[in]sleep_state: State of the SLP pin.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.