hbridge14 2.1.0.0
hbridge14.h File Reference

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

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  hbridge14_s
 H-Bridge 14 Click context object. More...
 
struct  hbridge14_cfg_t
 H-Bridge 14 Click configuration object. More...
 

Macros

#define HBRIDGE14_REG_FAULT_STATUS   0x00
 H-Bridge 14 description register.
 
#define HBRIDGE14_REG_DIAG_STATUS   0x02
 
#define HBRIDGE14_REG_IC1_CTRL   0x04
 
#define HBRIDGE14_REG_IC2_CTRL   0x06
 
#define HBRIDGE14_REG_IC3_CTRL   0x08
 
#define HBRIDGE14_REG_IC4_CTRL   0x0A
 
#define HBRIDGE14_REG_INPUT_PORT   0x00
 
#define HBRIDGE14_REG_OUTPUT_PORT   0x01
 
#define HBRIDGE14_REG_POLARITY_INV   0x02
 
#define HBRIDGE14_REG_CONFIG   0x03
 
#define HBRIDGE14_DIS_ON   0x01
 H-Bridge 14 DRVOFF pin setting.
 
#define HBRIDGE14_DIS_OFF   0x00
 
#define HBRIDGE14_SLEEP_ON   0x01
 H-Bridge 14 SLEEP pin setting.
 
#define HBRIDGE14_SLEEP_OFF   0x00
 
#define HBRIDGE14_PIN_STATE_HIGH   0x01
 H-Bridge 14 pin setting.
 
#define HBRIDGE14_PIN_STATE_LOW   0x00
 
#define HBRIDGE14_DRIVE_MOTOR_CW   0x00
 H-Bridge 14 motor states setting.
 
#define HBRIDGE14_DRIVE_MOTOR_CCW   0x01
 
#define HBRIDGE14_DRIVE_MOTOR_BRAKE   0x02
 
#define HBRIDGE14_DRIVE_MOTOR_COASTING   0x03
 
#define HBRIDGE14_NONE_PIN   0x00
 H-Bridge 14 pin mask setting.
 
#define HBRIDGE14_SLP_PIN   0x01
 
#define HBRIDGE14_FLT_PIN   0x02
 
#define HBRIDGE14_DIS_PIN   0x04
 
#define HBRIDGE14_ALL_PIN   0x07
 
#define HBRIDGE14_TOF_80_US   0xC0
 H-Bridge 14 IC1 Control Register setting.
 
#define HBRIDGE14_TOF_60_US   0x80
 
#define HBRIDGE14_TOF_40_US   0x40
 
#define HBRIDGE14_TOF_20_US   0x00
 
#define HBRIDGE14_SPI_IN_EN   0x20
 
#define HBRIDGE14_SPI_IN_DIS   0x00
 
#define HBRIDGE14_S_SR_2_6V_US   0x1C
 
#define HBRIDGE14_S_SR_5_3V_US   0x18
 
#define HBRIDGE14_S_SR_7_9V_US   0x14
 
#define HBRIDGE14_S_SR_10_8V_US   0x10
 
#define HBRIDGE14_S_SR_13_V_US   0x0C
 
#define HBRIDGE14_S_SR_18_3V_US   0x08
 
#define HBRIDGE14_S_SR_34_V_US   0x04
 
#define HBRIDGE14_S_SR_53_2V_US   0x00
 
#define HBRIDGE14_MODE_DISABLED   0x03
 
#define HBRIDGE14_MODE_INDEPENDENT   0x02
 
#define HBRIDGE14_MODE_PWM   0x01
 
#define HBRIDGE14_MODE_PH_EN   0x00
 
#define HBRIDGE14_ITRIP_REP   0x80
 H-Bridge 14 IC2 Control Register setting.
 
#define HBRIDGE14_TSD_MODE_AUTO   0x40
 
#define HBRIDGE14_OTW_REP   0x20
 
#define HBRIDGE14_DIS_CPUV   0x10
 
#define HBRIDGE14_OCP_TRETRY_4_MS   0x0C
 
#define HBRIDGE14_OCP_TRETRY_2_MS   0x08
 
#define HBRIDGE14_OCP_TRETRY_1_MS   0x04
 
#define HBRIDGE14_OCP_TRETRY_500_NS   0x00
 
#define HBRIDGE14_OCP_MODE_NOT_REPORT   0x03
 
#define HBRIDGE14_OCP_MODE_REPORT   0x02
 
#define HBRIDGE14_OCP_MODE_RETRING   0x01
 
#define HBRIDGE14_OCP_MODE_LATCHED   0x00
 
