hbridge9 2.0.0.0
H-Bridge 9 Click Driver

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

Topics

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

Functions

void hbridge9_cfg_setup (hbridge9_cfg_t *cfg)
 H-Bridge 9 configuration object setup function.
 
err_t hbridge9_init (hbridge9_t *ctx, hbridge9_cfg_t *cfg)
 H-Bridge 9 initialization function.
 
err_t hbridge9_default_cfg (hbridge9_t *ctx)
 H-Bridge 9 default configuration function.
 
err_t hbridge9_spi_transfer (hbridge9_t *ctx, uint8_t *data_in, uint8_t tx_len, uint8_t *data_out, uint8_t rx_len)
 H-Bridge 9 spi transfer function.
 
err_t hbridge9_write_register (hbridge9_t *ctx, uint8_t reg, uint16_t data_in)
 H-Bridge 9 write register function.
 
err_t hbridge9_read_register (hbridge9_t *ctx, uint8_t reg, uint16_t *data_out)
 H-Bridge 9 read register function.
 
err_t hbridge9_modify_register_bits (hbridge9_t *ctx, uint8_t reg, uint16_t clr_mask, uint16_t set_mask)
 H-Bridge 9 modify register bits function.
 
err_t hbridge9_read_register_and_clear (hbridge9_t *ctx, uint8_t reg, uint16_t *data_out)
 H-Bridge 9 read register and clear function.
 
err_t hbridge9_read_info_register (hbridge9_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 9 read info register function.
 
err_t hbridge9_set_default (hbridge9_t *ctx)
 H-Bridge 9 set default function.
 
err_t hbridge9_clear_all_status (hbridge9_t *ctx)
 H-Bridge 9 clear all status function.
 
err_t hbridge9_check_communication (hbridge9_t *ctx)
 H-Bridge 9 check communication function.
 
void hbridge9_set_en_out_pin (hbridge9_t *ctx, uint8_t state)
 H-Bridge 9 set en out pin function.
 
void hbridge9_send_actuation_pulse (hbridge9_t *ctx)
 H-Bridge 9 send actuation pulse function.
 
uint8_t hbridge9_get_dout_pin (hbridge9_t *ctx)
 H-Bridge 9 get dout pin function.
 

Detailed Description

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

◆ hbridge9_cfg_setup()

void hbridge9_cfg_setup ( hbridge9_cfg_t * cfg)

H-Bridge 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge9_check_communication()

err_t hbridge9_check_communication ( hbridge9_t * ctx)

H-Bridge 9 check communication function.

This function checks the communication by reading and verifying the SPI CPHA Test register.

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

◆ hbridge9_clear_all_status()

err_t hbridge9_clear_all_status ( hbridge9_t * ctx)

H-Bridge 9 clear all status function.

This function sends the clear all status registers command.

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

◆ hbridge9_default_cfg()

err_t hbridge9_default_cfg ( hbridge9_t * ctx)

H-Bridge 9 default configuration function.

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

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

◆ hbridge9_get_dout_pin()

uint8_t hbridge9_get_dout_pin ( hbridge9_t * ctx)

H-Bridge 9 get dout pin function.

This function returns the DO pin logic state.

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

◆ hbridge9_init()

err_t hbridge9_init ( hbridge9_t * ctx,
hbridge9_cfg_t * cfg )

H-Bridge 9 initialization function.

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

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

◆ hbridge9_modify_register_bits()

err_t hbridge9_modify_register_bits ( hbridge9_t * ctx,
uint8_t reg,
uint16_t clr_mask,
uint16_t set_mask )

H-Bridge 9 modify register bits function.

This function modifies the specified register bits.

Parameters
[in]ctx: Click context object. See hbridge9_t object definition for detailed explanation.
[in]reg: Register address.
[in]clr_mask: Clear bit mask.
[in]set_mask: Set bit mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge9_read_info_register()

err_t hbridge9_read_info_register ( hbridge9_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 9 read info register function.

This function reads the selected info register.

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

◆ hbridge9_read_register()

err_t hbridge9_read_register ( hbridge9_t * ctx,
uint8_t reg,
uint16_t * data_out )

H-Bridge 9 read register function.

This function reads a desired data from the selected register.

Parameters
[in]ctx: Click context object. See hbridge9_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Read data ( with parity bit ).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge9_read_register_and_clear()

err_t hbridge9_read_register_and_clear ( hbridge9_t * ctx,
uint8_t reg,
uint16_t * data_out )

H-Bridge 9 read register and clear function.

This function reads the selected register and clears its status if needed.

Parameters
[in]ctx: Click context object. See hbridge9_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Read data ( with parity bit ).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge9_send_actuation_pulse()

void hbridge9_send_actuation_pulse ( hbridge9_t * ctx)

H-Bridge 9 send actuation pulse function.

This function sends an actuation pulse by toggling the ENO pin.

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

◆ hbridge9_set_default()

err_t hbridge9_set_default ( hbridge9_t * ctx)

H-Bridge 9 set default function.

This function sends the set all register to default state command.

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

◆ hbridge9_set_en_out_pin()

void hbridge9_set_en_out_pin ( hbridge9_t * ctx,
uint8_t state )

H-Bridge 9 set en out pin function.

This function sets the ENO pin logic state.

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

◆ hbridge9_spi_transfer()

err_t hbridge9_spi_transfer ( hbridge9_t * ctx,
uint8_t * data_in,
uint8_t tx_len,
uint8_t * data_out,
uint8_t rx_len )

H-Bridge 9 spi transfer function.

This function writes and reads a desired number of data bytes simultaneously by using SPI serial interface.

Parameters
[in]ctx: Click context object. See hbridge9_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]tx_len: Number of bytes to be written.
[out]data_out: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge9_write_register()

err_t hbridge9_write_register ( hbridge9_t * ctx,
uint8_t reg,
uint16_t data_in )

H-Bridge 9 write register function.

This function writes a desired data to the selected register.

Parameters
[in]ctx: Click context object. See hbridge9_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written ( without parity bit ).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.