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"
68#define ROTARYO_ONE_LED 0x0001
69#define ROTARYO_TWO_LED 0x0101
70#define ROTARYO_FOUR_LED 0x1111
71#define ROTARYO_EIGHT_LED 0x5555
72#define ROTARYO_RESET_LED 0x0000
90#define ROTARYO_MAP_MIKROBUS( cfg, mikrobus ) \
91 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
92 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
93 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
94 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
95 cfg.ecb = MIKROBUS( mikrobus, MIKROBUS_AN ); \
96 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
97 cfg.eca = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
98 cfg.sw = MIKROBUS( mikrobus, MIKROBUS_INT )
void rotaryo_turn_on_led_by_position(rotaryo_t *ctx, uint8_t led_position)
ROTARY O turn on led by position function.
uint8_t rotaryo_button_push(rotaryo_t *ctx)
Button push state.
uint8_t rotaryo_get_eca_state(rotaryo_t *ctx)
State eca pin.
void rotaryo_turn_on_led_by_data(rotaryo_t *ctx, uint16_t write_data)
ROTARY O generic data write function.
void rotaryo_reset_led(rotaryo_t *ctx)
Reset led.
void rotaryo_generic_transfer(rotaryo_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
ROTARY O data transfer function.
uint8_t rotaryo_get_ecb_state(rotaryo_t *ctx)
State ecb pin.
err_t rotaryo_init(rotaryo_t *ctx, rotaryo_cfg_t *cfg)
ROTARY O initialization function.
uint16_t rotaryo_get_led_data(uint8_t current_led_state)
Get led data state.
void rotaryo_cfg_setup(rotaryo_cfg_t *cfg)
ROTARY O configuration object setup function.
rotaryo_return_value_t
ROTARY O Click return value data.
Definition rotaryo.h:161
@ ROTARYO_ERROR
Definition rotaryo.h:163
@ ROTARYO_OK
Definition rotaryo.h:162
ROTARY O Click configuration object.
Definition rotaryo.h:133
spi_master_chip_select_polarity_t cs_polarity
Definition rotaryo.h:152
pin_name_t eca
Definition rotaryo.h:145
pin_name_t sck
Definition rotaryo.h:138
spi_master_mode_t spi_mode
Definition rotaryo.h:151
pin_name_t mosi
Definition rotaryo.h:137
uint32_t spi_speed
Definition rotaryo.h:150
pin_name_t sw
Definition rotaryo.h:146
pin_name_t miso
Definition rotaryo.h:136
pin_name_t rst
Definition rotaryo.h:144
pin_name_t cs
Definition rotaryo.h:139
pin_name_t ecb
Definition rotaryo.h:143
ROTARY O Click context object.
Definition rotaryo.h:108
digital_out_t cs
Definition rotaryo.h:112
digital_in_t eca
Definition rotaryo.h:117
spi_master_t spi
Definition rotaryo.h:122
digital_in_t ecb
Definition rotaryo.h:116
digital_in_t sw
Definition rotaryo.h:118
digital_out_t rst
Definition rotaryo.h:111
pin_name_t chip_select
Definition rotaryo.h:124