hbridge6 2.0.0.0
hbridge6.h File Reference

This file contains API for H-Bridge 6 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_pwm.h"

Go to the source code of this file.

Data Structures

struct  hbridge6_t
 H-Bridge 6 Click context object. More...
 
struct  hbridge6_cfg_t
 H-Bridge 6 Click configuration object. More...
 

Macros

#define HBRIDGE6_REG_IN_PORT   0x00
 H-Bridge 6 description setting.
 
#define HBRIDGE6_REG_OUT_PORT   0x01
 
#define HBRIDGE6_REG_POL_INV   0x02
 
#define HBRIDGE6_REG_CONFIG   0x03
 
#define HBRIDGE6_PIN_STATE_LOW   0x00
 H-Bridge 6 Pin states.
 
#define HBRIDGE6_PIN_STATE_HIGH   0x01
 
#define HBRIDGE6_IN_PORT_MULTI_SENSE_LOW   0xFB
 
#define HBRIDGE6_IN_PORT_MULTI_SENSE_HIGH   0x04
 
#define HBRIDGE6_IN_PORT_IN_LOW   0xFE
 
#define HBRIDGE6_IN_PORT_IN_HIGH   0x01
 
#define HBRIDGE6_MS_EN_LOW   0xFD
 
#define HBRIDGE6_MS_EN_HIGH   0x02
 
#define HBRIDGE6_DIAGNOSTIC_DISABLE   0x00
 
#define HBRIDGE6_DIAGNOSTIC_ENABLE   0x01
 
#define HBRIDGE6_DEFAULT_CFG   0xE0
 
#define HBRIDGE6_IN_PORT_SEL_BIT_MASK   0x01
 
#define HBRIDGE6_IN_PORT_SEL_0   0x00
 
#define HBRIDGE6_IN_PORT_SEL_1   0x01
 
#define HBRIDGE6_NUMBER_OF_PORTS   0x07
 
#define HBRIDGE6_DIRECTION_BRAKE   0x00
 H-Bridge 6 Direction.
 
#define HBRIDGE6_DIRECTION_CLOCKWISE   0x01
 
#define HBRIDGE6_DIRECTION_COUNTERCLOCKWISE   0x02
 
#define HBRIDGE6_I2C_SLAVE_ADR_0   0x70
 H-Bridge 6 device address setting.
 
#define HBRIDGE6_I2C_SLAVE_ADR_1   0x71
 
#define HBRIDGE6_I2C_SLAVE_ADR_2   0x72
 
#define HBRIDGE6_I2C_SLAVE_ADR_3   0x73
 
#define HBRIDGE6_DEF_FREQ   5000
 H-Bridge 6 default PWM frequency.
 
#define HBRIDGE6_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  hbridge6_return_value_t { HBRIDGE6_OK = 0 , HBRIDGE6_ERROR = -1 }
 H-Bridge 6 Click return value data. More...
 

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

This file contains API for H-Bridge 6 Click Driver.

Enumeration Type Documentation

◆ hbridge6_return_value_t

H-Bridge 6 Click return value data.

Predefined enum values for driver return values.

Enumerator
HBRIDGE6_OK 
HBRIDGE6_ERROR