#define HBRIDGE14_CLR_FLT   0x80
 H-Bridge 14 IC3 Control Register setting.
 
#define HBRIDGE14_LOCK_REG   0x30
 
#define HBRIDGE14_UNLOCK_REG   0x40
 
#define HBRIDGE14_OUT1_DIS   0x08
 
#define HBRIDGE14_OUT2_DIS   0x04
 
#define HBRIDGE14_EN_IN1   0x02
 
#define HBRIDGE14_PH_IN2   0x01
 
#define HBRIDGE14_EN_OLP   0x40
 H-Bridge 14 IC4 Control Register setting.
 
#define HBRIDGE14_OLP_DLY_300_US   0x00
 
#define HBRIDGE14_OLP_DLY_1_2_MS   0x20
 
#define HBRIDGE14_EN_OLA   0x10
 
#define HBRIDGE14_ITRIP_LVL_7_A   0x0C
 
#define HBRIDGE14_ITRIP_LVL_6_5_A   0x08
 
#define HBRIDGE14_ITRIP_LVL_5_4_A   0x04
 
#define HBRIDGE14_ITRIP_LVL_4_A   0x00
 
#define HBRIDGE14_DIS_ITRIP_OUT1_OUT2   0x03
 
#define HBRIDGE14_DIS_ITRIP_OUT2   0x02
 
#define HBRIDGE14_DIS_ITRIP_OUT1   0x01
 
#define HBRIDGE14_DIS_ITRIP   0x00
 
#define HBRIDGE14_DEVICE_ADDRESS_A1A0_00   0x70
 H-Bridge 14 device address setting.
 
#define HBRIDGE14_DEVICE_ADDRESS_A1A0_01   0x71
 
#define HBRIDGE14_DEVICE_ADDRESS_A1A0_10   0x72
 
#define HBRIDGE14_DEVICE_ADDRESS_A1A0_11   0x73
 
#define HBRIDGE14_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define HBRIDGE14_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define HBRIDGE14_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef struct hbridge14_s hbridge14_t
 H-Bridge 14 Click context object.
 

Enumerations

enum  hbridge14_return_value_t { HBRIDGE14_OK = 0 , HBRIDGE14_ERROR = -1 }
 H-Bridge 14 Click return value data. More...
 

Functions

void hbridge14_cfg_setup (hbridge14_cfg_t *cfg)
 H-Bridge 14 configuration object setup function.
 
err_t hbridge14_init (hbridge14_t *ctx, hbridge14_cfg_t *cfg)
 H-Bridge 14 initialization function.
 
err_t hbridge14_default_cfg (hbridge14_t *ctx)
 H-Bridge 14 default configuration function.
 
err_t hbridge14_generic_write (hbridge14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 14 data writing function.
 
err_t hbridge14_generic_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 14 data reading function.
 
void hbridge14_set_in1_pin (hbridge14_t *ctx, uint8_t pin_state)
 H-Bridge 14 set IN1 pin function.
 
void hbridge14_set_rst_pin (hbridge14_t *ctx, uint8_t pin_state)
 H-Bridge 14 set RST pin function.
 
uint8_t hbridge14_get_ip_pin (hbridge14_t *ctx)
 H-Bridge 14 get IP pin function.
 
uint8_t hbridge14_get_int_pin (hbridge14_t *ctx)
 H-Bridge 14 get INT pin function.
 
err_t hbridge14_register_write (hbridge14_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 14 data register writing function.
 
err_t hbridge14_register_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 14 data register reading function.
 
err_t hbridge14_port_expander_write (hbridge14_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 14 port ecpander write register function.
 
err_t hbridge14_port_expander_read (hbridge14_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 14 port ecpander read register function.
 
err_t hbridge14_set_pins (hbridge14_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 14 set pins function.
 
err_t hbridge14_disable_state (hbridge14_t *ctx, uint8_t dis_state)
 H-Bridge 14 control disable function.
 
err_t hbridge14_sleep_state (hbridge14_t *ctx, uint8_t sleep_state)
 H-Bridge 14 control sleep function.
 
err_t hbridge14_drive_motor (hbridge14_t *ctx, uint8_t state)
 H-Bridge 14 drive motor function.
 

Detailed Description

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

Typedef Documentation

◆ hbridge14_t

typedef struct hbridge14_s hbridge14_t

H-Bridge 14 Click context object.

Context object definition of H-Bridge 14 Click driver.

Enumeration Type Documentation

◆ hbridge14_return_value_t

H-Bridge 14 Click return value data.

Predefined enum values for driver return values.

Enumerator
HBRIDGE14_OK 
HBRIDGE14_ERROR