hbridge13 2.1.0.0
hbridge13.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  hbridge13_t
 H-Bridge 13 Click context object. More...
 
struct  hbridge13_cfg_t
 H-Bridge 13 Click configuration object. More...
 

Macros

#define HBRIDGE13_REG_INPUT_PORT   0x00
 H-Bridge 13 description register.
 
#define HBRIDGE13_REG_OUTPUT_PORT   0x01
 
#define HBRIDGE13_REG_POLARITY_INV   0x02
 
#define HBRIDGE13_REG_CONFIG   0x03
 
#define HBRIDGE13_NONE_PIN   0x00
 H-Bridge 13 description setting.
 
#define HBRIDGE13_AIN1_IO_PIN   0x01
 
#define HBRIDGE13_AIN2_IO_PIN   0x02
 
#define HBRIDGE13_PWM_SW1_PIN   0x04
 
#define HBRIDGE13_PWM_SW2_PIN   0x08
 
#define HBRIDGE13_BIN1_IO_PIN   0x10
 
#define HBRIDGE13_BIN2_IO_PIN   0x20
 
#define HBRIDGE13_AN_SW_PIN   0x40
 
#define HBRIDGE13_FLT_PIN   0x80
 
#define HBRIDGE13_ALL_PIN   0xFF
 
#define HBRIDGE13_DIR_FORWARD   0x01
 H-Bridge 13 direction setting.
 
#define HBRIDGE13_DIR_REVERSE   0x00
 
#define HBRIDGE13_AN_A_PIN_SEL   0x01
 H-Bridge 13 xIPROPI selection setting.
 
#define HBRIDGE13_AN_B_PIN_SEL   0x00
 
#define HBRIDGE13_DEVICE_ADDRESS_A1A0_00   0x70
 H-Bridge 13 device address setting.
 
#define HBRIDGE13_DEVICE_ADDRESS_A1A0_01   0x71
 
#define HBRIDGE13_DEVICE_ADDRESS_A1A0_10   0x72
 
#define HBRIDGE13_DEVICE_ADDRESS_A1A0_11   0x73
 
#define HBRIDGE13_ADC_RESOLUTION   0x0FFF
 H-Bridge 13 ADC setting.
 
#define HBRIDGE13_VREF_3V3   3.3
 
#define HBRIDGE13_VREF_5V   5.0
 
#define HBRIDGE13_DEF_FREQ   5000
 H-Bridge 13 default PWM frequency.
 
#define HBRIDGE13_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  hbridge13_return_value_t { HBRIDGE13_OK = 0 , HBRIDGE13_ERROR = -1 }
 H-Bridge 13 Click return value data. More...
 

Functions

void hbridge13_cfg_setup (hbridge13_cfg_t *cfg)
 H-Bridge 13 configuration object setup function.
 
err_t hbridge13_init (hbridge13_t *ctx, hbridge13_cfg_t *cfg)
 H-Bridge 13 initialization function.
 
err_t hbridge13_default_cfg (hbridge13_t *ctx)
 H-Bridge 13 default configuration function.
 
err_t hbridge13_generic_write (hbridge13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 13 I2C writing function.
 
err_t hbridge13_generic_read (hbridge13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 13 I2C reading function.
 
err_t hbridge13_write_reg (hbridge13_t *ctx, uint8_t reg, uint8_t data_out)
 H-Bridge 13 write register function.
 
err_t hbridge13_read_reg (hbridge13_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 13 read register function.
 
err_t hbridge13_set_pins (hbridge13_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 13 set output pin state function.
 
err_t hbridge13_set_duty_cycle (hbridge13_t *ctx, float duty_cycle)
 H-Bridge 13 sets PWM duty cycle.
 
err_t hbridge13_pwm_stop (hbridge13_t *ctx)
 H-Bridge 13 stop PWM module.
 
err_t hbridge13_pwm_start (hbridge13_t *ctx)
 H-Bridge 13 start PWM module.
 
err_t hbridge13_set_brake (hbridge13_t *ctx)
 H-Bridge 13 set brake function.
 
err_t hbridge13_set_coast (hbridge13_t *ctx)
 H-Bridge 13 set coast function.
 
err_t hbridge13_set_direction (hbridge13_t *ctx, uint8_t dir_set, uint8_t speed)
 H-Bridge 13 set direction function.
 
err_t hbridge13_read_raw_adc (hbridge13_t *ctx, uint16_t *raw_adc)
 H-Bridge 13 read raw ADC value function.
 
err_t hbridge13_read_voltage (hbridge13_t *ctx, float *voltage)
 H-Bridge 13 read voltage level function.
 
err_t hbridge13_set_vref (hbridge13_t *ctx, float vref)
 H-Bridge 13 set vref function.
 
err_t hbridge13_get_an_voltage (hbridge13_t *ctx, float *voltage, uint8_t an_sel)
 H-Bridge 13 get xIPROPI voltage function.
 
err_t hbridge13_get_flt_state (hbridge13_t *ctx, uint8_t *pin_state)
 H-Bridge 13 get nFAULT state function.
 

Detailed Description

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

Enumeration Type Documentation

◆ hbridge13_return_value_t

H-Bridge 13 Click return value data.

Predefined enum values for driver return values.

Enumerator
HBRIDGE13_OK 
HBRIDGE13_ERROR