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"
74#define DCMOTOR16_DIR_FORWARD 0
75#define DCMOTOR16_DIR_BACKWARD 1
77#define DCMOTOR16_ENABLE 1
78#define DCMOTOR16_DISABLE 0
87#define DCMOTOR16_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
88#define DCMOTOR16_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
106#define DCMOTOR16_MAP_MIKROBUS( cfg, mikrobus ) \
107 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
108 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
109 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
110 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
111 cfg.fwd = MIKROBUS( mikrobus, MIKROBUS_RST ); \
112 cfg.rev = MIKROBUS( mikrobus, MIKROBUS_PWM )
dcmotor16_return_value_t
DC Motor 16 Click return value data.
Definition dcmotor16.h:162
@ DCMOTOR16_OK
Definition dcmotor16.h:163
@ DCMOTOR16_ERROR
Definition dcmotor16.h:164
void dcmotor16_ctrl_rev_pin(dcmotor16_t *ctx, uint8_t state)
Control REV pin.
void dcmotor16_ctrl_fwd_pin(dcmotor16_t *ctx, uint8_t state)
Control FWD pin.
void dcmotor16_cfg_setup(dcmotor16_cfg_t *cfg)
DC Motor 16 configuration object setup function.
void dcmotor16_ctrl_vref(dcmotor16_t *ctx, uint16_t value)
Control motor VRef (speed).
void dcmotor16_set_direction(dcmotor16_t *ctx, uint8_t dir)
Set motor direction.
err_t dcmotor16_generic_read(dcmotor16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
DC Motor 16 data reading function.
err_t dcmotor16_generic_write(dcmotor16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
DC Motor 16 data writing function.
void dcmotor16_stop(dcmotor16_t *ctx)
Motor stop.
err_t dcmotor16_init(dcmotor16_t *ctx, dcmotor16_cfg_t *cfg)
DC Motor 16 initialization function.
This file contains SPI specific macros, functions, etc.
DC Motor 16 Click configuration object.
Definition dcmotor16.h:139
spi_master_chip_select_polarity_t cs_polarity
Definition dcmotor16.h:153
pin_name_t sck
Definition dcmotor16.h:143
spi_master_mode_t spi_mode
Definition dcmotor16.h:152
pin_name_t mosi
Definition dcmotor16.h:142
uint32_t spi_speed
Definition dcmotor16.h:151
pin_name_t miso
Definition dcmotor16.h:141
pin_name_t fwd
Definition dcmotor16.h:147
pin_name_t rev
Definition dcmotor16.h:148
pin_name_t cs
Definition dcmotor16.h:144
DC Motor 16 Click context object.
Definition dcmotor16.h:122
spi_master_t spi
Definition dcmotor16.h:128
pin_name_t chip_select
Definition dcmotor16.h:130
digital_out_t fwd
Definition dcmotor16.h:124
digital_out_t rev
Definition dcmotor16.h:125