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 DCMOTOR23_REG_INPUT 0x00
74#define DCMOTOR23_REG_OUTPUT 0x01
75#define DCMOTOR23_REG_POLARITY 0x02
76#define DCMOTOR23_REG_CONFIG 0x03
98#define DCMOTOR23_LO_PIN 0x01
99#define DCMOTOR23_PHASE_A_PIN 0x02
100#define DCMOTOR23_PHASE_B_PIN 0x04
101#define DCMOTOR23_TRQ_A1_PIN 0x08
102#define DCMOTOR23_TRQ_A2_PIN 0x10
103#define DCMOTOR23_TRQ_B1_PIN 0x20
104#define DCMOTOR23_TRQ_B2_PIN 0x40
110#define DCMOTOR23_DEFAULT_CONFIG 0x01
116#define DCMOTOR23_PIN_LOW_LEVEL 0
117#define DCMOTOR23_PIN_HIGH_LEVEL 1
123#define DCMOTOR23_MODE_DECAY 0x00
124#define DCMOTOR23_MODE_CCW 0x01
125#define DCMOTOR23_MODE_CW 0x02
131#define DCMOTOR23_TORQUE_0 0x00
132#define DCMOTOR23_TORQUE_38 0x01
133#define DCMOTOR23_TORQUE_71 0x02
134#define DCMOTOR23_TORQUE_100 0x03
140#define DCMOTOR23_SEL_OUT_A 0x00
141#define DCMOTOR23_SEL_OUT_B 0x01
148#define DCMOTOR23_DEVICE_ADDRESS_0 0x70
149#define DCMOTOR23_DEVICE_ADDRESS_1 0x71
150#define DCMOTOR23_DEVICE_ADDRESS_2 0x72
151#define DCMOTOR23_DEVICE_ADDRESS_3 0x73
169#define DCMOTOR23_MAP_MIKROBUS( cfg, mikrobus ) \
170 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
171 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
172 cfg.en_a = MIKROBUS( mikrobus, MIKROBUS_CS ); \
173 cfg.slp = MIKROBUS( mikrobus, MIKROBUS_AN ); \
174 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
175 cfg.en_b = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
176 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
dcmotor23_return_value_t
DC Motor 23 Click return value data.
Definition dcmotor23.h:230
@ DCMOTOR23_ERROR
Definition dcmotor23.h:232
@ DCMOTOR23_OK
Definition dcmotor23.h:231
void dcmotor23_sleep_mode(dcmotor23_t *ctx)
DC Motor 23 set sleep operation mode function.
err_t dcmotor23_default_cfg(dcmotor23_t *ctx)
DC Motor 23 default configuration function.
err_t dcmotor23_set_counter_clockwise(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set counter clockwise function.
err_t dcmotor23_set_output_mode(dcmotor23_t *ctx, uint8_t mode, uint8_t sel_motor)
DC Motor 23 set output mode function.
void dcmotor23_set_en_b_pin(dcmotor23_t *ctx, uint8_t state)
DC Motor 23 set EN_B pin function.
err_t dcmotor23_write_register(dcmotor23_t *ctx, uint8_t reg, uint8_t data_in)
DC Motor 23 I2C writing function.
err_t dcmotor23_set_clockwise(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set clockwise function.
err_t dcmotor23_get_lo_pin(dcmotor23_t *ctx, uint8_t *pin_state)
DC Motor 23 get LO pin function.
err_t dcmotor23_read_register(dcmotor23_t *ctx, uint8_t reg, uint8_t *data_out)
DC Motor 23 I2C reading function.
void dcmotor23_reset_device(dcmotor23_t *ctx)
DC Motor 23 reset device function.
void dcmotor23_cfg_setup(dcmotor23_cfg_t *cfg)
DC Motor 23 configuration object setup function.
void dcmotor23_normal_operation_mode(dcmotor23_t *ctx)
DC Motor 23 set normal operation mode function.
err_t dcmotor23_set_outb_torque(dcmotor23_t *ctx, uint8_t torque)
DC Motor 23 set OUTB torque function.
err_t dcmotor23_set_outa_torque(dcmotor23_t *ctx, uint8_t torque)
DC Motor 23 set OUTA torque function.
uint8_t dcmotor23_get_int_pin(dcmotor23_t *ctx)
DC Motor 23 get INT pin function.
err_t dcmotor23_init(dcmotor23_t *ctx, dcmotor23_cfg_t *cfg)
DC Motor 23 initialization function.
err_t dcmotor23_set_decay(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set decay function.
void dcmotor23_set_en_a_pin(dcmotor23_t *ctx, uint8_t state)
DC Motor 23 set EN_A pin function.
DC Motor 23 Click configuration object.
Definition dcmotor23.h:210
pin_name_t slp
Definition dcmotor23.h:215
uint32_t i2c_speed
Definition dcmotor23.h:220
pin_name_t en_b
Definition dcmotor23.h:217
pin_name_t en_a
Definition dcmotor23.h:214
pin_name_t scl
Definition dcmotor23.h:211
pin_name_t int_pin
Definition dcmotor23.h:218
pin_name_t sda
Definition dcmotor23.h:212
pin_name_t rst
Definition dcmotor23.h:216
uint8_t i2c_address
Definition dcmotor23.h:221
DC Motor 23 Click context object.
Definition dcmotor23.h:186
digital_out_t en_a
Definition dcmotor23.h:188
digital_out_t slp
Definition dcmotor23.h:189
digital_in_t int_pin
Definition dcmotor23.h:195
i2c_master_t i2c
Definition dcmotor23.h:198
digital_out_t rst
Definition dcmotor23.h:190
uint8_t slave_address
Definition dcmotor23.h:201
digital_out_t en_b
Definition dcmotor23.h:191