hbridge6 2.0.0.0
H-Bridge 6 Click Driver

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

Topics

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

Functions

void hbridge6_cfg_setup (hbridge6_cfg_t *cfg)
 H-Bridge 6 configuration object setup function.
 
err_t hbridge6_init (hbridge6_t *ctx, hbridge6_cfg_t *cfg)
 H-Bridge 6 initialization function.
 
void hbridge6_generic_write (hbridge6_t *ctx, uint8_t reg, uint8_t tx_buf)
 H-Bridge 6 I2C writing function.
 
uint8_t hbridge6_generic_read (hbridge6_t *ctx, uint8_t reg)
 H-Bridge 6 I2C reading function.
 
err_t hbridge6_default_cfg (hbridge6_t *ctx)
 H-Bridge 6 default configuration function.
 
err_t hbridge6_set_duty_cycle (hbridge6_t *ctx, float duty_cycle)
 H-Bridge 6 sets PWM duty cycle.
 
err_t hbridge6_pwm_stop (hbridge6_t *ctx)
 H-Bridge 6 stop PWM module.
 
err_t hbridge6_pwm_start (hbridge6_t *ctx)
 H-Bridge 6 start PWM module.
 
void hbridge6_reset (hbridge6_t *ctx)
 HW reset function.
 
void hbridge6_set_output (hbridge6_t *ctx, uint8_t n_out_port, hbridge6_cfg_t cfg_data)
 Set output function.
 
void hbridge6_get_output (hbridge6_t *ctx, uint8_t n_out_port, hbridge6_cfg_t *cfg_data)
 Get output function.
 
void hbridge6_default_config (hbridge6_t *ctx)
 Default config function.
 
void hbridge6_set_input_port_a (hbridge6_t *ctx, uint8_t pin_state)
 Set input port A function.
 
void hbridge6_set_input_port_b (hbridge6_t *ctx, uint8_t pin_state)
 Set input port B function.
 
void hbridge6_enable_diagnostic (hbridge6_t *ctx, uint8_t en_state)
 Enable the diagnostic function.
 
void hbridge6_set_multi_sense (hbridge6_t *ctx, uint8_t sel_num, uint8_t pin_state)
 Set multi sense function.
 
void hbridge6_set_direction (hbridge6_t *ctx, uint8_t direction)
 Adjust the direction function.
 
uint8_t hbridge6_get_an_diagnostic (hbridge6_t *ctx)
 Get diagnostic function.
 

Detailed Description

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

◆ hbridge6_cfg_setup()

void hbridge6_cfg_setup ( hbridge6_cfg_t * cfg)

H-Bridge 6 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridge6_default_cfg()

err_t hbridge6_default_cfg ( hbridge6_t * ctx)

H-Bridge 6 default configuration function.

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

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

◆ hbridge6_default_config()

void hbridge6_default_config ( hbridge6_t * ctx)

Default config function.

The function set the default config of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
Returns
Nothing.

◆ hbridge6_enable_diagnostic()

void hbridge6_enable_diagnostic ( hbridge6_t * ctx,
uint8_t en_state )

Enable the diagnostic function.

The function enable or disable the diagnostic of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]en_state: The function for enabling diagnostic.
Returns
Nothing.

◆ hbridge6_generic_read()

uint8_t hbridge6_generic_read ( hbridge6_t * ctx,
uint8_t reg )

H-Bridge 6 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 hbridge6_t object definition for detailed explanation.
[in]reg: Start register address.
Returns
8-bit read data.

◆ hbridge6_generic_write()

void hbridge6_generic_write ( hbridge6_t * ctx,
uint8_t reg,
uint8_t tx_buf )

H-Bridge 6 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 hbridge6_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
Returns
Nothing.

◆ hbridge6_get_an_diagnostic()

uint8_t hbridge6_get_an_diagnostic ( hbridge6_t * ctx)

Get diagnostic function.

The function get the diagnostic on H-Bridge 6 Click board.

Parameters
[in]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
Returns
State of AN pin.

◆ hbridge6_get_output()

void hbridge6_get_output ( hbridge6_t * ctx,
uint8_t n_out_port,
hbridge6_cfg_t * cfg_data )

Get output function.

The function get output configuration data of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]n_out_port: Port number.
[in]cfg_data: Pointer to the memory location where configuration data be stored.
Returns
Nothing.

◆ hbridge6_init()

err_t hbridge6_init ( hbridge6_t * ctx,
hbridge6_cfg_t * cfg )

H-Bridge 6 initialization function.

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

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

◆ hbridge6_pwm_start()

err_t hbridge6_pwm_start ( hbridge6_t * ctx)

H-Bridge 6 start PWM module.

This function starts the PWM moudle output.

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

◆ hbridge6_pwm_stop()

err_t hbridge6_pwm_stop ( hbridge6_t * ctx)

H-Bridge 6 stop PWM module.

This function stops the PWM moudle output.

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

◆ hbridge6_reset()

void hbridge6_reset ( hbridge6_t * ctx)

HW reset function.

The function HW reset, reset the PCA9538A Low-voltage 8-bit I2C-bus I/O port on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
Returns
Nothing.

◆ hbridge6_set_direction()

void hbridge6_set_direction ( hbridge6_t * ctx,
uint8_t direction )

Adjust the direction function.

The function adjust the engine direction on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]direction: Direction of rotation:
Returns
Nothing.

◆ hbridge6_set_duty_cycle()

err_t hbridge6_set_duty_cycle ( hbridge6_t * ctx,
float duty_cycle )

H-Bridge 6 sets PWM duty cycle.

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

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]duty_cycle: PWM duty_ratio.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ hbridge6_set_input_port_a()

void hbridge6_set_input_port_a ( hbridge6_t * ctx,
uint8_t pin_state )

Set input port A function.

The function set input port A of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]pin_state: Input port A state.
Returns
Nothing.

◆ hbridge6_set_input_port_b()

void hbridge6_set_input_port_b ( hbridge6_t * ctx,
uint8_t pin_state )

Set input port B function.

The function set input port B of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]pin_state: Input port B state.
Returns
Nothing.

◆ hbridge6_set_multi_sense()

void hbridge6_set_multi_sense ( hbridge6_t * ctx,
uint8_t sel_num,
uint8_t pin_state )

Set multi sense function.

The function set multi sense of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[in]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]sel_num: Port number.
[in]pin_state: Port pin state.
Returns
Nothing.

◆ hbridge6_set_output()

void hbridge6_set_output ( hbridge6_t * ctx,
uint8_t n_out_port,
hbridge6_cfg_t cfg_data )

Set output function.

The function set output of the desired port of the PCA9538A Low-voltage 8-bit I2C-bus I/O port with interrupt and reset on H-Bridge 6 Click board.

Parameters
[out]ctx: Click context object. See hbridge6_t object definition for detailed explanation.
[in]n_out_port: Port number.
[in]cfg_data: Structure where configuration data be stored.
Returns
Nothing.