hbridge11 2.1.0.0
H-Bridge 11 Click Driver

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

Topics

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

Functions

void hbridge11_cfg_setup (hbridge11_cfg_t *cfg)
 H-Bridge 11 configuration object setup function.
 
err_t hbridge11_init (hbridge11_t *ctx, hbridge11_cfg_t *cfg)
 H-Bridge 11 initialization function.
 
err_t hbridge11_default_cfg (hbridge11_t *ctx)
 H-Bridge 11 default configuration function.
 
err_t hbridge11_write_8bit_register (hbridge11_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 11 write 8bit register function.
 
err_t hbridge11_read_8bit_register (hbridge11_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 11 read 8bit register function.
 
err_t hbridge11_write_32bit_register (hbridge11_t *ctx, uint8_t reg, uint32_t data_in)
 H-Bridge 11 write 32bit register function.
 
err_t hbridge11_read_32bit_register (hbridge11_t *ctx, uint8_t reg, uint32_t *data_out)
 H-Bridge 11 read 32bit register function.
 
void hbridge11_enable_device (hbridge11_t *ctx)
 H-Bridge 11 enable device function.
 
void hbridge11_disable_device (hbridge11_t *ctx)
 H-Bridge 11 disable device function.
 
uint8_t hbridge11_get_fault_pin (hbridge11_t *ctx)
 H-Bridge 11 get fault pin function.
 
err_t hbridge11_read_flags (hbridge11_t *ctx, uint8_t *fault_flags)
 H-Bridge 11 read flags function.
 
err_t hbridge11_set_motor_state (hbridge11_t *ctx, uint8_t motor, uint8_t state)
 H-Bridge 11 set motor state function.
 

Detailed Description

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

◆ hbridge11_cfg_setup()

void hbridge11_cfg_setup ( hbridge11_cfg_t * cfg)

H-Bridge 11 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge11_default_cfg()

err_t hbridge11_default_cfg ( hbridge11_t * ctx)

H-Bridge 11 default configuration function.

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

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

◆ hbridge11_disable_device()

void hbridge11_disable_device ( hbridge11_t * ctx)

H-Bridge 11 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ hbridge11_enable_device()

void hbridge11_enable_device ( hbridge11_t * ctx)

H-Bridge 11 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ hbridge11_get_fault_pin()

uint8_t hbridge11_get_fault_pin ( hbridge11_t * ctx)

H-Bridge 11 get fault pin function.

This function returns the fault pin logic state.

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

◆ hbridge11_init()

err_t hbridge11_init ( hbridge11_t * ctx,
hbridge11_cfg_t * cfg )

H-Bridge 11 initialization function.

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

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

◆ hbridge11_read_32bit_register()

err_t hbridge11_read_32bit_register ( hbridge11_t * ctx,
uint8_t reg,
uint32_t * data_out )

H-Bridge 11 read 32bit register function.

This function reads 32-bit data from the selected register by using SPI serial interface.

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

◆ hbridge11_read_8bit_register()

err_t hbridge11_read_8bit_register ( hbridge11_t * ctx,
uint8_t reg,
uint8_t * data_out )

H-Bridge 11 read 8bit register function.

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

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

◆ hbridge11_read_flags()

err_t hbridge11_read_flags ( hbridge11_t * ctx,
uint8_t * fault_flags )

H-Bridge 11 read flags function.

This function reads and clears the fault flags from the status register.

Parameters
[in]ctx: Click context object. See hbridge11_t object definition for detailed explanation.
[out]fault_flags: Fault flags from the status register [bits 7-0].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge11_set_motor_state()

err_t hbridge11_set_motor_state ( hbridge11_t * ctx,
uint8_t motor,
uint8_t state )

H-Bridge 11 set motor state function.

This function sets the operating state for the selected motor from the half-bridge pairs 0–1, 2–3, 4–5, or 6–7.

Parameters
[in]ctx: Click context object. See hbridge11_t object definition for detailed explanation.
[in]motor: Motor selection [0-3] related to the half-bridge pairs 0–1, 2–3, 4–5, and 6–7.
[in]state:
  • 0 - High-Z,
  • 1 - Forward,
  • 2 - Reverse,
  • 3 - Brake.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ hbridge11_write_32bit_register()

err_t hbridge11_write_32bit_register ( hbridge11_t * ctx,
uint8_t reg,
uint32_t data_in )

H-Bridge 11 write 32bit register function.

This function writes 32-bit data to the selected register by using SPI serial interface.

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

◆ hbridge11_write_8bit_register()

err_t hbridge11_write_8bit_register ( hbridge11_t * ctx,
uint8_t reg,
uint8_t data_in )

H-Bridge 11 write 8bit register function.

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

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