42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define HBRIDGE5_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
70 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define HBRIDGE5_RETVAL uint8_t
80#define HBRIDGE5_OK 0x00
81#define HBRIDGE5_INIT_ERROR 0xFF
88#define HBRIDGE5_DEVICE_SLAVE_ADDR_0_0 0x70
89#define HBRIDGE5_DEVICE_SLAVE_ADDR_0_1 0x71
90#define HBRIDGE5_DEVICE_SLAVE_ADDR_1_0 0x72
91#define HBRIDGE5_DEVICE_SLAVE_ADDR_1_1 0x73
98#define HBRIDGE5_CMD_INPUT_PORT 0x00
99#define HBRIDGE5_CMD_OUTPUT_PORT 0x01
100#define HBRIDGE5_CMD_POLARITY_INVERSION 0x02
101#define HBRIDGE5_CMD_CONFIGURATION 0x03
108#define HBRIDGE5_PORT_PHASE 0x01
109#define HBRIDGE5_PORT_ENABLE 0x02
110#define HBRIDGE5_PORT_BRAKE 0x04
111#define HBRIDGE5_PORT_B_MODE 0x08
112#define HBRIDGE5_PORT_N_SLEEP 0x10
113#define HBRIDGE5_PORT_N_FAULT 0x20
120#define HBRIDGE5_ENABLE_ALL_OUTPUT_PORT 0xE0
121#define HBRIDGE5_DISABLE_ALL_OUTPUT_PORT 0xFF
#define HBRIDGE5_RETVAL
Definition hbridge5.h:78
void hbridge5_cfg_setup(hbridge5_cfg_t *cfg)
Config Object Initialization function.
HBRIDGE5_RETVAL hbridge5_init(hbridge5_t *ctx, hbridge5_cfg_t *cfg)
Initialization function.
void hbridge5_generic_write(hbridge5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void hbridge5_forward(hbridge5_t *ctx)
Puts motor into forward motion.
void hbridge5_sync_decay_rev(hbridge5_t *ctx)
Synchronization fast decay reverse function.
void hbridge5_write_byte(hbridge5_t *ctx, uint8_t cmd, uint8_t data_in)
Function writes one byte in register.
void hbridge5_set_port(hbridge5_t *ctx, uint8_t port, uint8_t value)
Function sets port.
void hbridge5_reverse(hbridge5_t *ctx)
Puts motor into reverse motion.
void hbridge5_configuration(hbridge5_t *ctx, uint8_t cfg_data)
Configuration function.
uint8_t hbridge5_get_interrupt_state(hbridge5_t *ctx)
Reads interrupt pin state.
void hbridge5_default_cfg(hbridge5_t *ctx)
Click Default Configuration function.
void hbridge5_sleep(hbridge5_t *ctx, uint8_t state)
Sleep function.
void hbridge5_brake_high(hbridge5_t *ctx)
Puts motor to a halt.
void hbridge5_rst_state(hbridge5_t *ctx, uint8_t state)
Resets pin state.
uint8_t hbridge5_n_fault_check(hbridge5_t *ctx)
N fault check function.
void hbridge5_generic_read(hbridge5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t hbridge5_read_byte(hbridge5_t *ctx, uint8_t cmd)
Function reads byte from register.
void hbridge5_sync_decay_fwd(hbridge5_t *ctx)
Synchronization fast decay foreward function.
void hbridge5_brake_low(hbridge5_t *ctx)
Puts motor to a halt.
Click configuration structure definition.
Definition hbridge5.h:159
uint32_t i2c_speed
Definition hbridge5.h:173
pin_name_t scl
Definition hbridge5.h:162
pin_name_t int_pin
Definition hbridge5.h:169
pin_name_t sda
Definition hbridge5.h:163
pin_name_t rst
Definition hbridge5.h:168
pin_name_t an
Definition hbridge5.h:167
uint8_t i2c_address
Definition hbridge5.h:174
Click ctx object definition.
Definition hbridge5.h:135
digital_in_t int_pin
Definition hbridge5.h:143
i2c_master_t i2c
Definition hbridge5.h:147
digital_in_t an
Definition hbridge5.h:142
digital_out_t rst
Definition hbridge5.h:138
uint8_t slave_address
Definition hbridge5.h:151