28#ifndef MULTISTEPPERTB62262_H
29#define MULTISTEPPERTB62262_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 MULTISTEPPERTB62262_REG_INPUT 0x00
74#define MULTISTEPPERTB62262_REG_OUTPUT 0x01
75#define MULTISTEPPERTB62262_REG_POLARITY 0x02
76#define MULTISTEPPERTB62262_REG_CONFIG 0x03
94#define MULTISTEPPERTB62262_DMODE1_PIN 0x02
95#define MULTISTEPPERTB62262_DMODE2_PIN 0x04
96#define MULTISTEPPERTB62262_MO_PIN 0x40
102#define MULTISTEPPERTB62262_DEFAULT_CONFIG 0xF9
108#define MULTISTEPPERTB62262_DIR_CW 0
109#define MULTISTEPPERTB62262_DIR_CCW 1
115#define MULTISTEPPERTB62262_PIN_LOW_LEVEL 0
116#define MULTISTEPPERTB62262_PIN_HIGH_LEVEL 1
122#define MULTISTEPPERTB62262_MODE_STANDBY 0x00
123#define MULTISTEPPERTB62262_MODE_HALF_STEP_TYPE_A 0x02
124#define MULTISTEPPERTB62262_MODE_FULL_STEP 0x04
125#define MULTISTEPPERTB62262_MODE_QUARTER_STEP 0x06
126#define MULTISTEPPERTB62262_MODE_BITS_MASK 0x06
132#define MULTISTEPPERTB62262_SPEED_VERY_SLOW 0
133#define MULTISTEPPERTB62262_SPEED_SLOW 1
134#define MULTISTEPPERTB62262_SPEED_MEDIUM 2
135#define MULTISTEPPERTB62262_SPEED_FAST 3
136#define MULTISTEPPERTB62262_SPEED_VERY_FAST 4
143#define MULTISTEPPERTB62262_DEVICE_ADDRESS_A1A0_00 0x70
144#define MULTISTEPPERTB62262_DEVICE_ADDRESS_A1A0_01 0x71
145#define MULTISTEPPERTB62262_DEVICE_ADDRESS_A1A0_10 0x72
146#define MULTISTEPPERTB62262_DEVICE_ADDRESS_A1A0_11 0x73
164#define MULTISTEPPERTB62262_MAP_MIKROBUS( cfg, mikrobus ) \
165 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
166 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
167 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
168 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
169 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
170 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
171 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
174 // multisteppertb62262
void multisteppertb62262_enable_device(multisteppertb62262_t *ctx)
Multi Stepper TB62262 enable device function.
void multisteppertb62262_set_direction(multisteppertb62262_t *ctx, uint8_t dir)
Multi Stepper TB62262 set direction function.
err_t multisteppertb62262_init(multisteppertb62262_t *ctx, multisteppertb62262_cfg_t *cfg)
Multi Stepper TB62262 initialization function.
void multisteppertb62262_reset_device(multisteppertb62262_t *ctx)
Multi Stepper TB62262 reset device function.
err_t multisteppertb62262_read_register(multisteppertb62262_t *ctx, uint8_t reg, uint8_t *data_out)
Multi Stepper TB62262 read register function.
void multisteppertb62262_drive_motor(multisteppertb62262_t *ctx, uint32_t steps, uint8_t speed)
Multi Stepper TB62262 driver motor function.
void multisteppertb62262_disable_device(multisteppertb62262_t *ctx)
Multi Stepper TB62262 disable device function.
void multisteppertb62262_cfg_setup(multisteppertb62262_cfg_t *cfg)
Multi Stepper TB62262 configuration object setup function.
void multisteppertb62262_switch_direction(multisteppertb62262_t *ctx)
Multi Stepper TB62262 switch direction function.
err_t multisteppertb62262_write_register(multisteppertb62262_t *ctx, uint8_t reg, uint8_t data_in)
Multi Stepper TB62262 write register function.
uint8_t multisteppertb62262_get_int_pin(multisteppertb62262_t *ctx)
Multi Stepper TB62262 get int pin function.
err_t multisteppertb62262_default_cfg(multisteppertb62262_t *ctx)
Multi Stepper TB62262 default configuration function.
err_t multisteppertb62262_set_step_mode(multisteppertb62262_t *ctx, uint8_t mode)
Multi Stepper TB62262 set step mode function.
err_t multisteppertb62262_get_step_mode(multisteppertb62262_t *ctx, uint8_t *mode)
Multi Stepper TB62262 get step mode function.
void multisteppertb62262_set_clk_pin(multisteppertb62262_t *ctx, uint8_t state)
Multi Stepper TB62262 set clk pin function.
multisteppertb62262_return_value_t
Multi Stepper TB62262 Click return value data.
Definition multisteppertb62262.h:224
@ MULTISTEPPERTB62262_ERROR
Definition multisteppertb62262.h:226
@ MULTISTEPPERTB62262_OK
Definition multisteppertb62262.h:225
Multi Stepper TB62262 Click configuration object.
Definition multisteppertb62262.h:204
pin_name_t clk
Definition multisteppertb62262.h:211
uint32_t i2c_speed
Definition multisteppertb62262.h:214
pin_name_t scl
Definition multisteppertb62262.h:205
pin_name_t en
Definition multisteppertb62262.h:208
pin_name_t int_pin
Definition multisteppertb62262.h:212
pin_name_t sda
Definition multisteppertb62262.h:206
pin_name_t rst
Definition multisteppertb62262.h:210
pin_name_t an
Definition multisteppertb62262.h:209
uint8_t i2c_address
Definition multisteppertb62262.h:215
Multi Stepper TB62262 Click context object.
Definition multisteppertb62262.h:181
digital_in_t int_pin
Definition multisteppertb62262.h:189
i2c_master_t i2c
Definition multisteppertb62262.h:192
digital_out_t clk
Definition multisteppertb62262.h:186
digital_out_t en
Definition multisteppertb62262.h:183
digital_out_t rst
Definition multisteppertb62262.h:185
uint8_t slave_address
Definition multisteppertb62262.h:195
digital_out_t an
Definition multisteppertb62262.h:184