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 STEPPER2_PIN_STATE_LOW 0
73#define STEPPER2_PIN_STATE_HIGH 1
79#define STEPPER2_DIR_CCW 0
80#define STEPPER2_DIR_CW 1
86#define STEPPER2_MODE_FULL_STEP 0
87#define STEPPER2_MODE_HALF_STEP 1
88#define STEPPER2_MODE_QUARTER_STEP 2
89#define STEPPER2_MODE_1_OVER_8_STEP 3
95#define STEPPER2_MICROSTEP_NUM_PER_STEP 32
101#define STEPPER2_SPEED_VERY_SLOW 0
102#define STEPPER2_SPEED_SLOW 1
103#define STEPPER2_SPEED_MEDIUM 2
104#define STEPPER2_SPEED_FAST 3
105#define STEPPER2_SPEED_VERY_FAST 4
123#define STEPPER2_MAP_MIKROBUS( cfg, mikrobus ) \
124 cfg.en = MIKROBUS( mikrobus, MIKROBUS_AN ); \
125 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
126 cfg.slp = MIKROBUS( mikrobus, MIKROBUS_CS ); \
127 cfg.step = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
128 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_INT )
void stepper2_set_direction(stepper2_t *ctx, uint8_t dir)
Stepper 2 set direction function.
void stepper2_disable_sleep(stepper2_t *ctx)
Stepper 2 disable sleep function.
void stepper2_cfg_setup(stepper2_cfg_t *cfg)
Stepper 2 configuration object setup function.
void stepper2_switch_direction(stepper2_t *ctx)
Stepper 2 switch direction function.
void stepper2_drive_motor(stepper2_t *ctx, uint32_t steps, uint8_t speed)
Stepper 2 driver motor function.
void stepper2_enable_sleep(stepper2_t *ctx)
Stepper 2 enable sleep function.
err_t stepper2_init(stepper2_t *ctx, stepper2_cfg_t *cfg)
Stepper 2 initialization function.
void stepper2_default_cfg(stepper2_t *ctx)
Stepper 2 default configuration function.
void stepper2_disable_device(stepper2_t *ctx)
Stepper 2 disable device function.
void stepper2_disable_reset(stepper2_t *ctx)
Stepper 2 disable reset function.
void stepper2_set_step_pin(stepper2_t *ctx, uint8_t state)
Stepper 2 set step pin function.
void stepper2_enable_reset(stepper2_t *ctx)
Stepper 2 enable reset function.
void stepper2_enable_device(stepper2_t *ctx)
Stepper 2 enable device function.
stepper2_return_value_t
Stepper 2 Click return value data.
Definition stepper2.h:166
@ STEPPER2_ERROR
Definition stepper2.h:168
@ STEPPER2_OK
Definition stepper2.h:167
Stepper 2 Click configuration object.
Definition stepper2.h:152
pin_name_t slp
Definition stepper2.h:155
pin_name_t step
Definition stepper2.h:156
pin_name_t dir
Definition stepper2.h:157
pin_name_t en
Definition stepper2.h:153
pin_name_t rst
Definition stepper2.h:154
Stepper 2 Click context object.
Definition stepper2.h:138
digital_out_t slp
Definition stepper2.h:141
digital_out_t step
Definition stepper2.h:142
digital_out_t en
Definition stepper2.h:139
digital_out_t rst
Definition stepper2.h:140
digital_out_t dir
Definition stepper2.h:143