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"
73#define STEPPER11_REG_INPUT_PORT 0x00
74#define STEPPER11_REG_OUTPUT_PORT 0x01
75#define STEPPER11_REG_POLARITY 0x02
76#define STEPPER11_REG_CONFIGURATION 0x03
94#define STEPPER11_SPEED_SLOW 1
95#define STEPPER11_SPEED_MEDIUM 2
96#define STEPPER11_SPEED_FAST 3
102#define STEPPER11_RESOLUTION_FULL 0x4
103#define STEPPER11_RESOLUTION_HALF_A 0x2
104#define STEPPER11_RESOLUTION_HALF_B 0x1
105#define STEPPER11_RESOLUTION_QUARTER 0x6
106#define STEPPER11_RESOLUTION_1div8 0x5
107#define STEPPER11_RESOLUTION_1div16 0x3
108#define STEPPER11_RESOLUTION_1div32 0x7
114#define STEPPER11_TORQUE_100 0x0
115#define STEPPER11_TORQUE_70 0x1
116#define STEPPER11_TORQUE_50 0x2
117#define STEPPER11_TORQUE_30 0x3
124#define STEPPER11_SET_DEV_ADDR 0x70
142#define STEPPER11_MAP_MIKROBUS( cfg, mikrobus ) \
143 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
144 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
145 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
146 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
147 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
148 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
149 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t stepper11_default_cfg(stepper11_t *ctx)
Stepper 11 default configuration function.
err_t stepper11_set_step_resolution(stepper11_t *ctx, uint8_t step_res)
Set step resolution.
uint8_t stepper11_get_sd(stepper11_t *ctx)
Get stall detection flag.
void stepper11_set_reset(stepper11_t *ctx, uint8_t state)
Set restart.
void stepper11_cfg_setup(stepper11_cfg_t *cfg)
Stepper 11 configuration object setup function.
uint8_t stepper11_get_interrupt(stepper11_t *ctx)
Get interrupt.
void stepper11_set_enable(stepper11_t *ctx, uint8_t state)
Set enable.
void stepper11_move_motor_step(stepper11_t *ctx, uint16_t steps, uint8_t speed)
Move motor in step value.
void stepper11_set_clock(stepper11_t *ctx, uint8_t state)
Set clock state.
uint8_t stepper11_get_mo(stepper11_t *ctx)
Get electrical angle monitoring signal.
err_t stepper11_generic_write(stepper11_t *ctx, uint8_t reg, uint8_t tx_data)
Stepper 11 I2C writing function.
void stepper11_move_motor_angle(stepper11_t *ctx, float degree, uint8_t speed)
Move motor in angle value.
err_t stepper11_set_torque(stepper11_t *ctx, uint8_t torque)
Set torque.
uint8_t stepper11_get_diag(stepper11_t *ctx)
Get anomaly detection flag.
err_t stepper11_generic_read(stepper11_t *ctx, uint8_t reg, uint8_t *rx_data)
Stepper 11 I2C reading function.
void stepper11_set_direction(stepper11_t *ctx, uint8_t state)
Set direction.
err_t stepper11_init(stepper11_t *ctx, stepper11_cfg_t *cfg)
Stepper 11 initialization function.
stepper11_return_value_t
Stepper 11 Click return value data.
Definition stepper11.h:206
@ STEPPER11_OK
Definition stepper11.h:207
@ STEPPER11_ERROR
Definition stepper11.h:208
Stepper 11 Click configuration object.
Definition stepper11.h:186
pin_name_t clk
Definition stepper11.h:193
uint32_t i2c_speed
Definition stepper11.h:196
pin_name_t dir
Definition stepper11.h:191
pin_name_t scl
Definition stepper11.h:187
pin_name_t en
Definition stepper11.h:190
pin_name_t int_pin
Definition stepper11.h:194
pin_name_t sda
Definition stepper11.h:188
pin_name_t rst
Definition stepper11.h:192
uint8_t i2c_address
Definition stepper11.h:197
Stepper 11 Click context object.
Definition stepper11.h:159
uint16_t steps
Definition stepper11.h:175
float resolution
Definition stepper11.h:176
uint8_t step_resolution
Definition stepper11.h:177
digital_in_t int_pin
Definition stepper11.h:167
i2c_master_t i2c
Definition stepper11.h:170
digital_out_t clk
Definition stepper11.h:164
digital_out_t en
Definition stepper11.h:161
digital_out_t rst
Definition stepper11.h:163
uint8_t slave_address
Definition stepper11.h:173
digital_out_t dir
Definition stepper11.h:162