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 UV5_CFG_STATE_REG_OSR 0x00
70 #define UV5_CFG_STATE_REG_AGEN 0x02
71 #define UV5_CFG_STATE_REG_CREG1 0x06
72 #define UV5_CFG_STATE_REG_CREG2 0x07
73 #define UV5_CFG_STATE_REG_CREG3 0x08
74 #define UV5_CFG_STATE_REG_BREAK 0x09
75 #define UV5_CFG_STATE_REG_EDGES 0x0A
76 #define UV5_CFG_STATE_REG_OPTREG 0x0B
77 #define UV5_MESASURE_STATE_REG_OSR 0x00
78 #define UV5_MESASURE_STATE_REG_TEMP 0x01
79 #define UV5_MESASURE_STATE_REG_MRES1 0x02
80 #define UV5_MESASURE_STATE_REG_MRES2 0x03
81 #define UV5_MESASURE_STATE_REG_MRES3 0x04
82 #define UV5_MESASURE_STATE_REG_OUTCONV_L 0x05
83 #define UV5_MESASURE_STATE_REG_OUTCONV_H 0x06
106 #define UV5_START_MEASURMENT 0x80
107 #define UV5_POWER_DOWN 0x40
108 #define UV5_SW_RESET 0x08
109 #define UV5_CONFIGURATION_MODE 0x02
110 #define UV5_MEASUREMENT_MODE 0x03
116 #define UV5_DEVID 0x20
123 #define UV5_GAIN_2048X 0x00
124 #define UV5_GAIN_1024X 0x10
125 #define UV5_GAIN_512X 0x20
126 #define UV5_GAIN_256X 0x30
127 #define UV5_GAIN_128X 0x40
128 #define UV5_GAIN_64X 0x50
129 #define UV5_GAIN_32X 0x60
130 #define UV5_GAIN_16X 0x70
131 #define UV5_GAIN_8X 0x80
132 #define UV5_GAIN_4X 0x90
133 #define UV5_GAIN_2X 0xA0
134 #define UV5_GAIN_1X 0xB0
135 #define UV5_TIME_1_MS 0x00
136 #define UV5_TIME_2_MS 0x01
137 #define UV5_TIME_4_MS 0x02
138 #define UV5_TIME_8_MS 0x03
139 #define UV5_TIME_16_MS 0x04
140 #define UV5_TIME_32_MS 0x05
141 #define UV5_TIME_64_MS 0x06
142 #define UV5_TIME_128_MS 0x07
143 #define UV5_TIME_256_MS 0x08
144 #define UV5_TIME_512_MS 0x09
145 #define UV5_TIME_1024_MS 0x0A
146 #define UV5_TIME_2048_MS 0x0B
147 #define UV5_TIME_4096_MS 0x0C
148 #define UV5_TIME_8192_MS 0x0D
149 #define UV5_TIME_16384_MS 0x0E
155 #define UV5_EN_TM 0x40
156 #define UV5_EN_DIV 0x08
157 #define UV5_DIV_256 0x07
158 #define UV5_DIV_128 0x06
159 #define UV5_DIV_64 0x05
160 #define UV5_DIV_32 0x04
161 #define UV5_DIV_16 0x03
162 #define UV5_DIV_8 0x02
163 #define UV5_DIV_4 0x01
164 #define UV5_DIV_2 0x00
170 #define UV5_MMODE_CONT 0x00
171 #define UV5_MMODE_CMD 0x40
172 #define UV5_MMODE_SYNS 0x80
173 #define UV5_MMODE_SYND 0xC0
174 #define UV5_STANDBY_ON 0x10
175 #define UV5_READY_PUSH_PULL 0x00
176 #define UV5_READY_OPEN_DRAIN 0x08
177 #define UV5_CCLK_1024_KHZ 0x00
178 #define UV5_CCLK_2048_KHZ 0x01
179 #define UV5_CCLK_4096_KHZ 0x02
180 #define UV5_CCLK_8192_KHZ 0x03
182 #define UV5_TEMPERATURE_CALC_CONST 0.05
183 #define UV5_TEMPERATURE_CALC_VALUE 66.9
190 #define UV5_DEVICE_ADDRESS_00 0x74
191 #define UV5_DEVICE_ADDRESS_01 0x75
192 #define UV5_DEVICE_ADDRESS_10 0x76
193 #define UV5_DEVICE_ADDRESS_11 0x77
211 #define UV5_MAP_MIKROBUS( cfg, mikrobus ) \
212 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
213 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
214 cfg.syn = MIKROBUS( mikrobus, MIKROBUS_RST ); \
215 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
uint32_t i2c_speed
Definition: uv5.h:252
err_t uv5_channel_uvc_read(uv5_t *ctx, uint16_t *uvc_data)
UV 5 read raw UVC data function.
void uv5_set_syn_pin(uv5_t *ctx, uint8_t pin_state)
UV 5 set SYN pin state function.
err_t uv5_sw_reset(uv5_t *ctx)
UV 5 software reset function.
pin_name_t sda
Definition: uv5.h:247
i2c_master_t i2c
Definition: uv5.h:233
uint8_t slave_address
Definition: uv5.h:236
uint8_t uv5_get_rdy_pin(uv5_t *ctx)
UV 5 get READY pin state function.
err_t uv5_generic_read(uv5_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
UV 5 I2C reading function.
err_t uv5_read_cfg_reg(uv5_t *ctx, uint8_t reg, uint8_t *data_out)
UV 5 configuration mode register reading function.
void uv5_cfg_setup(uv5_cfg_t *cfg)
UV 5 configuration object setup function.
pin_name_t scl
Definition: uv5.h:246
digital_in_t rdy
Definition: uv5.h:230
UV 5 Click context object.
Definition: uv5.h:225
err_t uv5_read_measu_reg(uv5_t *ctx, uint8_t reg, uint8_t *data_out)
UV 5 measurement mode register reading function.
UV 5 Click configuration object.
Definition: uv5.h:245
err_t uv5_default_cfg(uv5_t *ctx)
UV 5 default configuration function.
err_t uv5_temperature_read(uv5_t *ctx, float *temp_data)
UV 5 read temperature function.
uv5_return_value_t
UV 5 Click return value data.
Definition: uv5.h:262
err_t uv5_channel_uvb_read(uv5_t *ctx, uint16_t *uvb_data)
UV 5 read raw UVB data function.
err_t uv5_write_cfg_reg(uv5_t *ctx, uint8_t reg, uint8_t data_in)
UV 5 configuration mode register write function.
err_t uv5_generic_write(uv5_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
UV 5 I2C writing function.
pin_name_t syn
Definition: uv5.h:249
err_t uv5_write_measu_reg(uv5_t *ctx, uint8_t reg, uint8_t *data_in)
UV 5 measurement mode register write function.
digital_out_t syn
Definition: uv5.h:227
pin_name_t rdy
Definition: uv5.h:250
err_t uv5_channel_uva_read(uv5_t *ctx, uint16_t *uva_data)
UV 5 read raw UVA data function.
@ UV5_ERROR
Definition: uv5.h:264
@ UV5_OK
Definition: uv5.h:263
uint8_t i2c_address
Definition: uv5.h:253
err_t uv5_init(uv5_t *ctx, uv5_cfg_t *cfg)
UV 5 initialization function.