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 STEPPER14_PCA9538A_REG_INPUT 0x00
74#define STEPPER14_PCA9538A_REG_OUTPUT 0x01
75#define STEPPER14_PCA9538A_REG_POLARITY 0x02
76#define STEPPER14_PCA9538A_REG_CONFIG 0x03
94#define STEPPER14_PIN_IN1 0x01
95#define STEPPER14_PIN_IN2 0x02
96#define STEPPER14_PIN_MODE 0x04
97#define STEPPER14_PIN_IN3 0x08
98#define STEPPER14_PIN_IN4 0x10
99#define STEPPER14_PIN_TRQ 0x20
105#define STEPPER14_PCA9538A_DEFAULT_CONFIG 0xC0
111#define STEPPER14_DIR_CW 0
112#define STEPPER14_DIR_CCW 1
118#define STEPPER14_PIN_STATE_LOW 0
119#define STEPPER14_PIN_STATE_HIGH 1
125#define STEPPER14_INTERFACE_4_PIN 0
126#define STEPPER14_INTERFACE_2_PIN 1
132#define STEPPER14_SPEED_VERY_SLOW 0
133#define STEPPER14_SPEED_SLOW 1
134#define STEPPER14_SPEED_MEDIUM 2
135#define STEPPER14_SPEED_FAST 3
136#define STEPPER14_SPEED_VERY_FAST 4
142#define STEPPER14_MODE_FULL_STEP 0
143#define STEPPER14_MODE_HALF_STEP 1
150#define STEPPER14_DEVICE_ADDRESS_A1A0_00 0x70
151#define STEPPER14_DEVICE_ADDRESS_A1A0_01 0x71
152#define STEPPER14_DEVICE_ADDRESS_A1A0_10 0x72
153#define STEPPER14_DEVICE_ADDRESS_A1A0_11 0x73
171#define STEPPER14_MAP_MIKROBUS( cfg, mikrobus ) \
172 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
173 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
174 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
175 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
176 cfg.flt = MIKROBUS( mikrobus, MIKROBUS_INT )
void stepper14_enable_device(stepper14_t *ctx)
Stepper 14 enable device function.
err_t stepper14_default_cfg(stepper14_t *ctx)
Stepper 14 default configuration function.
void stepper14_set_step_mode(stepper14_t *ctx, uint8_t mode)
Stepper 14 set step mode function.
void stepper14_set_rst_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set rst pin function.
void stepper14_switch_direction(stepper14_t *ctx)
Stepper 14 switch direction function.
err_t stepper14_set_mode_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set MODE pin function.
void stepper14_set_direction(stepper14_t *ctx, uint8_t dir)
Stepper 14 set direction function.
err_t stepper14_pca_read_reg(stepper14_t *ctx, uint8_t reg, uint8_t *data_out)
Stepper 14 pca read reg function.
void stepper14_cfg_setup(stepper14_cfg_t *cfg)
Stepper 14 configuration object setup function.
err_t stepper14_init(stepper14_t *ctx, stepper14_cfg_t *cfg)
Stepper 14 initialization function.
void stepper14_reset_pca(stepper14_t *ctx)
Stepper 14 reset device function.
err_t stepper14_pca_write_reg(stepper14_t *ctx, uint8_t reg, uint8_t data_in)
Stepper 14 pca write reg function.
err_t stepper14_set_in1_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set IN1 pin function.
err_t stepper14_set_in3_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set IN3 pin function.
void stepper14_disable_device(stepper14_t *ctx)
Stepper 14 disable device function.
err_t stepper14_set_in4_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set IN4 pin function.
uint8_t stepper14_get_fault_pin(stepper14_t *ctx)
Stepper 14 get FAULT pin function.
err_t stepper14_set_trq_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set TRQ pin function.
err_t stepper14_set_in2_pin(stepper14_t *ctx, uint8_t state)
Stepper 14 set IN2 pin function.
err_t stepper14_set_interface_mode(stepper14_t *ctx, uint8_t mode)
Stepper 14 set interface mode function.
err_t stepper14_drive_motor(stepper14_t *ctx, uint32_t steps, uint8_t speed)
Stepper 14 driver motor function.
stepper14_return_value_t
Stepper 14 Click return value data.
Definition stepper14.h:229
@ STEPPER14_ERROR
Definition stepper14.h:231
@ STEPPER14_OK
Definition stepper14.h:230
Stepper 14 Click configuration object.
Definition stepper14.h:211
uint32_t i2c_speed
Definition stepper14.h:219
pin_name_t flt
Definition stepper14.h:217
pin_name_t scl
Definition stepper14.h:212
pin_name_t en
Definition stepper14.h:215
pin_name_t sda
Definition stepper14.h:213
pin_name_t rst
Definition stepper14.h:216
uint8_t i2c_address
Definition stepper14.h:220
Stepper 14 Click context object.
Definition stepper14.h:186
digital_in_t flt
Definition stepper14.h:192
uint8_t step_mode
Definition stepper14.h:201
i2c_master_t i2c
Definition stepper14.h:195
uint8_t pin_mode
Definition stepper14.h:200
digital_out_t en
Definition stepper14.h:188
digital_out_t rst
Definition stepper14.h:189
uint8_t direction
Definition stepper14.h:202
uint8_t slave_address
Definition stepper14.h:198