Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define LEDDRIVER19_REG_DEVICE_ID 0x00
70 #define LEDDRIVER19_REG_DEVICE_EN 0x01
71 #define LEDDRIVER19_REG_CH_EN_LOW 0x02
72 #define LEDDRIVER19_REG_CH_EN_HIGH 0x03
73 #define LEDDRIVER19_REG_CONFIG 0x04
74 #define LEDDRIVER19_REG_FAULT_MASK 0x05
75 #define LEDDRIVER19_REG_FAULT_INT 0x06
76 #define LEDDRIVER19_REG_OPEN_LED_LOW 0x07
77 #define LEDDRIVER19_REG_OPEN_LED_HIGH 0x08
78 #define LEDDRIVER19_REG_CUR_LED_CS0 0x09
79 #define LEDDRIVER19_REG_CUR_LED_CS1 0x0A
80 #define LEDDRIVER19_REG_CUR_LED_CS2 0x0B
81 #define LEDDRIVER19_REG_CUR_LED_CS3 0x0C
82 #define LEDDRIVER19_REG_CUR_LED_CS4 0x0D
83 #define LEDDRIVER19_REG_CUR_LED_CS5 0x0E
84 #define LEDDRIVER19_REG_CUR_LED_CS6 0x0F
85 #define LEDDRIVER19_REG_CUR_LED_CS7 0x10
86 #define LEDDRIVER19_REG_CUR_LED_CS8 0x11
87 #define LEDDRIVER19_REG_CUR_LED_CS9 0x12
88 #define LEDDRIVER19_REG_CUR_LED_CS10 0x13
89 #define LEDDRIVER19_REG_CUR_LED_CS11 0x14
90 #define LEDDRIVER19_REG_PATTERN_SEQ_REP 0x15
91 #define LEDDRIVER19_REG_PATTERN_0_DUR 0x16
92 #define LEDDRIVER19_REG_PATTERN_1_DUR 0x17
93 #define LEDDRIVER19_REG_PATTERN_2_DUR 0x18
94 #define LEDDRIVER19_REG_PATTERN_3_DUR 0x19
95 #define LEDDRIVER19_REG_PATTERN_4_DUR 0x1A
96 #define LEDDRIVER19_REG_PATTERN_5_DUR 0x1B
97 #define LEDDRIVER19_REG_PATTERN_6_DUR 0x1C
98 #define LEDDRIVER19_REG_PATTERN_7_DUR 0x1D
99 #define LEDDRIVER19_REG_PWMREG_OFFSET 0x1E
100 #define LEDDRIVER19_REG_CLOCK_CONFIG 0xE0
119 #define LEDDRIVER19_DEVICE_ID 0x12
126 #define LEDDRIVER19_PIN_STATE_HIGH 0x01
127 #define LEDDRIVER19_PIN_STATE_LOW 0x00
134 #define LEDDRIVER19_SW_RESET 0x80
135 #define LEDDRIVER19_ENABLE 0x01
142 #define LEDDRIVER19_PATSEL_0 0x00
143 #define LEDDRIVER19_PATSEL_1 0x01
144 #define LEDDRIVER19_PATSEL_2 0x02
145 #define LEDDRIVER19_PATSEL_3 0x03
146 #define LEDDRIVER19_PATSEL_4 0x04
147 #define LEDDRIVER19_PATSEL_5 0x05
148 #define LEDDRIVER19_PATSEL_6 0x06
149 #define LEDDRIVER19_PATSEL_7 0x07
156 #define LEDDRIVER19_CH_SEL_0 0x00
157 #define LEDDRIVER19_CH_SEL_1 0x01
158 #define LEDDRIVER19_CH_SEL_2 0x02
159 #define LEDDRIVER19_CH_SEL_3 0x03
160 #define LEDDRIVER19_CH_SEL_4 0x04
161 #define LEDDRIVER19_CH_SEL_5 0x05
162 #define LEDDRIVER19_CH_SEL_6 0x06
163 #define LEDDRIVER19_CH_SEL_7 0x07
164 #define LEDDRIVER19_CH_SEL_8 0x08
165 #define LEDDRIVER19_CH_SEL_9 0x09
166 #define LEDDRIVER19_CH_SEL_10 0x0A
167 #define LEDDRIVER19_CH_SEL_11 0x0B
174 #define LEDDRIVER19_SHFT_EN 0x08
175 #define LEDDRIVER19_SHFT_DIS 0x00
176 #define LEDDRIVER19_GCTRL_EN 0x01
177 #define LEDDRIVER19_GCTRL_DIS 0x00
178 #define LEDDRIVER19_PATSR_RUNING 0x01
179 #define LEDDRIVER19_PATSR_DONE 0x00
180 #define LEDDRIVER19_PATS_EN 0x01
181 #define LEDDRIVER19_PATS_DIS 0x00
188 #define LEDDRIVER19_OVTP_MASK 0x01
189 #define LEDDRIVER19_OPEN_MASK 0x02
190 #define LEDDRIVER19_PAT_MASK 0x04
191 #define LEDDRIVER19_SOF_MASK 0x08
198 #define LEDDRIVER19_OVTP 0x01
199 #define LEDDRIVER19_OPEN 0x02
200 #define LEDDRIVER19_PAT 0x04
201 #define LEDDRIVER19_SOF 0x08
208 #define LEDDRIVER19_PATTERN_SEL_OFFSET 0x18
215 #define LEDDRIVER19_PWM_MASK 0x0FFFu
222 #define LEDDRIVER19_CS0_OPEN 0x0001u
223 #define LEDDRIVER19_CS1_OPEN 0x0002u
224 #define LEDDRIVER19_CS2_OPEN 0x0004u
225 #define LEDDRIVER19_CS3_OPEN 0x0008u
226 #define LEDDRIVER19_CS4_OPEN 0x0010u
227 #define LEDDRIVER19_CS5_OPEN 0x0020u
228 #define LEDDRIVER19_CS6_OPEN 0x0040u
229 #define LEDDRIVER19_CS7_OPEN 0x0080u
230 #define LEDDRIVER19_CS8_OPEN 0x0100u
231 #define LEDDRIVER19_CS9_OPEN 0x0200u
232 #define LEDDRIVER19_CS10_OPEN 0x0400u
233 #define LEDDRIVER19_CS11_OPEN 0x0800u
240 #define LEDDRIVER19_CS0_ENABLE 0x0001u
241 #define LEDDRIVER19_CS1_ENABLE 0x0002u
242 #define LEDDRIVER19_CS2_ENABLE 0x0004u
243 #define LEDDRIVER19_CS3_ENABLE 0x0008u
244 #define LEDDRIVER19_CS4_ENABLE 0x0010u
245 #define LEDDRIVER19_CS5_ENABLE 0x0020u
246 #define LEDDRIVER19_CS6_ENABLE 0x0040u
247 #define LEDDRIVER19_CS7_ENABLE 0x0080u
248 #define LEDDRIVER19_CS8_ENABLE 0x0100u
249 #define LEDDRIVER19_CS9_ENABLE 0x0200u
250 #define LEDDRIVER19_CS10_ENABLE 0x0400u
251 #define LEDDRIVER19_CS11_ENABLE 0x0800u
252 #define LEDDRIVER19_CS_ENABLE_ALL 0x0FFFu
259 #define LEDDRIVER19_PWM_VAL_CONVERSION 40.95f
260 #define LEDDRIVER19_CURRENT_STEP_TO_MA 0.07843f
261 #define LEDDRIVER19_CURRENT_STEP_TO_HEX 12.75f
268 #define LEDDRIVER19_DEVICE_ADDRESS_0 0x58
269 #define LEDDRIVER19_DEVICE_ADDRESS_1 0x59
270 #define LEDDRIVER19_DEVICE_ADDRESS_2 0x5A
271 #define LEDDRIVER19_DEVICE_ADDRESS_3 0x5B
289 #define LEDDRIVER19_MAP_MIKROBUS( cfg, mikrobus ) \
290 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
291 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
292 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
571 #endif // LEDDRIVER19_H
void leddriver19_cfg_setup(leddriver19_cfg_t *cfg)
LED Driver 19 configuration object setup function.
err_t leddriver19_disable_channels(leddriver19_t *ctx, uint16_t channels_dis)
LED Driver 19 disable channels function.
uint32_t i2c_speed
Definition: leddriver19.h:325
err_t leddriver19_init(leddriver19_t *ctx, leddriver19_cfg_t *cfg)
LED Driver 19 initialization function.
LED Driver 19 Click context object.
Definition: leddriver19.h:302
err_t leddriver19_get_nc_led(leddriver19_t *ctx, uint16_t *led_data)
LED Driver 19 get LED open ( NC channels ) data function.
uint8_t slave_address
Definition: leddriver19.h:310
digital_in_t int_pin
Definition: leddriver19.h:304
@ LEDDRIVER19_ERROR
Definition: leddriver19.h:337
pin_name_t scl
Definition: leddriver19.h:320
err_t leddriver19_default_cfg(leddriver19_t *ctx)
LED Driver 19 default configuration function.
err_t leddriver19_get_ch_current(leddriver19_t *ctx, uint8_t channel_sel, float *current_val)
LED Driver 19 get channel current value function.
err_t leddriver19_get_int_data(leddriver19_t *ctx, uint8_t *int_data)
LED Driver 19 get interrupt register data function.
uint8_t i2c_address
Definition: leddriver19.h:326
err_t leddriver19_sw_reset(leddriver19_t *ctx)
LED Driver 19 software reset function.
err_t leddriver19_generic_read(leddriver19_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
LED Driver 19 I2C reading function.
err_t leddriver19_generic_write(leddriver19_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
LED Driver 19 I2C writing function.
@ LEDDRIVER19_OK
Definition: leddriver19.h:336
err_t leddriver19_set_ch_current(leddriver19_t *ctx, uint8_t channel_sel, float current_val)
LED Driver 19 set channel current value function.
err_t leddriver19_set_pattern_pwm(leddriver19_t *ctx, uint8_t pattern_sel, uint8_t channel_sel, float pwm_value)
LED Driver 19 set pattern PWM value function.
err_t leddriver19_read_reg(leddriver19_t *ctx, uint8_t reg, uint8_t *data_out)
LED Driver 19 I2C register reading function.
err_t leddriver19_write_reg(leddriver19_t *ctx, uint8_t reg, uint8_t data_in)
LED Driver 19 I2C register writing function.
err_t leddriver19_enable_channels(leddriver19_t *ctx, uint16_t channels_en)
LED Driver 19 enables channels function.
pin_name_t sda
Definition: leddriver19.h:321
i2c_master_t i2c
Definition: leddriver19.h:307
LED Driver 19 Click configuration object.
Definition: leddriver19.h:319
leddriver19_return_value_t
LED Driver 19 Click return value data.
Definition: leddriver19.h:335
pin_name_t int_pin
Definition: leddriver19.h:323
uint8_t leddriver19_get_int_pin(leddriver19_t *ctx)
LED Driver 19 get interrupt pin state function.