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"
73#define LEDFLASH3_REG_ENABLE 0x01
74#define LEDFLASH3_REG_CONFIGURATION 0x02
75#define LEDFLASH3_REG_FLASH_CURRENT 0x03
76#define LEDFLASH3_REG_TOUCH_CURRENT 0x04
77#define LEDFLASH3_REG_FAULT_FLAG 0x05
78#define LEDFLASH3_REG_DEVICE_ID 0x06
96#define LEDFLASH3_LVP_ENABLE 0x10
97#define LEDFLASH3_STROBE_LEVEL 0x00
98#define LEDFLASH3_STROBE_EDGE 0x08
99#define LEDFLASH3_STROBE_PIN_ENABLE 0x04
100#define LEDFLASH3_MODE_FLASH 0x03
101#define LEDFLASH3_MODE_TORCH 0x02
102#define LEDFLASH3_MODE_IR 0x01
103#define LEDFLASH3_MODE_STANDBY 0x00
109#define LEDFLASH3_LVP_THRESHOLD_2V9 0x00
110#define LEDFLASH3_LVP_THRESHOLD_3V 0x02
111#define LEDFLASH3_LVP_THRESHOLD_3V1 0x04
112#define LEDFLASH3_LVP_THRESHOLD_3V2 0x06
113#define LEDFLASH3_LVP_THRESHOLD_3V3 0x08
114#define LEDFLASH3_LVP_THRESHOLD_3V4 0x0A
115#define LEDFLASH3_LVP_THRESHOLD_3V5 0x0C
116#define LEDFLASH3_LVP_THRESHOLD_3V6 0x0E
117#define LEDFLASH3_TIME_OUT_40MS 0x00
118#define LEDFLASH3_TIME_OUT_80MS 0x02
119#define LEDFLASH3_TIME_OUT_120MS 0x04
120#define LEDFLASH3_TIME_OUT_160MS 0x06
121#define LEDFLASH3_TIME_OUT_200MS 0x08
122#define LEDFLASH3_TIME_OUT_240MS 0x0A
123#define LEDFLASH3_TIME_OUT_280MS 0x0C
124#define LEDFLASH3_TIME_OUT_320MS 0x0E
125#define LEDFLASH3_TIME_OUT_360MS 0x10
126#define LEDFLASH3_TIME_OUT_400MS 0x12
127#define LEDFLASH3_TIME_OUT_600MS 0x14
128#define LEDFLASH3_TIME_OUT_800MS 0x16
129#define LEDFLASH3_TIME_OUT_1000MS 0x18
130#define LEDFLASH3_TIME_OUT_1200MS 0x1A
131#define LEDFLASH3_TIME_OUT_1400MS 0x1C
132#define LEDFLASH3_TIME_OUT_1600MS 0x1E
133#define LEDFLASH3_TORCH_RAMP_TIME_1MS 0x01
139#define LEDFLASH3_LVP_FAULT_MASK 0x40
140#define LEDFLASH3_LED_SHORT_FAULT_MASK 0x20
141#define LEDFLASH3_THERMAL_SHDN_MASK 0x04
142#define LEDFLASH3_THERMAL_SHDN_MASK 0x04
143#define LEDFLASH3_OVLO_FAULT_MASK 0x02
144#define LEDFLASH3_FLASH_TIMEOUT_MASK 0x01
150#define LEDFLASH3_SW_RESET_MASK 0x80
156#define LEDFLASH3_TORCH_CURRENT_MAX 376.0f
157#define LEDFLASH3_TORCH_CURRENT_MIN 2.94f
158#define LEDFLASH3_FLASH_CURRENT_MAX 1500.0f
159#define LEDFLASH3_FLASH_CURRENT_MIN 11.72f
160#define LEDFLASH3_ROUND_TO_NEAR_INT 0.5f
167#define LEDFLASH3_DEVICE_ADDRESS 0x64
185#define LEDFLASH3_MAP_MIKROBUS( cfg, mikrobus ) \
186 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
187 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
188 cfg.stb = MIKROBUS( mikrobus, MIKROBUS_PWM )
err_t ledflash3_generic_read(ledflash3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
LED Flash 3 I2C reading function.
err_t ledflash3_generic_write(ledflash3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
LED Flash 3 I2C writing function.
err_t ledflash3_write_reg(ledflash3_t *ctx, uint8_t reg, uint8_t data_in)
LED Flash 3 register writing function.
err_t ledflash3_default_cfg(ledflash3_t *ctx)
LED Flash 3 default configuration function.
err_t ledflash3_read_reg(ledflash3_t *ctx, uint8_t reg, uint8_t *data_out)
LED Flash 3 regiister reading function.
void ledflash3_strobe_pin(ledflash3_t *ctx)
LED Flash 3 strobe function.
err_t ledflash3_set_torch_current(ledflash3_t *ctx, float torch_current)
LED Flash 3 set torch current function.
void ledflash3_cfg_setup(ledflash3_cfg_t *cfg)
LED Flash 3 configuration object setup function.
err_t ledflash3_set_flash_current(ledflash3_t *ctx, float flash_current)
LED Flash 3 set flash current function.
err_t ledflash3_init(ledflash3_t *ctx, ledflash3_cfg_t *cfg)
LED Flash 3 initialization function.
ledflash3_return_value_t
LED Flash 3 Click return value data.
Definition ledflash3.h:231
@ LEDFLASH3_ERROR
Definition ledflash3.h:233
@ LEDFLASH3_OK
Definition ledflash3.h:232
LED Flash 3 Click configuration object.
Definition ledflash3.h:215
uint32_t i2c_speed
Definition ledflash3.h:221
pin_name_t scl
Definition ledflash3.h:216
pin_name_t sda
Definition ledflash3.h:217
pin_name_t stb
Definition ledflash3.h:219
uint8_t i2c_address
Definition ledflash3.h:222
LED Flash 3 Click context object.
Definition ledflash3.h:198
digital_out_t stb
Definition ledflash3.h:200
i2c_master_t i2c
Definition ledflash3.h:203
uint8_t slave_address
Definition ledflash3.h:206