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_i2c_master.h"
74#define LEDRING2_REG_CHIP_EN 0x0000
75#define LEDRING2_REG_DEV_INITIAL 0x0001
76#define LEDRING2_REG_DEV_CONFIG1 0x0002
77#define LEDRING2_REG_DEV_CONFIG2 0x0003
78#define LEDRING2_REG_DEV_CONFIG3 0x0004
79#define LEDRING2_REG_GLOBAL_BRI 0x0005
80#define LEDRING2_REG_GROUP0_BRI 0x0006
81#define LEDRING2_REG_GROUP1_BRI 0x0007
82#define LEDRING2_REG_GROUP2_BRI 0x0008
83#define LEDRING2_REG_R_CURRENT_SET 0x0009
84#define LEDRING2_REG_G_CURRENT_SET 0x000A
85#define LEDRING2_REG_B_CURRENT_SET 0x000B
86#define LEDRING2_REG_DOT_GRP_SEL0 0x000C
87#define LEDRING2_REG_DOT_GRP_SEL1 0x000D
88#define LEDRING2_REG_DOT_GRP_SEL2 0x000E
89#define LEDRING2_REG_DOT_GRP_SEL3 0x000F
90#define LEDRING2_REG_DOT_GRP_SEL4 0x0010
91#define LEDRING2_REG_DOT_GRP_SEL5 0x0011
92#define LEDRING2_REG_DOT_GRP_SEL6 0x0012
93#define LEDRING2_REG_DOT_GRP_SEL7 0x0013
94#define LEDRING2_REG_DOT_GRP_SEL8 0x0014
95#define LEDRING2_REG_DOT_GRP_SEL9 0x0015
96#define LEDRING2_REG_DOT_ONOFF0 0x0043
97#define LEDRING2_REG_DOT_ONOFF1 0x0044
98#define LEDRING2_REG_DOT_ONOFF2 0x0045
99#define LEDRING2_REG_DOT_ONOFF3 0x0046
100#define LEDRING2_REG_DOT_ONOFF4 0x0047
101#define LEDRING2_REG_DOT_ONOFF5 0x0048
102#define LEDRING2_REG_FAULT_STATE 0x0064
103#define LEDRING2_REG_DOT_LOD0 0x0065
104#define LEDRING2_REG_DOT_LOD1 0x0066
105#define LEDRING2_REG_DOT_LOD2 0x0067
106#define LEDRING2_REG_DOT_LOD3 0x0068
107#define LEDRING2_REG_DOT_LOD4 0x0069
108#define LEDRING2_REG_DOT_LOD5 0x006A
109#define LEDRING2_REG_DOT_LSD0 0x0086
110#define LEDRING2_REG_DOT_LSD1 0x0087
111#define LEDRING2_REG_DOT_LSD2 0x0088
112#define LEDRING2_REG_DOT_LSD3 0x0089
113#define LEDRING2_REG_DOT_LSD4 0x008A
114#define LEDRING2_REG_DOT_LSD5 0x008B
115#define LEDRING2_REG_LOD_CLEAR 0x00A7
116#define LEDRING2_REG_LSD_CLEAR 0x00A8
117#define LEDRING2_REG_RESET 0x00A9
118#define LEDRING2_REG_DC0 0x0100
119#define LEDRING2_REG_DC1 0x0101
120#define LEDRING2_REG_DC2 0x0102
121#define LEDRING2_REG_DC3 0x0103
122#define LEDRING2_REG_DC4 0x0104
123#define LEDRING2_REG_DC5 0x0105
124#define LEDRING2_REG_DC6 0x0106
125#define LEDRING2_REG_DC7 0x0107
126#define LEDRING2_REG_DC8 0x0108
127#define LEDRING2_REG_DC9 0x0109
128#define LEDRING2_REG_DC10 0x010A
129#define LEDRING2_REG_DC11 0x010B
130#define LEDRING2_REG_DC12 0x010C
131#define LEDRING2_REG_DC13 0x010D
132#define LEDRING2_REG_DC14 0x010E
133#define LEDRING2_REG_DC15 0x010F
134#define LEDRING2_REG_DC16 0x0110
135#define LEDRING2_REG_DC17 0x0111
136#define LEDRING2_REG_DC18 0x0112
137#define LEDRING2_REG_DC19 0x0113
138#define LEDRING2_REG_DC20 0x0114
139#define LEDRING2_REG_DC21 0x0115
140#define LEDRING2_REG_DC22 0x0116
141#define LEDRING2_REG_DC23 0x0117
142#define LEDRING2_REG_DC24 0x0118
143#define LEDRING2_REG_DC25 0x0119
144#define LEDRING2_REG_DC26 0x011A
145#define LEDRING2_REG_DC27 0x011B
146#define LEDRING2_REG_DC28 0x011C
147#define LEDRING2_REG_DC29 0x011D
148#define LEDRING2_REG_DC30 0x011E
149#define LEDRING2_REG_DC31 0x011F
150#define LEDRING2_REG_DC32 0x0120
151#define LEDRING2_REG_DC33 0x0121
152#define LEDRING2_REG_DC34 0x0122
153#define LEDRING2_REG_DC35 0x0123
154#define LEDRING2_REG_PWM_BRI0 0x0200
155#define LEDRING2_REG_PWM_BRI1 0x0201
156#define LEDRING2_REG_PWM_BRI2 0x0202
157#define LEDRING2_REG_PWM_BRI3 0x0203
158#define LEDRING2_REG_PWM_BRI4 0x0204
159#define LEDRING2_REG_PWM_BRI5 0x0205
160#define LEDRING2_REG_PWM_BRI6 0x0206
161#define LEDRING2_REG_PWM_BRI7 0x0207
162#define LEDRING2_REG_PWM_BRI8 0x0208
163#define LEDRING2_REG_PWM_BRI9 0x0209
164#define LEDRING2_REG_PWM_BRI10 0x020A
165#define LEDRING2_REG_PWM_BRI11 0x020B
166#define LEDRING2_REG_PWM_BRI12 0x020C
167#define LEDRING2_REG_PWM_BRI13 0x020D
168#define LEDRING2_REG_PWM_BRI14 0x020E
169#define LEDRING2_REG_PWM_BRI15 0x020F
170#define LEDRING2_REG_PWM_BRI16 0x0210
171#define LEDRING2_REG_PWM_BRI17 0x0211
172#define LEDRING2_REG_PWM_BRI18 0x0212
173#define LEDRING2_REG_PWM_BRI19 0x0213
174#define LEDRING2_REG_PWM_BRI20 0x0214
175#define LEDRING2_REG_PWM_BRI21 0x0215
176#define LEDRING2_REG_PWM_BRI22 0x0216
177#define LEDRING2_REG_PWM_BRI23 0x0217
178#define LEDRING2_REG_PWM_BRI24 0x0218
179#define LEDRING2_REG_PWM_BRI25 0x0219
180#define LEDRING2_REG_PWM_BRI26 0x021A
181#define LEDRING2_REG_PWM_BRI27 0x021B
182#define LEDRING2_REG_PWM_BRI28 0x021C
183#define LEDRING2_REG_PWM_BRI29 0x021D
184#define LEDRING2_REG_PWM_BRI30 0x021E
185#define LEDRING2_REG_PWM_BRI31 0x021F
186#define LEDRING2_REG_PWM_BRI32 0x0220
187#define LEDRING2_REG_PWM_BRI33 0x0221
188#define LEDRING2_REG_PWM_BRI34 0x0222
189#define LEDRING2_REG_PWM_BRI35 0x0223
190#define LEDRING2_REG_PWM_BRI36 0x0224
191#define LEDRING2_REG_PWM_BRI37 0x0225
192#define LEDRING2_REG_PWM_BRI38 0x0226
193#define LEDRING2_REG_PWM_BRI39 0x0227
194#define LEDRING2_REG_PWM_BRI40 0x0228
195#define LEDRING2_REG_PWM_BRI41 0x0229
196#define LEDRING2_REG_PWM_BRI42 0x022A
197#define LEDRING2_REG_PWM_BRI43 0x022B
198#define LEDRING2_REG_PWM_BRI44 0x022C
199#define LEDRING2_REG_PWM_BRI45 0x022D
200#define LEDRING2_REG_PWM_BRI46 0x022E
201#define LEDRING2_REG_PWM_BRI47 0x022F
202#define LEDRING2_REG_PWM_BRI48 0x0230
203#define LEDRING2_REG_PWM_BRI49 0x0231
204#define LEDRING2_REG_PWM_BRI50 0x0232
205#define LEDRING2_REG_PWM_BRI51 0x0233
206#define LEDRING2_REG_PWM_BRI52 0x0234
207#define LEDRING2_REG_PWM_BRI53 0x0235
208#define LEDRING2_REG_PWM_BRI54 0x0236
209#define LEDRING2_REG_PWM_BRI55 0x0237
210#define LEDRING2_REG_PWM_BRI56 0x0238
211#define LEDRING2_REG_PWM_BRI57 0x0239
212#define LEDRING2_REG_PWM_BRI58 0x023A
213#define LEDRING2_REG_PWM_BRI59 0x023B
214#define LEDRING2_REG_PWM_BRI60 0x023C
215#define LEDRING2_REG_PWM_BRI61 0x023D
216#define LEDRING2_REG_PWM_BRI62 0x023E
217#define LEDRING2_REG_PWM_BRI63 0x023F
218#define LEDRING2_REG_PWM_BRI64 0x0240
219#define LEDRING2_REG_PWM_BRI65 0x0241
220#define LEDRING2_REG_PWM_BRI66 0x0242
221#define LEDRING2_REG_PWM_BRI67 0x0243
222#define LEDRING2_REG_PWM_BRI68 0x0244
223#define LEDRING2_REG_PWM_BRI69 0x0245
224#define LEDRING2_REG_PWM_BRI70 0x0246
225#define LEDRING2_REG_PWM_BRI71 0x0247
243#define LEDRING2_8_9_BIT_MASK 0x00003
245#define LEDRING2_LED_DISABLE 0x00
246#define LEDRING2_LED_ENABLE 0x01
248#define LEDRING2_OP_MODE_1 0x01
249#define LEDRING2_OP_MODE_2 0x02
250#define LEDRING2_OP_MODE_3 0x03
257#define LEDRING2_LED_GROUP_U1_LED_1_18 0x40
258#define LEDRING2_LED_GROUP_U2_LED_19_36 0x44
259#define LEDRING2_LED_GROUP_U3_LED_37_54 0x48
277#define LEDRING2_MAP_MIKROBUS( cfg, mikrobus ) \
278 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
279 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
280 cfg.vsy = MIKROBUS( mikrobus, MIKROBUS_PWM )
err_t ledring2_read_reg(ledring2_t *ctx, uint8_t led_group, uint16_t reg, uint8_t *data_out, uint8_t len)
LED Ring 2 read registe function.
err_t ledring2_set_all_led_state(ledring2_t *ctx, ledring2_led_state_t led_state)
LED Ring 2 set all LED state function.
err_t ledring2_disable(ledring2_t *ctx)
LED Ring 2 disable function.
err_t ledring2_enable(ledring2_t *ctx)
LED Ring 2 enable function.
err_t ledring2_set_led_brightness(ledring2_t *ctx, uint8_t led_pos, uint16_t led_brightness)
LED Ring 2 set LED brightness function.
err_t ledring2_set_slave_address(ledring2_t *ctx, uint8_t slave_address)
Set I2C Slave address.
err_t ledring2_default_cfg(ledring2_t *ctx)
LED Ring 2 default configuration function.
void ledring2_cfg_setup(ledring2_cfg_t *cfg)
LED Ring 2 configuration object setup function.
err_t ledring2_set_led_pos_state(ledring2_t *ctx, uint8_t led_pos, ledring2_led_state_t led_state)
LED Ring 2 set LED state function.
void ledring2_set_vsync(ledring2_t *ctx)
LED Ring 2 read registe function.
err_t ledring2_write_reg(ledring2_t *ctx, uint8_t led_group, uint16_t reg, uint8_t *data_in, uint8_t len)
LED Ring 2 write register function.
err_t ledring2_init(ledring2_t *ctx, ledring2_cfg_t *cfg)
LED Ring 2 initialization function.
ledring2_led_state_t
LED Ring 2 Click LED state data.
Definition ledring2.h:334
@ LEDRING2_LED_OFF
Definition ledring2.h:335
@ LEDRING2_LED_ON
Definition ledring2.h:336
ledring2_return_value_t
LED Ring 2 Click return value data.
Definition ledring2.h:323
@ LEDRING2_ERROR
Definition ledring2.h:325
@ LEDRING2_OK
Definition ledring2.h:324
LED Ring 2 Click configuration object.
Definition ledring2.h:307
pin_name_t vsy
Definition ledring2.h:311
uint32_t i2c_speed
Definition ledring2.h:313
pin_name_t scl
Definition ledring2.h:308
pin_name_t sda
Definition ledring2.h:309
uint8_t i2c_address
Definition ledring2.h:314
LED Ring 2 Click context object.
Definition ledring2.h:290
i2c_master_t i2c
Definition ledring2.h:295
uint8_t slave_address
Definition ledring2.h:298
digital_out_t vsy
Definition ledring2.h:292