hbridge15 2.1.0.0
hbridge15.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  hbridge15_t
 H-Bridge 15 Click context object. More...
 
struct  hbridge15_cfg_t
 H-Bridge 15 Click configuration object. More...
 

Macros

#define HBRIDGE15_REG_INPUT_PORT   0x00
 H-Bridge 15 description register.
 
#define HBRIDGE15_REG_OUTPUT_PORT   0x01
 
#define HBRIDGE15_REG_POLARITY_INVERSION   0x02
 
#define HBRIDGE15_REG_CONFIGURATION   0x03
 
#define HBRIDGE15_PIN_MASK_NONE   0x00
 H-Bridge 15 description setting.
 
#define HBRIDGE15_PIN_MASK_SLP   0x01
 
#define HBRIDGE15_PIN_MASK_FLT   0x02
 
#define HBRIDGE15_PIN_MASK_CONFIG   0x04
 
#define HBRIDGE15_PIN_MASK_M1   0x08
 
#define HBRIDGE15_PIN_MASK_M0   0x10
 
#define HBRIDGE15_PIN_MASK_DIR   0x20
 
#define HBRIDGE15_PIN_MASK_EN_B   0x40
 
#define HBRIDGE15_PIN_MASK_EN_A   0x80
 
#define HBRIDGE15_PIN_MASK_ALL   0xFF
 
#define HBRIDGE15_PIN_STATE_HIGH   0x01
 H-Bridge 15 pin state setting.
 
#define HBRIDGE15_PIN_STATE_LOW   0x00
 
#define HBRIDGE15_SLEEP_STATE_ON   0x01
 H-Bridge 15 sleep state setting.
 
#define HBRIDGE15_SLEEP_STATE_OFF   0x00
 
#define HBRIDGE15_DRIVE_MOTOR_REVERSE   0x00
 H-Bridge 15 motor states setting.
 
#define HBRIDGE15_DRIVE_MOTOR_FORWARD   0x01
 
#define HBRIDGE15_DRIVE_MOTOR_FREEWHEEL   0x02
 
#define HBRIDGE15_DRIVE_MOTOR_BRAKE   0x03
 
#define HBRIDGE15_DEVICE_ADDRESS_00   0x70
 H-Bridge 15 device address setting.
 
#define HBRIDGE15_DEVICE_ADDRESS_01   0x71
 
#define HBRIDGE15_DEVICE_ADDRESS_10   0x72
 
#define HBRIDGE15_DEVICE_ADDRESS_11   0x73
 
#define HBRIDGE15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  hbridge15_return_value_t { HBRIDGE15_OK = 0 , HBRIDGE15_ERROR = -1 }
 H-Bridge 15 Click return value data. More...
 

Functions

void hbridge15_cfg_setup (hbridge15_cfg_t *cfg)
 H-Bridge 15 configuration object setup function.
 
err_t hbridge15_init (hbridge15_t *ctx, hbridge15_cfg_t *cfg)
 H-Bridge 15 initialization function.
 
err_t hbridge15_default_cfg (hbridge15_t *ctx)
 H-Bridge 15 default configuration function.
 
err_t hbridge15_generic_write (hbridge15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 H-Bridge 15 I2C writing function.
 
err_t hbridge15_generic_read (hbridge15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 H-Bridge 15 I2C reading function.
 
void hbridge15_set_rst_pin (hbridge15_t *ctx, uint8_t pin_state)
 H-Bridge 15 set RST pin function.
 
void hbridge15_set_ena_pin (hbridge15_t *ctx, uint8_t pin_state)
 H-Bridge 15 set ENA pin function.
 
uint8_t hbridge15_get_int_state (hbridge15_t *ctx)
 H-Bridge 15 get INT pin state function.
 
void hbridge15_reset_port_exp (hbridge15_t *ctx)
 H-Bridge 15 reset port expander function.
 
err_t hbridge15_write_reg (hbridge15_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 15 write register function.
 
err_t hbridge15_read_reg (hbridge15_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 15 read register function.
 
err_t hbridge15_set_pins (hbridge15_t *ctx, uint8_t set_mask, uint8_t clr_mask)
 H-Bridge 15 set pins function.
 
err_t hbridge15_set_sleep (hbridge15_t *ctx, uint8_t sleep_state)
 H-Bridge 15 set sleep function.
 
err_t hbridge15_set_out_state (hbridge15_t *ctx, uint8_t out_state)
 H-Bridge 15 set output function.
 

Detailed Description

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

Enumeration Type Documentation

◆ hbridge15_return_value_t

H-Bridge 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
HBRIDGE15_OK 
HBRIDGE15_ERROR