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 ROTARYO2_SET_LED_OFF 0x0000u
75#define ROTARYO2_SET_LED_DATA_1 0x0001u
76#define ROTARYO2_SET_LED_DATA_2 0x0002u
77#define ROTARYO2_SET_LED_DATA_3 0x0004u
78#define ROTARYO2_SET_LED_DATA_4 0x0008u
79#define ROTARYO2_SET_LED_DATA_5 0x0010u
80#define ROTARYO2_SET_LED_DATA_6 0x0020u
81#define ROTARYO2_SET_LED_DATA_7 0x0040u
82#define ROTARYO2_SET_LED_DATA_8 0x0080u
83#define ROTARYO2_SET_LED_DATA_9 0x0100u
84#define ROTARYO2_SET_LED_DATA_10 0x0200u
85#define ROTARYO2_SET_LED_DATA_11 0x0400u
86#define ROTARYO2_SET_LED_DATA_12 0x0800u
87#define ROTARYO2_SET_LED_DATA_13 0x1000u
88#define ROTARYO2_SET_LED_DATA_14 0x2000u
89#define ROTARYO2_SET_LED_DATA_15 0x4000u
90#define ROTARYO2_SET_LED_DATA_16 0x8000u
96#define ROTARYO2_SET_LED_POS_1 1
97#define ROTARYO2_SET_LED_POS_2 2
98#define ROTARYO2_SET_LED_POS_3 3
99#define ROTARYO2_SET_LED_POS_4 4
100#define ROTARYO2_SET_LED_POS_5 5
101#define ROTARYO2_SET_LED_POS_6 6
102#define ROTARYO2_SET_LED_POS_7 7
103#define ROTARYO2_SET_LED_POS_8 8
104#define ROTARYO2_SET_LED_POS_9 9
105#define ROTARYO2_SET_LED_POS_10 10
106#define ROTARYO2_SET_LED_POS_11 11
107#define ROTARYO2_SET_LED_POS_12 12
108#define ROTARYO2_SET_LED_POS_13 13
109#define ROTARYO2_SET_LED_POS_14 14
110#define ROTARYO2_SET_LED_POS_15 15
111#define ROTARYO2_SET_LED_POS_16 16
121#define ROTARYO2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
122#define ROTARYO2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
140#define ROTARYO2_MAP_MIKROBUS( cfg, mikrobus ) \
141 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
142 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
143 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
144 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
145 cfg.enb = MIKROBUS( mikrobus, MIKROBUS_AN ); \
146 cfg.ena = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
147 cfg.sw = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t rotaryo2_set_led_data(rotaryo2_t *ctx, uint16_t data_in)
Rotary O 2 set LED data function.
err_t rotaryo2_default_cfg(rotaryo2_t *ctx)
Rotary O 2 default configuration function.
uint8_t rotaryo2_get_state_enb(rotaryo2_t *ctx)
Rotary O 2 get enb state function.
err_t rotaryo2_get_led_data(rotaryo2_t *ctx, uint16_t *data_out)
Rotary O 2 get LED data function.
void rotaryo2_cfg_setup(rotaryo2_cfg_t *cfg)
Rotary O 2 configuration object setup function.
uint8_t rotaryo2_get_state_ena(rotaryo2_t *ctx)
Rotary O 2 get ena state function.
err_t rotaryo2_init(rotaryo2_t *ctx, rotaryo2_cfg_t *cfg)
Rotary O 2 initialization function.
uint8_t rotaryo2_get_state_switch(rotaryo2_t *ctx)
Rotary O 2 get switch state function.
err_t rotaryo2_set_led_pos(rotaryo2_t *ctx, uint8_t led_pos)
Rotary O 2 set LED position function.
rotaryo2_return_value_t
Rotary O 2 Click return value data.
Definition rotaryo2.h:199
@ ROTARYO2_ERROR
Definition rotaryo2.h:201
@ ROTARYO2_OK
Definition rotaryo2.h:200
This file contains SPI specific macros, functions, etc.
Rotary O 2 Click configuration object.
Definition rotaryo2.h:175
pin_name_t ena
Definition rotaryo2.h:184
spi_master_chip_select_polarity_t cs_polarity
Definition rotaryo2.h:190
pin_name_t sck
Definition rotaryo2.h:179
spi_master_mode_t spi_mode
Definition rotaryo2.h:189
pin_name_t enb
Definition rotaryo2.h:183
pin_name_t mosi
Definition rotaryo2.h:178
uint32_t spi_speed
Definition rotaryo2.h:188
pin_name_t sw
Definition rotaryo2.h:185
pin_name_t miso
Definition rotaryo2.h:177
pin_name_t cs
Definition rotaryo2.h:180
Rotary O 2 Click context object.
Definition rotaryo2.h:157
spi_master_t spi
Definition rotaryo2.h:164
digital_in_t enb
Definition rotaryo2.h:159
digital_in_t ena
Definition rotaryo2.h:160
digital_in_t sw
Definition rotaryo2.h:161
pin_name_t chip_select
Definition rotaryo2.h:166