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 DCMOTOR13_REG_INPUT 0x00
74#define DCMOTOR13_REG_OUTPUT 0x01
75#define DCMOTOR13_REG_POLARITY 0x02
76#define DCMOTOR13_REG_CONFIG 0x03
94#define DCMOTOR13_LO_PIN 0x01
95#define DCMOTOR13_AI2_PIN 0x02
96#define DCMOTOR13_BI2_PIN 0x04
97#define DCMOTOR13_TA1_PIN 0x08
98#define DCMOTOR13_TA2_PIN 0x10
99#define DCMOTOR13_TB1_PIN 0x20
100#define DCMOTOR13_TB2_PIN 0x40
106#define DCMOTOR13_DEFAULT_CONFIG 0x81
112#define DCMOTOR13_PIN_LOW_LEVEL 0
113#define DCMOTOR13_PIN_HIGH_LEVEL 1
119#define DCMOTOR13_MODE_SHORT_BRAKE 0x00
120#define DCMOTOR13_MODE_CCW 0x01
121#define DCMOTOR13_MODE_CW 0x02
127#define DCMOTOR13_TORQUE_0 0x00
128#define DCMOTOR13_TORQUE_38 0x01
129#define DCMOTOR13_TORQUE_71 0x02
130#define DCMOTOR13_TORQUE_100 0x03
137#define DCMOTOR13_DEVICE_ADDRESS_A1A0_00 0x70
138#define DCMOTOR13_DEVICE_ADDRESS_A1A0_01 0x71
139#define DCMOTOR13_DEVICE_ADDRESS_A1A0_10 0x72
140#define DCMOTOR13_DEVICE_ADDRESS_A1A0_11 0x73
158#define DCMOTOR13_MAP_MIKROBUS( cfg, mikrobus ) \
159 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
160 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
161 cfg.ai1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
162 cfg.slp = MIKROBUS( mikrobus, MIKROBUS_AN ); \
163 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
164 cfg.bi1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
165 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
dcmotor13_return_value_t
DC Motor 13 Click return value data.
Definition dcmotor13.h:218
@ DCMOTOR13_ERROR
Definition dcmotor13.h:220
@ DCMOTOR13_OK
Definition dcmotor13.h:219
err_t dcmotor13_init(dcmotor13_t *ctx, dcmotor13_cfg_t *cfg)
DC Motor 13 initialization function.
err_t dcmotor13_set_outa_mode(dcmotor13_t *ctx, uint8_t mode)
DC Motor 13 set OUTA mode function.
err_t dcmotor13_set_outa_torque(dcmotor13_t *ctx, uint8_t torque)
DC Motor 13 set OUTA torque function.
err_t dcmotor13_set_outb_mode(dcmotor13_t *ctx, uint8_t mode)
DC Motor 13 set OUTB mode function.
err_t dcmotor13_set_outb_torque(dcmotor13_t *ctx, uint8_t torque)
DC Motor 13 set OUTB torque function.
void dcmotor13_disable_device(dcmotor13_t *ctx)
DC Motor 13 disable device function.
void dcmotor13_set_bi1_pin(dcmotor13_t *ctx, uint8_t state)
DC Motor 13 set BI1 pin function.
err_t dcmotor13_read_register(dcmotor13_t *ctx, uint8_t reg, uint8_t *data_out)
DC Motor 13 read register function.
void dcmotor13_reset_device(dcmotor13_t *ctx)
DC Motor 13 reset device function.
void dcmotor13_set_ai1_pin(dcmotor13_t *ctx, uint8_t state)
DC Motor 13 set AI1 pin function.
err_t dcmotor13_default_cfg(dcmotor13_t *ctx)
DC Motor 13 default configuration function.
void dcmotor13_cfg_setup(dcmotor13_cfg_t *cfg)
DC Motor 13 configuration object setup function.
err_t dcmotor13_write_register(dcmotor13_t *ctx, uint8_t reg, uint8_t data_in)
DC Motor 13 write register function.
err_t dcmotor13_get_lo_pin(dcmotor13_t *ctx, uint8_t *pin_state)
DC Motor 13 get LO pin function.
void dcmotor13_enable_device(dcmotor13_t *ctx)
DC Motor 13 enable device function.
uint8_t dcmotor13_get_int_pin(dcmotor13_t *ctx)
DC Motor 13 get int pin function.
DC Motor 13 Click configuration object.
Definition dcmotor13.h:198
pin_name_t slp
Definition dcmotor13.h:203
uint32_t i2c_speed
Definition dcmotor13.h:208
pin_name_t scl
Definition dcmotor13.h:199
pin_name_t int_pin
Definition dcmotor13.h:206
pin_name_t ai1
Definition dcmotor13.h:202
pin_name_t sda
Definition dcmotor13.h:200
pin_name_t rst
Definition dcmotor13.h:204
pin_name_t bi1
Definition dcmotor13.h:205
uint8_t i2c_address
Definition dcmotor13.h:209
DC Motor 13 Click context object.
Definition dcmotor13.h:175
digital_out_t slp
Definition dcmotor13.h:178
digital_in_t int_pin
Definition dcmotor13.h:183
i2c_master_t i2c
Definition dcmotor13.h:186
digital_out_t rst
Definition dcmotor13.h:179
uint8_t slave_address
Definition dcmotor13.h:189
digital_out_t bi1
Definition dcmotor13.h:180
digital_out_t ai1
Definition dcmotor13.h:177