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 ROTARYB_ONE_LED 0x0001
69#define ROTARYB_TWO_LED 0x0101
70#define ROTARYB_FOUR_LED 0x1111
71#define ROTARYB_EIGHT_LED 0x5555
72#define ROTARYB_RESET_LED 0x0000
90#define ROTARYB_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 )
uint8_t rotaryb_button_push(rotaryb_t *ctx)
Button push state.
uint8_t rotaryb_get_ecb_state(rotaryb_t *ctx)
State ecb pin.
void rotaryb_turn_on_led_by_position(rotaryb_t *ctx, uint8_t led_position)
ROTARY B turn on led by position function.
uint16_t rotaryb_get_led_data(uint8_t current_led_state)
Get led data state.
void rotaryb_turn_on_led_by_data(rotaryb_t *ctx, uint16_t write_data)
ROTARY B generic data write function.
err_t rotaryb_init(rotaryb_t *ctx, rotaryb_cfg_t *cfg)
ROTARY B initialization function.
void rotaryb_reset_led(rotaryb_t *ctx)
Reset led.
void rotaryb_generic_transfer(rotaryb_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
ROTARY B data transfer function.
void rotaryb_cfg_setup(rotaryb_cfg_t *cfg)
ROTARY B configuration object setup function.
uint8_t rotaryb_get_eca_state(rotaryb_t *ctx)
State eca pin.
rotaryb_return_value_t
ROTARY B Click return value data.
Definition rotaryb.h:161
@ ROTARYB_OK
Definition rotaryb.h:162
@ ROTARYB_ERROR
Definition rotaryb.h:163
ROTARY B Click configuration object.
Definition rotaryb.h:133
spi_master_chip_select_polarity_t cs_polarity
Definition rotaryb.h:152
pin_name_t eca
Definition rotaryb.h:145
pin_name_t sck
Definition rotaryb.h:138
spi_master_mode_t spi_mode
Definition rotaryb.h:151
pin_name_t mosi
Definition rotaryb.h:137
uint32_t spi_speed
Definition rotaryb.h:150
pin_name_t sw
Definition rotaryb.h:146
pin_name_t miso
Definition rotaryb.h:136
pin_name_t rst
Definition rotaryb.h:144
pin_name_t cs
Definition rotaryb.h:139
pin_name_t ecb
Definition rotaryb.h:143
ROTARY B Click context object.
Definition rotaryb.h:108
digital_out_t cs
Definition rotaryb.h:112
digital_in_t eca
Definition rotaryb.h:117
spi_master_t spi
Definition rotaryb.h:122
digital_in_t ecb
Definition rotaryb.h:116
digital_in_t sw
Definition rotaryb.h:118
digital_out_t rst
Definition rotaryb.h:111
pin_name_t chip_select
Definition rotaryb.h:124