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 STEPPER_PIN_STATE_LOW 0
73#define STEPPER_PIN_STATE_HIGH 1
79#define STEPPER_DIR_CW 0
80#define STEPPER_DIR_CCW 1
86#define STEPPER_MODE_FULL_STEP 0
87#define STEPPER_MODE_HALF_STEP 1
88#define STEPPER_MODE_QUARTER_STEP 2
89#define STEPPER_MODE_1_OVER_8_STEP 3
95#define STEPPER_MICROSTEP_NUM_PER_STEP 32
101#define STEPPER_SPEED_VERY_SLOW 0
102#define STEPPER_SPEED_SLOW 1
103#define STEPPER_SPEED_MEDIUM 2
104#define STEPPER_SPEED_FAST 3
105#define STEPPER_SPEED_VERY_FAST 4
123#define STEPPER_MAP_MIKROBUS( cfg, mikrobus ) \
124 cfg.ms1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
125 cfg.ms2 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
126 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_CS ); \
127 cfg.step = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
128 cfg.en = MIKROBUS( mikrobus, MIKROBUS_INT )
void stepper_switch_direction(stepper_t *ctx)
Stepper switch direction function.
void stepper_set_direction(stepper_t *ctx, uint8_t dir)
Stepper set direction function.
err_t stepper_init(stepper_t *ctx, stepper_cfg_t *cfg)
Stepper initialization function.
void stepper_set_step_pin(stepper_t *ctx, uint8_t state)
Stepper set step pin function.
void stepper_set_step_mode(stepper_t *ctx, uint8_t mode)
Stepper set step mode function.
void stepper_cfg_setup(stepper_cfg_t *cfg)
Stepper configuration object setup function.
void stepper_enable_device(stepper_t *ctx)
Stepper enable device function.
void stepper_drive_motor(stepper_t *ctx, uint32_t steps, uint8_t speed)
Stepper driver motor function.
void stepper_default_cfg(stepper_t *ctx)
Stepper default configuration function.
void stepper_disable_device(stepper_t *ctx)
Stepper disable device function.
stepper_return_value_t
Stepper Click return value data.
Definition stepper.h:166
@ STEPPER_OK
Definition stepper.h:167
@ STEPPER_ERROR
Definition stepper.h:168
Stepper Click configuration object.
Definition stepper.h:152
pin_name_t ms2
Definition stepper.h:154
pin_name_t step
Definition stepper.h:156
pin_name_t ms1
Definition stepper.h:153
pin_name_t dir
Definition stepper.h:155
pin_name_t en
Definition stepper.h:157
Stepper Click context object.
Definition stepper.h:138
digital_out_t ms2
Definition stepper.h:140
digital_out_t ms1
Definition stepper.h:139
digital_out_t step
Definition stepper.h:142
digital_out_t en
Definition stepper.h:143
digital_out_t dir
Definition stepper.h:141