39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
67#define STEPPER18_STEP_RES_FULL 1
68#define STEPPER18_STEP_RES_HALF 2
69#define STEPPER18_STEP_RES_QUARTER 4
70#define STEPPER18_STEP_RES_1div8 8
71#define STEPPER18_STEP_RES_1div16 16
72#define STEPPER18_STEP_RES_1div32 32
73#define STEPPER18_STEP_RES_1div64 64
74#define STEPPER18_STEP_RES_1div128 128
75#define STEPPER18_STEP_RES_1div256 256
81#define STEPPER18_SPEED_VERY_SLOW 1
82#define STEPPER18_SPEED_SLOW 2
83#define STEPPER18_SPEED_MEDIUM 3
84#define STEPPER18_SPEED_FAST 4
85#define STEPPER18_SPEED_VERY_FAST 5
92#define STEPPER18_SET_DEV_ADDR 0x60
110#define STEPPER18_MAP_MIKROBUS( cfg, mikrobus ) \
111 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
112 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
113 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
114 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
115 cfg.slp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
116 cfg.stp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
117 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT )
void stepper18_calculate_resolution(stepper18_t *ctx)
Calculate step-degree resolution.
err_t stepper18_init(stepper18_t *ctx, stepper18_cfg_t *cfg)
Stepper 18 initialization function.
void stepper18_set_slp(stepper18_t *ctx, uint8_t value)
Set sleep.
uint8_t stepper18_get_flt(stepper18_t *ctx)
Get fault.
void stepper18_move_motor_step(stepper18_t *ctx, uint16_t steps, uint8_t step_res, uint8_t speed)
Move motor in step value.
err_t stepper18_generic_write(stepper18_t *ctx, uint8_t *tx_buf, uint8_t tx_len)
Writing function.
err_t stepper18_default_cfg(stepper18_t *ctx)
Stepper 18 default configuration function.
err_t stepper18_set_out_voltage(stepper18_t *ctx, uint16_t voltage)
Set voltage reference.
void stepper18_set_dir(stepper18_t *ctx, uint8_t value)
Set direction.
void stepper18_set_en(stepper18_t *ctx, uint8_t value)
Set enable.
void stepper18_cfg_setup(stepper18_cfg_t *cfg)
Stepper 18 configuration object setup function.
void stepper18_set_stp(stepper18_t *ctx, uint8_t value)
Set step state.
void stepper18_move_motor_angle(stepper18_t *ctx, float degree, uint8_t step_res, uint8_t speed)
Move motor in angle value.
stepper18_return_value_t
Stepper 18 Click return value data.
Definition stepper18.h:175
@ STEPPER18_ERROR
Definition stepper18.h:177
@ STEPPER18_OK
Definition stepper18.h:176
Stepper 18 Click configuration object.
Definition stepper18.h:155
pin_name_t stp
Definition stepper18.h:162
pin_name_t slp
Definition stepper18.h:161
uint32_t i2c_speed
Definition stepper18.h:165
pin_name_t flt
Definition stepper18.h:163
pin_name_t dir
Definition stepper18.h:160
pin_name_t scl
Definition stepper18.h:156
pin_name_t en
Definition stepper18.h:159
pin_name_t sda
Definition stepper18.h:157
uint8_t i2c_address
Definition stepper18.h:166
Stepper 18 Click context object.
Definition stepper18.h:127
uint16_t steps
Definition stepper18.h:144
float resolution
Definition stepper18.h:145
digital_in_t flt
Definition stepper18.h:135
digital_out_t slp
Definition stepper18.h:131
digital_out_t stp
Definition stepper18.h:132
i2c_master_t i2c
Definition stepper18.h:138
digital_out_t en
Definition stepper18.h:129
uint8_t slave_address
Definition stepper18.h:141
digital_out_t dir
Definition stepper18.h:130