28#ifndef MULTISTEPPERTB62261_H
29#define MULTISTEPPERTB62261_H
39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_i2c_master.h"
72#define MULTISTEPPERTB62261_REG_INPUT 0x00
73#define MULTISTEPPERTB62261_REG_OUTPUT 0x01
74#define MULTISTEPPERTB62261_REG_POLARITY 0x02
75#define MULTISTEPPERTB62261_REG_CONFIG 0x03
93#define MULTISTEPPERTB62261_PHASEA_PIN 0x02
94#define MULTISTEPPERTB62261_PHASEB_PIN 0x04
100#define MULTISTEPPERTB62261_DEFAULT_CONFIG 0xF9
106#define MULTISTEPPERTB62261_DIR_CW 0
107#define MULTISTEPPERTB62261_DIR_CCW 1
113#define MULTISTEPPERTB62261_PIN_LOW_LEVEL 0
114#define MULTISTEPPERTB62261_PIN_HIGH_LEVEL 1
120#define MULTISTEPPERTB62261_MODE_FULL_STEP 0x00
121#define MULTISTEPPERTB62261_MODE_HALF_STEP 0x01
122#define MULTISTEPPERTB62261_MODE_QUARTER_STEP 0x02
128#define MULTISTEPPERTB62261_SPEED_VERY_SLOW 0
129#define MULTISTEPPERTB62261_SPEED_SLOW 1
130#define MULTISTEPPERTB62261_SPEED_MEDIUM 2
131#define MULTISTEPPERTB62261_SPEED_FAST 3
132#define MULTISTEPPERTB62261_SPEED_VERY_FAST 4
139#define MULTISTEPPERTB62261_DEVICE_ADDRESS_A1A0_00 0x70
140#define MULTISTEPPERTB62261_DEVICE_ADDRESS_A1A0_01 0x71
141#define MULTISTEPPERTB62261_DEVICE_ADDRESS_A1A0_10 0x72
142#define MULTISTEPPERTB62261_DEVICE_ADDRESS_A1A0_11 0x73
160#define MULTISTEPPERTB62261_MAP_MIKROBUS( cfg, mikrobus ) \
161 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
162 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
163 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
164 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
165 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
166 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
167 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
170 // multisteppertb62261
void multisteppertb62261_cfg_setup(multisteppertb62261_cfg_t *cfg)
Multi Stepper TB62261 configuration object setup function.
void multisteppertb62261_disable_device(multisteppertb62261_t *ctx)
Multi Stepper TB62261 disable device function.
void multisteppertb62261_set_ina2_pin(multisteppertb62261_t *ctx, uint8_t state)
Multi Stepper TB62261 set ina2 pin function.
err_t multisteppertb62261_default_cfg(multisteppertb62261_t *ctx)
Multi Stepper TB62261 default configuration function.
void multisteppertb62261_enable_device(multisteppertb62261_t *ctx)
Multi Stepper TB62261 enable device function.
void multisteppertb62261_set_inb2_pin(multisteppertb62261_t *ctx, uint8_t state)
Multi Stepper TB62261 set inb2 pin function.
err_t multisteppertb62261_drive_motor(multisteppertb62261_t *ctx, uint32_t steps, uint8_t speed)
Multi Stepper TB62261 driver motor function.
void multisteppertb62261_set_direction(multisteppertb62261_t *ctx, uint8_t dir)
Multi Stepper TB62261 set direction function.
void multisteppertb62261_set_step_mode(multisteppertb62261_t *ctx, uint8_t mode)
Multi Stepper TB62261 set step mode function.
void multisteppertb62261_switch_direction(multisteppertb62261_t *ctx)
Multi Stepper TB62261 switch direction function.
void multisteppertb62261_set_ina1_pin(multisteppertb62261_t *ctx, uint8_t state)
Multi Stepper TB62261 set ina1 pin function.
err_t multisteppertb62261_write_register(multisteppertb62261_t *ctx, uint8_t reg, uint8_t data_in)
Multi Stepper TB62261 write register function.
err_t multisteppertb62261_read_register(multisteppertb62261_t *ctx, uint8_t reg, uint8_t *data_out)
Multi Stepper TB62261 read register function.
void multisteppertb62261_set_inb1_pin(multisteppertb62261_t *ctx, uint8_t state)
Multi Stepper TB62261 set inb1 pin function.
err_t multisteppertb62261_init(multisteppertb62261_t *ctx, multisteppertb62261_cfg_t *cfg)
Multi Stepper TB62261 initialization function.
multisteppertb62261_return_value_t
Multi Stepper TB62261 Click return value data.
Definition multisteppertb62261.h:221
@ MULTISTEPPERTB62261_OK
Definition multisteppertb62261.h:222
@ MULTISTEPPERTB62261_ERROR
Definition multisteppertb62261.h:223
Multi Stepper TB62261 Click configuration object.
Definition multisteppertb62261.h:201
pin_name_t clk
Definition multisteppertb62261.h:207
uint32_t i2c_speed
Definition multisteppertb62261.h:211
pin_name_t scl
Definition multisteppertb62261.h:202
pin_name_t en
Definition multisteppertb62261.h:208
pin_name_t int_pin
Definition multisteppertb62261.h:206
pin_name_t sda
Definition multisteppertb62261.h:203
pin_name_t rst
Definition multisteppertb62261.h:209
pin_name_t an
Definition multisteppertb62261.h:205
uint8_t i2c_address
Definition multisteppertb62261.h:212
Multi Stepper TB62261 Click context object.
Definition multisteppertb62261.h:177
uint8_t step_mode
Definition multisteppertb62261.h:191
i2c_master_t i2c
Definition multisteppertb62261.h:186
digital_out_t int_pin
Definition multisteppertb62261.h:180
digital_out_t clk
Definition multisteppertb62261.h:181
digital_out_t en
Definition multisteppertb62261.h:182
digital_out_t rst
Definition multisteppertb62261.h:183
uint8_t direction
Definition multisteppertb62261.h:192
uint8_t slave_address
Definition multisteppertb62261.h:189
digital_out_t an
Definition multisteppertb62261.h:179