hbridgedriver2 2.0.0.0
H-Bridge Driver 2 Click Driver

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

Topics

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

Functions

void hbridgedriver2_cfg_setup (hbridgedriver2_cfg_t *cfg)
 H-Bridge Driver 2 configuration object setup function.
 
err_t hbridgedriver2_init (hbridgedriver2_t *ctx, hbridgedriver2_cfg_t *cfg)
 H-Bridge Driver 2 initialization function.
 
err_t hbridgedriver2_default_cfg (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 default configuration function.
 
err_t hbridgedriver2_enable (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 enable function.
 
err_t hbridgedriver2_disable (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 disable function.
 
err_t hbridgedriver2_write_reg (hbridgedriver2_t *ctx, uint8_t reg, uint8_t *global_fault, uint16_t data_in)
 H-Bridge Driver 2 data writing function.
 
err_t hbridgedriver2_read_reg (hbridgedriver2_t *ctx, uint8_t reg, uint8_t *global_fault, uint16_t *data_out)
 H-Bridge Driver 2 data reading function.
 
err_t hbridgedriver2_read_clear_reg (hbridgedriver2_t *ctx, uint8_t reg, uint8_t *global_fault, uint16_t *data_out)
 H-Bridge Driver 2 data read and clear function.
 
err_t hbridgedriver2_read_id (hbridgedriver2_t *ctx, uint8_t reg, uint8_t *global_fault, uint16_t *data_out)
 H-Bridge Driver 2 data read ID function.
 
err_t hbridgedriver2_set_active_mode (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 set active mode function.
 
err_t hbridgedriver2_get_status (hbridgedriver2_t *ctx, uint16_t *status)
 H-Bridge Driver 2 get status function.
 
err_t hbridgedriver2_get_control (hbridgedriver2_t *ctx, uint16_t *control)
 H-Bridge Driver 2 get control function.
 
err_t hbridgedriver2_set_control (hbridgedriver2_t *ctx, uint8_t *global_fault, uint16_t control)
 H-Bridge Driver 2 set control function.
 
err_t hbridgedriver2_get_config (hbridgedriver2_t *ctx, uint16_t *config)
 H-Bridge Driver 2 get config function.
 
err_t hbridgedriver2_set_config (hbridgedriver2_t *ctx, uint8_t *global_fault, uint16_t config)
 H-Bridge Driver 2 set config function.
 
err_t hbridgedriver2_get_device_id (hbridgedriver2_t *ctx, uint8_t *global_fault, hbridgedriver2_dev_id_t *dev_id)
 H-Bridge Driver 2 get device ID function.
 
err_t hbridgedriver2_control (hbridgedriver2_t *ctx, uint8_t *global_fault, hbridgedriver2_ctrl_t dev_ctrl)
 H-Bridge Driver 2 control function.
 
err_t hbridgedriver2_run_backward (hbridgedriver2_t *ctx, uint8_t *global_fault)
 H-Bridge Driver 2 run backward function.
 
err_t hbridgedriver2_run_forward (hbridgedriver2_t *ctx, uint8_t *global_fault)
 H-Bridge Driver 2 run forward function.
 
err_t hbridgedriver2_stop (hbridgedriver2_t *ctx, uint8_t *global_fault)
 H-Bridge Driver 2 stop function.
 
err_t hbridgedriver2_stop_with_brake (hbridgedriver2_t *ctx, uint8_t *global_fault)
 H-Bridge Driver 2 stop with brake function.
 
err_t hbridgedriver2_set_duty_cycle (hbridgedriver2_t *ctx, float duty_cycle)
 H-Bridge Driver 2 sets PWM duty cycle.
 
err_t hbridgedriver2_pwm_stop (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 stop PWM module.
 
err_t hbridgedriver2_pwm_start (hbridgedriver2_t *ctx)
 H-Bridge Driver 2 start PWM module.
 

Detailed Description

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

◆ hbridgedriver2_cfg_setup()

void hbridgedriver2_cfg_setup ( hbridgedriver2_cfg_t * cfg)

H-Bridge Driver 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ hbridgedriver2_control()

err_t hbridgedriver2_control ( hbridgedriver2_t * ctx,
uint8_t * global_fault,
hbridgedriver2_ctrl_t dev_ctrl )

H-Bridge Driver 2 control function.

This function configuration control of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
[in]dev_ctrl: Device configuration control data structure.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_default_cfg()

err_t hbridgedriver2_default_cfg ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 default configuration function.

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

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

◆ hbridgedriver2_disable()

err_t hbridgedriver2_disable ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 disable function.

This function sets enable signal to turn off the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_enable()

err_t hbridgedriver2_enable ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 enable function.

This function sets enable signal to turn on the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_get_config()

err_t hbridgedriver2_get_config ( hbridgedriver2_t * ctx,
uint16_t * config )

H-Bridge Driver 2 get config function.

This function reads configuration data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_get_control()

err_t hbridgedriver2_get_control ( hbridgedriver2_t * ctx,
uint16_t * control )

H-Bridge Driver 2 get control function.

This function reads control data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_get_device_id()

err_t hbridgedriver2_get_device_id ( hbridgedriver2_t * ctx,
uint8_t * global_fault,
hbridgedriver2_dev_id_t * dev_id )

H-Bridge Driver 2 get device ID function.

This function reads device ID data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
[in]dev_id: Device ID data structure.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_get_status()

err_t hbridgedriver2_get_status ( hbridgedriver2_t * ctx,
uint16_t * status )

H-Bridge Driver 2 get status function.

This function reads status data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_init()

err_t hbridgedriver2_init ( hbridgedriver2_t * ctx,
hbridgedriver2_cfg_t * cfg )

H-Bridge Driver 2 initialization function.

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

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

◆ hbridgedriver2_pwm_start()

err_t hbridgedriver2_pwm_start ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 start PWM module.

This function starts the PWM module output.

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

◆ hbridgedriver2_pwm_stop()

err_t hbridgedriver2_pwm_stop ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 stop PWM module.

This function stops the PWM module output.

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

◆ hbridgedriver2_read_clear_reg()

err_t hbridgedriver2_read_clear_reg ( hbridgedriver2_t * ctx,
uint8_t reg,
uint8_t * global_fault,
uint16_t * data_out )

H-Bridge Driver 2 data read and clear function.

This function read and clear 16-bit of data from the status register by using SPI serial interface.

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

◆ hbridgedriver2_read_id()

err_t hbridgedriver2_read_id ( hbridgedriver2_t * ctx,
uint8_t reg,
uint8_t * global_fault,
uint16_t * data_out )

H-Bridge Driver 2 data read ID function.

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

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

◆ hbridgedriver2_read_reg()

err_t hbridgedriver2_read_reg ( hbridgedriver2_t * ctx,
uint8_t reg,
uint8_t * global_fault,
uint16_t * data_out )

H-Bridge Driver 2 data reading function.

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

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

◆ hbridgedriver2_run_backward()

err_t hbridgedriver2_run_backward ( hbridgedriver2_t * ctx,
uint8_t * global_fault )

H-Bridge Driver 2 run backward function.

This function performs motor start run backward of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_run_forward()

err_t hbridgedriver2_run_forward ( hbridgedriver2_t * ctx,
uint8_t * global_fault )

H-Bridge Driver 2 run forward function.

This function performs motor start run forward of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_set_active_mode()

err_t hbridgedriver2_set_active_mode ( hbridgedriver2_t * ctx)

H-Bridge Driver 2 set active mode function.

This function set active mode of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

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

◆ hbridgedriver2_set_config()

err_t hbridgedriver2_set_config ( hbridgedriver2_t * ctx,
uint8_t * global_fault,
uint16_t config )

H-Bridge Driver 2 set config function.

This function sets configuration data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
[in]config: Configuration data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_set_control()

err_t hbridgedriver2_set_control ( hbridgedriver2_t * ctx,
uint8_t * global_fault,
uint16_t control )

H-Bridge Driver 2 set control function.

This function sets control data of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
[in]control: Control data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_set_duty_cycle()

err_t hbridgedriver2_set_duty_cycle ( hbridgedriver2_t * ctx,
float duty_cycle )

H-Bridge Driver 2 sets PWM duty cycle.

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

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

◆ hbridgedriver2_stop()

err_t hbridgedriver2_stop ( hbridgedriver2_t * ctx,
uint8_t * global_fault )

H-Bridge Driver 2 stop function.

This function performs motor stop of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_stop_with_brake()

err_t hbridgedriver2_stop_with_brake ( hbridgedriver2_t * ctx,
uint8_t * global_fault )

H-Bridge Driver 2 stop with brake function.

This function performs motor stop with brake of the NCV7535 SPI Controlled H-bridge and Dual-Half Bridge Pre-Driver on the H-Bridge Driver 2 click board™.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]global_fault: Global status byte content.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ hbridgedriver2_write_reg()

err_t hbridgedriver2_write_reg ( hbridgedriver2_t * ctx,
uint8_t reg,
uint8_t * global_fault,
uint16_t data_in )

H-Bridge Driver 2 data writing function.

This function writes a 16-bit of data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See hbridgedriver2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]global_fault: Global status byte content.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.