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 STEPPER9_REG_INPUT 0x00
74#define STEPPER9_REG_OUTPUT 0x01
75#define STEPPER9_REG_POLARITY 0x02
76#define STEPPER9_REG_CONFIG 0x03
94#define STEPPER9_DMODE0_PIN 0x01
95#define STEPPER9_DMODE1_PIN 0x02
96#define STEPPER9_DMODE2_PIN 0x04
97#define STEPPER9_SLEEP_X_PIN 0x08
98#define STEPPER9_LO_PIN 0x10
99#define STEPPER9_MO_PIN 0x20
105#define STEPPER9_DEFAULT_CONFIG 0xF0
111#define STEPPER9_DIR_CCW 0
112#define STEPPER9_DIR_CW 1
118#define STEPPER9_PIN_LOW_LEVEL 0
119#define STEPPER9_PIN_HIGH_LEVEL 1
125#define STEPPER9_MODE_FULL_STEP 0x00
126#define STEPPER9_MODE_HALF_STEP 0x01
127#define STEPPER9_MODE_QUARTER_STEP 0x02
128#define STEPPER9_MODE_1_OVER_8 0x03
129#define STEPPER9_MODE_1_OVER_16 0x04
130#define STEPPER9_MODE_1_OVER_32 0x05
131#define STEPPER9_MODE_MASK 0x07
137#define STEPPER9_SPEED_VERY_SLOW 0
138#define STEPPER9_SPEED_SLOW 1
139#define STEPPER9_SPEED_MEDIUM 2
140#define STEPPER9_SPEED_FAST 3
141#define STEPPER9_SPEED_VERY_FAST 4
148#define STEPPER9_DEVICE_ADDRESS_A1A0_00 0x70
149#define STEPPER9_DEVICE_ADDRESS_A1A0_01 0x71
150#define STEPPER9_DEVICE_ADDRESS_A1A0_10 0x72
151#define STEPPER9_DEVICE_ADDRESS_A1A0_11 0x73
169#define STEPPER9_MAP_MIKROBUS( cfg, mikrobus ) \
170 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
171 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
172 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
173 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
174 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
175 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
176 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
void stepper9_disable_device(stepper9_t *ctx)
Stepper 9 disable device function.
err_t stepper9_get_sleep_x_pin(stepper9_t *ctx, uint8_t *state)
Stepper 9 get sleep x pin function.
err_t stepper9_write_register(stepper9_t *ctx, uint8_t reg, uint8_t data_in)
Stepper 9 write register function.
uint8_t stepper9_get_int_pin(stepper9_t *ctx)
Stepper 9 get int pin function.
void stepper9_set_clk_pin(stepper9_t *ctx, uint8_t state)
Stepper 9 set clk pin function.
void stepper9_drive_motor(stepper9_t *ctx, uint32_t steps, uint8_t speed)
Stepper 9 driver motor function.
void stepper9_enable_device(stepper9_t *ctx)
Stepper 9 enable device function.
err_t stepper9_get_step_mode(stepper9_t *ctx, uint8_t *mode)
Stepper 9 get step mode function.
err_t stepper9_set_step_mode(stepper9_t *ctx, uint8_t mode)
Stepper 9 set step mode function.
err_t stepper9_get_lo_pin(stepper9_t *ctx, uint8_t *state)
Stepper 9 get lo pin function.
void stepper9_set_direction(stepper9_t *ctx, uint8_t dir)
Stepper 9 set direction function.
err_t stepper9_read_register(stepper9_t *ctx, uint8_t reg, uint8_t *data_out)
Stepper 9 read register function.
void stepper9_switch_direction(stepper9_t *ctx)
Stepper 9 switch direction function.
err_t stepper9_get_mo_pin(stepper9_t *ctx, uint8_t *state)
Stepper 9 get mo pin function.
err_t stepper9_init(stepper9_t *ctx, stepper9_cfg_t *cfg)
Stepper 9 initialization function.
void stepper9_cfg_setup(stepper9_cfg_t *cfg)
Stepper 9 configuration object setup function.
err_t stepper9_default_cfg(stepper9_t *ctx)
Stepper 9 default configuration function.
err_t stepper9_set_sleep_x_pin(stepper9_t *ctx, uint8_t state)
Stepper 9 set sleep x pin function.
void stepper9_reset_device(stepper9_t *ctx)
Stepper 9 reset device function.
stepper9_return_value_t
Stepper 9 Click return value data.
Definition stepper9.h:229
@ STEPPER9_OK
Definition stepper9.h:230
@ STEPPER9_ERROR
Definition stepper9.h:231
Stepper 9 Click configuration object.
Definition stepper9.h:209
pin_name_t clk
Definition stepper9.h:216
uint32_t i2c_speed
Definition stepper9.h:219
pin_name_t dir
Definition stepper9.h:214
pin_name_t scl
Definition stepper9.h:210
pin_name_t en
Definition stepper9.h:213
pin_name_t int_pin
Definition stepper9.h:217
pin_name_t sda
Definition stepper9.h:211
pin_name_t rst
Definition stepper9.h:215
uint8_t i2c_address
Definition stepper9.h:220
Stepper 9 Click context object.
Definition stepper9.h:186
digital_in_t int_pin
Definition stepper9.h:194
i2c_master_t i2c
Definition stepper9.h:197
digital_out_t clk
Definition stepper9.h:191
digital_out_t en
Definition stepper9.h:188
digital_out_t rst
Definition stepper9.h:190
uint8_t slave_address
Definition stepper9.h:200
digital_out_t dir
Definition stepper9.h:189