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 UVB_REG_CHIP_ID 0x00
74#define UVB_REG_MODE 0x01
75#define UVB_REG_RES_UV 0x04
76#define UVB_REG_RANGE_UVB 0x07
77#define UVB_REG_MODE_CTRL 0x0A
78#define UVB_REG_SOFT_RESET 0x0B
79#define UVB_REG_UVB_LSB 0x17
80#define UVB_REG_UVB_MSB 0x18
81#define UVB_REG_NVM_READ_CTRL 0x30
82#define UVB_REG_NVM_MSB 0x31
83#define UVB_REG_NVM_LSB 0x32
101#define UVB_MODE_NO_OPERATION 0x00
102#define UVB_MODE_UVB_OPERATION 0x20
103#define UVB_MODE_NORMAL 0x00
104#define UVB_MODE_LOW_POWER 0x01
105#define UVB_MODE_AUTO_SHUTDOWN 0x02
106#define UVB_MODE_SHUTDOWN 0x03
112#define UVB_RESOLUTION_800ms 0x00
113#define UVB_RESOLUTION_400ms 0x01
114#define UVB_RESOLUTION_200ms 0x02
115#define UVB_RESOLUTION_100ms 0x03
121#define UVB_RANGE_x1 0x00
122#define UVB_RANGE_x2 0x01
123#define UVB_RANGE_x4 0x02
124#define UVB_RANGE_x8 0x03
125#define UVB_RANGE_x16 0x04
126#define UVB_RANGE_x32 0x05
127#define UVB_RANGE_x64 0x06
128#define UVB_RANGE_x128 0x07
134#define UVB_MCTRL_SLEEP_2_TIMES 0x00
135#define UVB_MCTRL_SLEEP_4_TIMES 0x01
136#define UVB_MCTRL_SLEEP_8_TIMES 0x02
137#define UVB_MCTRL_SLEEP_16_TIMES 0x03
138#define UVB_MCTRL_SLEEP_32_TIMES 0x04
139#define UVB_MCTRL_SLEEP_64_TIMES 0x05
140#define UVB_MCTRL_SLEEP_128_TIMES 0x06
141#define UVB_MCTRL_SLEEP_256_TIMES 0x07
143#define UVB_DEF_CHIP_ID 0x62
151#define UVB_SET_DEV_ADDR 0x39
169#define UVB_MAP_MIKROBUS( cfg, mikrobus ) \
170 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
171 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
void uvb_cfg_setup(uvb_cfg_t *cfg)
UVB configuration object setup function.
void uvb_configuration(uvb_t *ctx, uint8_t reg, uint8_t cfg)
Configuration register.
err_t uvb_generic_write(uvb_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
UVB I2C writing function.
uint16_t uvb_get_uv_data(uvb_t *ctx)
Get UVB data.
uint8_t uvb_read_byte(uvb_t *ctx, uint8_t reg)
Read one byte data from register.
err_t uvb_check_communication(uvb_t *ctx)
Check communication.
err_t uvb_default_cfg(uvb_t *ctx)
UVB default configuration function.
err_t uvb_generic_read(uvb_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
UVB I2C reading function.
err_t uvb_init(uvb_t *ctx, uvb_cfg_t *cfg)
UVB initialization function.
UVB Click configuration object.
Definition uvb.h:195
uint32_t i2c_speed
Definition uvb.h:199
pin_name_t scl
Definition uvb.h:196
pin_name_t sda
Definition uvb.h:197
uint8_t i2c_address
Definition uvb.h:200
UVB Click context object.
Definition uvb.h:181
i2c_master_t i2c
Definition uvb.h:183
uint8_t slave_address
Definition uvb.h:186
uvb_return_value_t
UVB Click return value data.
Definition uvb.h:209
@ UVB_ERROR
Definition uvb.h:211
@ UVB_OK
Definition uvb.h:210