28#ifndef MULTISTEPPERTB67S209_H
29#define MULTISTEPPERTB67S209_H
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 MULTISTEPPERTB67S209_REG_INPUT 0x00
74#define MULTISTEPPERTB67S209_REG_OUTPUT 0x01
75#define MULTISTEPPERTB67S209_REG_POLARITY 0x02
76#define MULTISTEPPERTB67S209_REG_CONFIG 0x03
94#define MULTISTEPPERTB67S209_DMODE0_PIN 0x01
95#define MULTISTEPPERTB67S209_DMODE1_PIN 0x02
96#define MULTISTEPPERTB67S209_DMODE2_PIN 0x04
97#define MULTISTEPPERTB67S209_SMD1_PIN 0x10
98#define MULTISTEPPERTB67S209_SMD0_PIN 0x20
99#define MULTISTEPPERTB67S209_MO_PIN 0x40
100#define MULTISTEPPERTB67S209_LO_PIN 0x80
106#define MULTISTEPPERTB67S209_DEFAULT_CONFIG 0xC8
112#define MULTISTEPPERTB67S209_DIR_CW 0
113#define MULTISTEPPERTB67S209_DIR_CCW 1
119#define MULTISTEPPERTB67S209_PIN_LOW_LEVEL 0
120#define MULTISTEPPERTB67S209_PIN_HIGH_LEVEL 1
126#define MULTISTEPPERTB67S209_MODE_STANDBY 0x00
127#define MULTISTEPPERTB67S209_MODE_HALF_STEP_TYPE_B 0x01
128#define MULTISTEPPERTB67S209_MODE_HALF_STEP_TYPE_A 0x02
129#define MULTISTEPPERTB67S209_MODE_1_OVER_16 0x03
130#define MULTISTEPPERTB67S209_MODE_FULL_STEP 0x04
131#define MULTISTEPPERTB67S209_MODE_1_OVER_8 0x05
132#define MULTISTEPPERTB67S209_MODE_QUARTER_STEP 0x06
133#define MULTISTEPPERTB67S209_MODE_1_OVER_32 0x07
134#define MULTISTEPPERTB67S209_MODE_BITS_MASK 0x07
140#define MULTISTEPPERTB67S209_SMD_MODE_FD_12p5_PERCENT 0x00
141#define MULTISTEPPERTB67S209_SMD_MODE_FD_37p5_PERCENT 0x01
142#define MULTISTEPPERTB67S209_SMD_MODE_FD_50_PERCENT 0x02
143#define MULTISTEPPERTB67S209_SMD_MODE_FD_ONLY 0x03
144#define MULTISTEPPERTB67S209_SMD_MODE_BITS_MASK 0x30
150#define MULTISTEPPERTB67S209_SPEED_VERY_SLOW 0
151#define MULTISTEPPERTB67S209_SPEED_SLOW 1
152#define MULTISTEPPERTB67S209_SPEED_MEDIUM 2
153#define MULTISTEPPERTB67S209_SPEED_FAST 3
154#define MULTISTEPPERTB67S209_SPEED_VERY_FAST 4
161#define MULTISTEPPERTB67S209_DEVICE_ADDRESS_A1A0_00 0x70
162#define MULTISTEPPERTB67S209_DEVICE_ADDRESS_A1A0_01 0x71
163#define MULTISTEPPERTB67S209_DEVICE_ADDRESS_A1A0_10 0x72
164#define MULTISTEPPERTB67S209_DEVICE_ADDRESS_A1A0_11 0x73
182#define MULTISTEPPERTB67S209_MAP_MIKROBUS( cfg, mikrobus ) \
183 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
184 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
185 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
186 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
187 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
188 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
189 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
192 // multisteppertb67s209
void multisteppertb67s209_set_clk_pin(multisteppertb67s209_t *ctx, uint8_t state)
Multi Stepper TB67S209 set clk pin function.
err_t multisteppertb67s209_set_step_mode(multisteppertb67s209_t *ctx, uint8_t mode)
Multi Stepper TB67S209 set step mode function.
void multisteppertb67s209_cfg_setup(multisteppertb67s209_cfg_t *cfg)
Multi Stepper TB67S209 configuration object setup function.
err_t multisteppertb67s209_get_smd_mode(multisteppertb67s209_t *ctx, uint8_t *mode)
Multi Stepper TB67S209 get smd mode function.
void multisteppertb67s209_reset_device(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 reset device function.
void multisteppertb67s209_set_direction(multisteppertb67s209_t *ctx, uint8_t dir)
Multi Stepper TB67S209 set direction function.
err_t multisteppertb67s209_init(multisteppertb67s209_t *ctx, multisteppertb67s209_cfg_t *cfg)
Multi Stepper TB67S209 initialization function.
err_t multisteppertb67s209_default_cfg(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 default configuration function.
err_t multisteppertb67s209_write_register(multisteppertb67s209_t *ctx, uint8_t reg, uint8_t data_in)
Multi Stepper TB67S209 write register function.
err_t multisteppertb67s209_read_register(multisteppertb67s209_t *ctx, uint8_t reg, uint8_t *data_out)
Multi Stepper TB67S209 read register function.
err_t multisteppertb67s209_set_smd_mode(multisteppertb67s209_t *ctx, uint8_t mode)
Multi Stepper TB67S209 set smd mode function.
void multisteppertb67s209_drive_motor(multisteppertb67s209_t *ctx, uint32_t steps, uint8_t speed)
Multi Stepper TB67S209 driver motor function.
void multisteppertb67s209_switch_direction(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 switch direction function.
err_t multisteppertb67s209_get_step_mode(multisteppertb67s209_t *ctx, uint8_t *mode)
Multi Stepper TB67S209 get step mode function.
void multisteppertb67s209_enable_device(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 enable device function.
uint8_t multisteppertb67s209_get_int_pin(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 get int pin function.
void multisteppertb67s209_disable_device(multisteppertb67s209_t *ctx)
Multi Stepper TB67S209 disable device function.
multisteppertb67s209_return_value_t
Multi Stepper TB67S209 Click return value data.
Definition multisteppertb67s209.h:242
@ MULTISTEPPERTB67S209_OK
Definition multisteppertb67s209.h:243
@ MULTISTEPPERTB67S209_ERROR
Definition multisteppertb67s209.h:244
Multi Stepper TB67S209 Click configuration object.
Definition multisteppertb67s209.h:222
pin_name_t clk
Definition multisteppertb67s209.h:229
uint32_t i2c_speed
Definition multisteppertb67s209.h:232
pin_name_t scl
Definition multisteppertb67s209.h:223
pin_name_t en
Definition multisteppertb67s209.h:226
pin_name_t int_pin
Definition multisteppertb67s209.h:230
pin_name_t sda
Definition multisteppertb67s209.h:224
pin_name_t rst
Definition multisteppertb67s209.h:228
pin_name_t an
Definition multisteppertb67s209.h:227
uint8_t i2c_address
Definition multisteppertb67s209.h:233
Multi Stepper TB67S209 Click context object.
Definition multisteppertb67s209.h:199
digital_in_t int_pin
Definition multisteppertb67s209.h:207
i2c_master_t i2c
Definition multisteppertb67s209.h:210
digital_out_t clk
Definition multisteppertb67s209.h:204
digital_out_t en
Definition multisteppertb67s209.h:201
digital_out_t rst
Definition multisteppertb67s209.h:203
uint8_t slave_address
Definition multisteppertb67s209.h:213
digital_out_t an
Definition multisteppertb67s209.h:202