35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37#include "drv_i2c_master.h"
65#define HBRIDGE6_REG_IN_PORT 0x00
66#define HBRIDGE6_REG_OUT_PORT 0x01
67#define HBRIDGE6_REG_POL_INV 0x02
68#define HBRIDGE6_REG_CONFIG 0x03
74#define HBRIDGE6_PIN_STATE_LOW 0x00
75#define HBRIDGE6_PIN_STATE_HIGH 0x01
77#define HBRIDGE6_IN_PORT_MULTI_SENSE_LOW 0xFB
78#define HBRIDGE6_IN_PORT_MULTI_SENSE_HIGH 0x04
80#define HBRIDGE6_IN_PORT_IN_LOW 0xFE
81#define HBRIDGE6_IN_PORT_IN_HIGH 0x01
83#define HBRIDGE6_MS_EN_LOW 0xFD
84#define HBRIDGE6_MS_EN_HIGH 0x02
86#define HBRIDGE6_DIAGNOSTIC_DISABLE 0x00
87#define HBRIDGE6_DIAGNOSTIC_ENABLE 0x01
89#define HBRIDGE6_DEFAULT_CFG 0xE0
91#define HBRIDGE6_IN_PORT_SEL_BIT_MASK 0x01
92#define HBRIDGE6_IN_PORT_SEL_0 0x00
93#define HBRIDGE6_IN_PORT_SEL_1 0x01
95#define HBRIDGE6_NUMBER_OF_PORTS 0x07
101#define HBRIDGE6_DIRECTION_BRAKE 0x00
102#define HBRIDGE6_DIRECTION_CLOCKWISE 0x01
103#define HBRIDGE6_DIRECTION_COUNTERCLOCKWISE 0x02
110#define HBRIDGE6_I2C_SLAVE_ADR_0 0x70
111#define HBRIDGE6_I2C_SLAVE_ADR_1 0x71
112#define HBRIDGE6_I2C_SLAVE_ADR_2 0x72
113#define HBRIDGE6_I2C_SLAVE_ADR_3 0x73
119#define HBRIDGE6_DEF_FREQ 5000
137#define HBRIDGE6_MAP_MIKROBUS( cfg, mikrobus ) \
138 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
139 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
140 cfg.ms = MIKROBUS( mikrobus, MIKROBUS_AN ); \
141 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
142 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
void hbridge6_get_output(hbridge6_t *ctx, uint8_t n_out_port, hbridge6_cfg_t *cfg_data)
Get output function.
void hbridge6_set_input_port_b(hbridge6_t *ctx, uint8_t pin_state)
Set input port B function.
err_t hbridge6_set_duty_cycle(hbridge6_t *ctx, float duty_cycle)
H-Bridge 6 sets PWM duty cycle.
void hbridge6_set_output(hbridge6_t *ctx, uint8_t n_out_port, hbridge6_cfg_t cfg_data)
Set output function.
uint8_t hbridge6_get_an_diagnostic(hbridge6_t *ctx)
Get diagnostic function.
void hbridge6_generic_write(hbridge6_t *ctx, uint8_t reg, uint8_t tx_buf)
H-Bridge 6 I2C writing function.
void hbridge6_reset(hbridge6_t *ctx)
HW reset function.
void hbridge6_set_multi_sense(hbridge6_t *ctx, uint8_t sel_num, uint8_t pin_state)
Set multi sense function.
err_t hbridge6_default_cfg(hbridge6_t *ctx)
H-Bridge 6 default configuration function.
void hbridge6_set_input_port_a(hbridge6_t *ctx, uint8_t pin_state)
Set input port A function.
err_t hbridge6_pwm_start(hbridge6_t *ctx)
H-Bridge 6 start PWM module.
void hbridge6_default_config(hbridge6_t *ctx)
Default config function.
err_t hbridge6_init(hbridge6_t *ctx, hbridge6_cfg_t *cfg)
H-Bridge 6 initialization function.
void hbridge6_set_direction(hbridge6_t *ctx, uint8_t direction)
Adjust the direction function.
err_t hbridge6_pwm_stop(hbridge6_t *ctx)
H-Bridge 6 stop PWM module.
void hbridge6_cfg_setup(hbridge6_cfg_t *cfg)
H-Bridge 6 configuration object setup function.
void hbridge6_enable_diagnostic(hbridge6_t *ctx, uint8_t en_state)
Enable the diagnostic function.
uint8_t hbridge6_generic_read(hbridge6_t *ctx, uint8_t reg)
H-Bridge 6 I2C reading function.
hbridge6_return_value_t
H-Bridge 6 Click return value data.
Definition: hbridge6.h:199
@ HBRIDGE6_ERROR
Definition: hbridge6.h:201
@ HBRIDGE6_OK
Definition: hbridge6.h:200
H-Bridge 6 Click configuration object.
Definition: hbridge6.h:175
uint8_t out_val
Definition: hbridge6.h:190
uint32_t i2c_speed
Definition: hbridge6.h:183
uint8_t in_out
Definition: hbridge6.h:188
uint32_t dev_pwm_freq
Definition: hbridge6.h:186
pin_name_t scl
Definition: hbridge6.h:176
pin_name_t pwm
Definition: hbridge6.h:181
pin_name_t sda
Definition: hbridge6.h:177
pin_name_t ms
Definition: hbridge6.h:179
pin_name_t rst
Definition: hbridge6.h:180
uint8_t invert
Definition: hbridge6.h:189
uint8_t i2c_address
Definition: hbridge6.h:184
H-Bridge 6 Click context object.
Definition: hbridge6.h:152
digital_in_t ms
Definition: hbridge6.h:157
uint32_t pwm_freq
Definition: hbridge6.h:166
i2c_master_t i2c
Definition: hbridge6.h:160
digital_out_t rst
Definition: hbridge6.h:154
uint8_t slave_address
Definition: hbridge6.h:164
pwm_t pwm
Definition: hbridge6.h:161