Go to the documentation of this file.
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 ROTARYW2_SET_LED_OFF 0x0000u
75 #define ROTARYW2_SET_LED_DATA_1 0x0001u
76 #define ROTARYW2_SET_LED_DATA_2 0x0002u
77 #define ROTARYW2_SET_LED_DATA_3 0x0004u
78 #define ROTARYW2_SET_LED_DATA_4 0x0008u
79 #define ROTARYW2_SET_LED_DATA_5 0x0010u
80 #define ROTARYW2_SET_LED_DATA_6 0x0020u
81 #define ROTARYW2_SET_LED_DATA_7 0x0040u
82 #define ROTARYW2_SET_LED_DATA_8 0x0080u
83 #define ROTARYW2_SET_LED_DATA_9 0x0100u
84 #define ROTARYW2_SET_LED_DATA_10 0x0200u
85 #define ROTARYW2_SET_LED_DATA_11 0x0400u
86 #define ROTARYW2_SET_LED_DATA_12 0x0800u
87 #define ROTARYW2_SET_LED_DATA_13 0x1000u
88 #define ROTARYW2_SET_LED_DATA_14 0x2000u
89 #define ROTARYW2_SET_LED_DATA_15 0x4000u
90 #define ROTARYW2_SET_LED_DATA_16 0x8000u
96 #define ROTARYW2_SET_LED_POS_1 1
97 #define ROTARYW2_SET_LED_POS_2 2
98 #define ROTARYW2_SET_LED_POS_3 3
99 #define ROTARYW2_SET_LED_POS_4 4
100 #define ROTARYW2_SET_LED_POS_5 5
101 #define ROTARYW2_SET_LED_POS_6 6
102 #define ROTARYW2_SET_LED_POS_7 7
103 #define ROTARYW2_SET_LED_POS_8 8
104 #define ROTARYW2_SET_LED_POS_9 9
105 #define ROTARYW2_SET_LED_POS_10 10
106 #define ROTARYW2_SET_LED_POS_11 11
107 #define ROTARYW2_SET_LED_POS_12 12
108 #define ROTARYW2_SET_LED_POS_13 13
109 #define ROTARYW2_SET_LED_POS_14 14
110 #define ROTARYW2_SET_LED_POS_15 15
111 #define ROTARYW2_SET_LED_POS_16 16
121 #define ROTARYW2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
122 #define ROTARYW2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
140 #define ROTARYW2_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 rotaryw2_set_led_data(rotaryw2_t *ctx, uint16_t data_in)
Rotary W 2 set LED data function.
spi_master_chip_select_polarity_t cs_polarity
Definition: rotaryw2.h:190
pin_name_t sw
Definition: rotaryw2.h:185
uint8_t rotaryw2_get_state_ena(rotaryw2_t *ctx)
Rotary W 2 get ena state function.
digital_in_t sw
Definition: rotaryw2.h:161
Rotary W 2 Click configuration object.
Definition: rotaryw2.h:175
rotaryw2_return_value_t
Rotary W 2 Click return value data.
Definition: rotaryw2.h:199
Rotary W 2 Click context object.
Definition: rotaryw2.h:157
digital_in_t enb
Definition: rotaryw2.h:159
pin_name_t mosi
Definition: rotaryw2.h:178
This file contains SPI specific macros, functions, etc.
uint8_t rotaryw2_get_state_enb(rotaryw2_t *ctx)
Rotary W 2 get enb state function.
@ ROTARYW2_OK
Definition: rotaryw2.h:200
void rotaryw2_cfg_setup(rotaryw2_cfg_t *cfg)
Rotary W 2 configuration object setup function.
pin_name_t enb
Definition: rotaryw2.h:183
spi_master_t spi
Definition: rotaryw2.h:164
err_t rotaryw2_set_led_pos(rotaryw2_t *ctx, uint8_t led_pos)
Rotary W 2 set LED position function.
digital_in_t ena
Definition: rotaryw2.h:160
err_t rotaryw2_get_led_data(rotaryw2_t *ctx, uint16_t *data_out)
Rotary W 2 get LED data function.
uint32_t spi_speed
Definition: rotaryw2.h:188
pin_name_t chip_select
Definition: rotaryw2.h:166
pin_name_t miso
Definition: rotaryw2.h:177
@ ROTARYW2_ERROR
Definition: rotaryw2.h:201
err_t rotaryw2_default_cfg(rotaryw2_t *ctx)
Rotary W 2 default configuration function.
pin_name_t cs
Definition: rotaryw2.h:180
pin_name_t sck
Definition: rotaryw2.h:179
spi_master_mode_t spi_mode
Definition: rotaryw2.h:189
err_t rotaryw2_init(rotaryw2_t *ctx, rotaryw2_cfg_t *cfg)
Rotary W 2 initialization function.
uint8_t rotaryw2_get_state_switch(rotaryw2_t *ctx)
Rotary W 2 get switch state function.
pin_name_t ena
Definition: rotaryw2.h:184