39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
72#define HBRIDGE_DIR_CW 0
73#define HBRIDGE_DIR_CCW 1
79#define HBRIDGE_PIN_LOW_LEVEL 0
80#define HBRIDGE_PIN_HIGH_LEVEL 1
86#define HBRIDGE_MODE_FULL_STEP 0
87#define HBRIDGE_MODE_HALF_STEP 1
93#define HBRIDGE_SPEED_VERY_SLOW 0
94#define HBRIDGE_SPEED_SLOW 1
95#define HBRIDGE_SPEED_MEDIUM 2
96#define HBRIDGE_SPEED_FAST 3
97#define HBRIDGE_SPEED_VERY_FAST 4
115#define HBRIDGE_MAP_MIKROBUS( cfg, mikrobus ) \
116 cfg.in2a = MIKROBUS( mikrobus, MIKROBUS_AN ); \
117 cfg.in2b = MIKROBUS( mikrobus, MIKROBUS_RST ); \
118 cfg.in1b = MIKROBUS( mikrobus, MIKROBUS_CS ); \
119 cfg.in1a = MIKROBUS( mikrobus, MIKROBUS_PWM );
void hbridge_set_in2b_pin(hbridge_t *ctx, uint8_t state)
H-Bridge set in2b pin function.
void hbridge_set_step_mode(hbridge_t *ctx, uint8_t mode)
H-Bridge set step mode function.
void hbridge_set_in1b_pin(hbridge_t *ctx, uint8_t state)
H-Bridge set in1b pin function.
void hbridge_set_in1a_pin(hbridge_t *ctx, uint8_t state)
H-Bridge set in1a pin function.
void hbridge_enable_device(hbridge_t *ctx)
H-Bridge enable device function.
void hbridge_set_direction(hbridge_t *ctx, uint8_t dir)
H-Bridge set direction function.
void hbridge_drive_motor(hbridge_t *ctx, uint32_t steps, uint8_t speed)
H-Bridge driver motor function.
void hbridge_switch_direction(hbridge_t *ctx)
H-Bridge switch direction function.
err_t hbridge_init(hbridge_t *ctx, hbridge_cfg_t *cfg)
H-Bridge initialization function.
void hbridge_cfg_setup(hbridge_cfg_t *cfg)
H-Bridge configuration object setup function.
void hbridge_disable_device(hbridge_t *ctx)
H-Bridge disable device function.
void hbridge_set_in2a_pin(hbridge_t *ctx, uint8_t state)
H-Bridge set in2a pin function.
hbridge_return_value_t
H-Bridge Click return value data.
Definition hbridge.h:158
@ HBRIDGE_ERROR
Definition hbridge.h:160
@ HBRIDGE_OK
Definition hbridge.h:159
H-Bridge Click configuration object.
Definition hbridge.h:145
pin_name_t in2b
Definition hbridge.h:147
pin_name_t in2a
Definition hbridge.h:146
pin_name_t in1a
Definition hbridge.h:149
pin_name_t in1b
Definition hbridge.h:148
H-Bridge Click context object.
Definition hbridge.h:129
digital_out_t in1b
Definition hbridge.h:132
digital_out_t in2b
Definition hbridge.h:131
digital_out_t in2a
Definition hbridge.h:130
digital_out_t in1a
Definition hbridge.h:133
uint8_t step_mode
Definition hbridge.h:135
uint8_t direction
Definition hbridge.h:136