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_spi_master.h"
75#define DCMOTOR24_CFG_DR 0x0002u
76#define DCMOTOR24_CFG_CL_2p5A 0x0000u
77#define DCMOTOR24_CFG_CL_4A 0x0004u
78#define DCMOTOR24_CFG_CL_6p6A 0x0008u
79#define DCMOTOR24_CFG_CL_8p6A 0x000Cu
80#define DCMOTOR24_CFG_CL_MASK 0x000Cu
81#define DCMOTOR24_CFG_VSR 0x0100u
82#define DCMOTOR24_CFG_ISR 0x0200u
83#define DCMOTOR24_CFG_ISR_DIS 0x0400u
84#define DCMOTOR24_CFG_OL_ON 0x0800u
90#define DCMOTOR24_DIA_OL_OFF 0x0001u
91#define DCMOTOR24_DIA_OL_ON 0x0002u
92#define DCMOTOR24_DIA_VS_UV 0x0004u
93#define DCMOTOR24_DIA_VDD_OV 0x0008u
94#define DCMOTOR24_DIA_ILIM 0x0010u
95#define DCMOTOR24_DIA_TWARN 0x0020u
96#define DCMOTOR24_DIA_TSD 0x0040u
97#define DCMOTOR24_DIA_ACT 0x0080u
98#define DCMOTOR24_DIA_OC_LS1 0x0100u
99#define DCMOTOR24_DIA_OC_LS2 0x0200u
100#define DCMOTOR24_DIA_OC_HS1 0x0400u
101#define DCMOTOR24_DIA_OC_HS2 0x0800u
102#define DCMOTOR24_DIA_SGND_OFF 0x4000u
103#define DCMOTOR24_DIA_SBAT_OFF 0x8000u
109#define DCMOTOR24_DIR_REVERSE 0
110#define DCMOTOR24_DIR_FORWARD 1
116#define DCMOTOR24_DEF_FREQ 5000
126#define DCMOTOR24_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
127#define DCMOTOR24_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
145#define DCMOTOR24_MAP_MIKROBUS( cfg, mikrobus ) \
146 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
147 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
148 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
149 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
150 cfg.dir = MIKROBUS( mikrobus, MIKROBUS_AN ); \
151 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
152 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM );
dcmotor24_return_value_t
DC Motor 24 Click return value data.
Definition dcmotor24.h:208
@ DCMOTOR24_ERROR
Definition dcmotor24.h:210
@ DCMOTOR24_OK
Definition dcmotor24.h:209
err_t dcmotor24_read_diag(dcmotor24_t *ctx, uint16_t *diag)
DC Motor 24 read diag function.
void dcmotor24_enable_output(dcmotor24_t *ctx)
DC Motor 24 enable output function.
err_t dcmotor24_init(dcmotor24_t *ctx, dcmotor24_cfg_t *cfg)
DC Motor 24 initialization function.
void dcmotor24_set_direction(dcmotor24_t *ctx, uint8_t dir)
DC Motor 24 set direction function.
err_t dcmotor24_pwm_stop(dcmotor24_t *ctx)
DC Motor 24 stop PWM module.
void dcmotor24_disable_output(dcmotor24_t *ctx)
DC Motor 24 disable output function.
err_t dcmotor24_set_duty_cycle(dcmotor24_t *ctx, float duty_cycle)
DC Motor 24 sets PWM duty cycle.
void dcmotor24_cfg_setup(dcmotor24_cfg_t *cfg)
DC Motor 24 configuration object setup function.
err_t dcmotor24_pwm_start(dcmotor24_t *ctx)
DC Motor 24 start PWM module.
err_t dcmotor24_default_cfg(dcmotor24_t *ctx)
DC Motor 24 default configuration function.
void dcmotor24_switch_direction(dcmotor24_t *ctx)
DC Motor 24 switch direction function.
err_t dcmotor24_write_config(dcmotor24_t *ctx, uint16_t config_word)
DC Motor 24 write config function.
This file contains SPI specific macros, functions, etc.
DC Motor 24 Click configuration object.
Definition dcmotor24.h:183
spi_master_chip_select_polarity_t cs_polarity
Definition dcmotor24.h:198
pin_name_t sck
Definition dcmotor24.h:187
spi_master_mode_t spi_mode
Definition dcmotor24.h:197
pin_name_t mosi
Definition dcmotor24.h:186
uint32_t spi_speed
Definition dcmotor24.h:196
uint32_t dev_pwm_freq
Definition dcmotor24.h:199
pin_name_t dir
Definition dcmotor24.h:192
pin_name_t en
Definition dcmotor24.h:193
pin_name_t pwm
Definition dcmotor24.h:189
pin_name_t miso
Definition dcmotor24.h:185
pin_name_t cs
Definition dcmotor24.h:188
DC Motor 24 Click context object.
Definition dcmotor24.h:162
spi_master_t spi
Definition dcmotor24.h:168
uint16_t config_word
Definition dcmotor24.h:174
uint32_t pwm_freq
Definition dcmotor24.h:172
digital_out_t en
Definition dcmotor24.h:165
pin_name_t chip_select
Definition dcmotor24.h:171
pwm_t pwm
Definition dcmotor24.h:169
digital_out_t dir
Definition dcmotor24.h:164