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 STEPPER13_PCA9538A_REG_INPUT 0x00
74#define STEPPER13_PCA9538A_REG_OUTPUT 0x01
75#define STEPPER13_PCA9538A_REG_POLARITY 0x02
76#define STEPPER13_PCA9538A_REG_CONFIG 0x03
95#define STEPPER13_PIN_MS1 0x01
96#define STEPPER13_PIN_MS2 0x02
97#define STEPPER13_PIN_MS_MASK 0x03
98#define STEPPER13_PIN_FAULT 0x04
99#define STEPPER13_PIN_DIR 0x08
100#define STEPPER13_PIN_SLEEP 0x10
101#define STEPPER13_PIN_ENABLE 0x20
107#define STEPPER13_PCA9538A_DEFAULT_CONFIG 0xC4
113#define STEPPER13_DIR_CW 0
114#define STEPPER13_DIR_CCW 1
120#define STEPPER13_PIN_STATE_LOW 0
121#define STEPPER13_PIN_STATE_HIGH 1
127#define STEPPER13_SPEED_VERY_SLOW 0
128#define STEPPER13_SPEED_SLOW 1
129#define STEPPER13_SPEED_MEDIUM 2
130#define STEPPER13_SPEED_FAST 3
131#define STEPPER13_SPEED_VERY_FAST 4
137#define STEPPER13_MODE_FULL_STEP 0
138#define STEPPER13_MODE_HALF_STEP 1
139#define STEPPER13_MODE_QUARTER_STEP 2
140#define STEPPER13_MODE_1_OVER_8 3
147#define STEPPER13_DEVICE_ADDRESS_A1A0_00 0x70
148#define STEPPER13_DEVICE_ADDRESS_A1A0_01 0x71
149#define STEPPER13_DEVICE_ADDRESS_A1A0_10 0x72
150#define STEPPER13_DEVICE_ADDRESS_A1A0_11 0x73
168#define STEPPER13_MAP_MIKROBUS( cfg, mikrobus ) \
169 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
170 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
171 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
172 cfg.step = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
173 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t stepper13_disable_device(stepper13_t *ctx)
Stepper 13 disable device function.
err_t stepper13_pca_read_reg(stepper13_t *ctx, uint8_t reg, uint8_t *data_out)
Stepper 13 pca read reg function.
err_t stepper13_disable_sleep(stepper13_t *ctx)
Stepper 13 disable sleep function.
err_t stepper13_switch_direction(stepper13_t *ctx)
Stepper 13 switch direction function.
uint8_t stepper13_get_int_pin(stepper13_t *ctx)
Stepper 13 get INT pin function.
err_t stepper13_set_step_mode(stepper13_t *ctx, uint8_t mode)
Stepper 13 set step mode function.
err_t stepper13_get_fault_pin(stepper13_t *ctx, uint8_t *state)
Stepper 13 get fault pin function.
void stepper13_set_rst_pin(stepper13_t *ctx, uint8_t state)
Stepper 13 set rst pin function.
err_t stepper13_drive_motor(stepper13_t *ctx, uint32_t steps, uint8_t speed)
Stepper 13 driver motor function.
err_t stepper13_get_step_mode(stepper13_t *ctx, uint8_t *mode)
Stepper 13 get step mode function.
void stepper13_cfg_setup(stepper13_cfg_t *cfg)
Stepper 13 configuration object setup function.
err_t stepper13_pca_write_reg(stepper13_t *ctx, uint8_t reg, uint8_t data_in)
Stepper 13 pca write reg function.
err_t stepper13_enable_sleep(stepper13_t *ctx)
Stepper 13 enable sleep function.
err_t stepper13_enable_device(stepper13_t *ctx)
Stepper 13 enable device function.
err_t stepper13_default_cfg(stepper13_t *ctx)
Stepper 13 default configuration function.
err_t stepper13_set_direction(stepper13_t *ctx, uint8_t dir)
Stepper 13 set direction function.
err_t stepper13_init(stepper13_t *ctx, stepper13_cfg_t *cfg)
Stepper 13 initialization function.
void stepper13_set_step_pin(stepper13_t *ctx, uint8_t state)
Stepper 13 set step pin function.
void stepper13_reset_pca(stepper13_t *ctx)
Stepper 13 reset device function.
stepper13_return_value_t
Stepper 13 Click return value data.
Definition stepper13.h:222
@ STEPPER13_OK
Definition stepper13.h:223
@ STEPPER13_ERROR
Definition stepper13.h:224
Stepper 13 Click configuration object.
Definition stepper13.h:204
pin_name_t step
Definition stepper13.h:209
uint32_t i2c_speed
Definition stepper13.h:212
pin_name_t scl
Definition stepper13.h:205
pin_name_t int_pin
Definition stepper13.h:210
pin_name_t sda
Definition stepper13.h:206
pin_name_t rst
Definition stepper13.h:208
uint8_t i2c_address
Definition stepper13.h:213
Stepper 13 Click context object.
Definition stepper13.h:183
digital_in_t int_pin
Definition stepper13.h:189
digital_out_t step
Definition stepper13.h:186
i2c_master_t i2c
Definition stepper13.h:192
digital_out_t rst
Definition stepper13.h:185
uint8_t slave_address
Definition stepper13.h:195