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 UVA_REG_CHIP_ID 0x00
74#define UVA_REG_MODE 0x01
75#define UVA_REG_RES_UV 0x04
76#define UVA_REG_RANGE_UVA 0x05
77#define UVA_REG_MODE_CTRL 0x0A
78#define UVA_REG_SOFT_RESET 0x0B
79#define UVA_REG_UVA_LSB 0x15
80#define UVA_REG_UVA_MSB 0x16
81#define UVA_REG_NVM_READ_CTRL 0x30
82#define UVA_REG_NVM_MSB 0x31
83#define UVA_REG_NVM_LSB 0x32
101#define UVA_CHIP_ID 0x62
107#define UVA_MODE_NO_OPERATION 0x00
108#define UVA_MODE_UVA_OPERATION 0x10
109#define UVA_MODE_NORMAL 0x00
110#define UVA_MODE_LOW_POWER 0x01
111#define UVA_MODE_AUTO_SHUTDOWN 0x02
112#define UVA_MODE_SHUTDOWN 0x03
118#define UVA_RESOLUTION_800MS 0x00
119#define UVA_RESOLUTION_400MS 0x01
120#define UVA_RESOLUTION_200MS 0x02
121#define UVA_RESOLUTION_100MS 0x03
127#define UVA_RANGE_X1 0x00
128#define UVA_RANGE_X2 0x01
129#define UVA_RANGE_X4 0x02
130#define UVA_RANGE_X8 0x03
131#define UVA_RANGE_X16 0x04
132#define UVA_RANGE_X32 0x05
133#define UVA_RANGE_X64 0x06
134#define UVA_RANGE_X128 0x07
140#define UVA_MODE_CTRL_SLEEP_2_TIMES 0x00
141#define UVA_MODE_CTRL_SLEEP_4_TIMES 0x01
142#define UVA_MODE_CTRL_SLEEP_8_TIMES 0x02
143#define UVA_MODE_CTRL_SLEEP_16_TIMES 0x03
144#define UVA_MODE_CTRL_SLEEP_32_TIMES 0x04
145#define UVA_MODE_CTRL_SLEEP_64_TIMES 0x05
146#define UVA_MODE_CTRL_SLEEP_128_TIMES 0x06
147#define UVA_MODE_CTRL_SLEEP_256_TIMES 0x07
153#define UVA_SOFT_RESET 0xA5
159#define UVA_NVM_READ_ADDRESS_OFFSET 0x0A
160#define UVA_NVM_READ_ADDRESS_A_SCALE 0x0B
167#define UVA_SET_DEV_ADDR 0x39
185#define UVA_MAP_MIKROBUS( cfg, mikrobus ) \
186 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
187 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
err_t uva_soft_reset(uva_t *ctx)
UVA soft reset function.
err_t uva_generic_read(uva_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
UVA I2C reading function.
err_t uva_write_register(uva_t *ctx, uint8_t reg, uint8_t data_in)
UVA write register function.
err_t uva_read_register(uva_t *ctx, uint8_t reg, uint8_t *data_out)
UVA read register function.
err_t uva_check_communication(uva_t *ctx)
UVA check communication function.
err_t uva_init(uva_t *ctx, uva_cfg_t *cfg)
UVA initialization function.
err_t uva_generic_write(uva_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
UVA I2C writing function.
err_t uva_read_data(uva_t *ctx, uint16_t *uva_data)
UVA read data function.
err_t uva_default_cfg(uva_t *ctx)
UVA default configuration function.
void uva_cfg_setup(uva_cfg_t *cfg)
UVA configuration object setup function.
UVA Click configuration object.
Definition uva.h:211
uint32_t i2c_speed
Definition uva.h:215
pin_name_t scl
Definition uva.h:212
pin_name_t sda
Definition uva.h:213
uint8_t i2c_address
Definition uva.h:216
UVA Click context object.
Definition uva.h:197
i2c_master_t i2c
Definition uva.h:199
uint8_t slave_address
Definition uva.h:202
uva_return_value_t
UVA Click return value data.
Definition uva.h:225
@ UVA_OK
Definition uva.h:226
@ UVA_ERROR
Definition uva.h:227