uv5 2.1.0.0
uv5.h File Reference

This file contains API for UV 5 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  uv5_t
 UV 5 Click context object. More...
 
struct  uv5_cfg_t
 UV 5 Click configuration object. More...
 

Macros

#define UV5_CFG_STATE_REG_OSR   0x00
 UV 5 description register.
 
#define UV5_CFG_STATE_REG_AGEN   0x02
 
#define UV5_CFG_STATE_REG_CREG1   0x06
 
#define UV5_CFG_STATE_REG_CREG2   0x07
 
#define UV5_CFG_STATE_REG_CREG3   0x08
 
#define UV5_CFG_STATE_REG_BREAK   0x09
 
#define UV5_CFG_STATE_REG_EDGES   0x0A
 
#define UV5_CFG_STATE_REG_OPTREG   0x0B
 
#define UV5_MESASURE_STATE_REG_OSR   0x00
 
#define UV5_MESASURE_STATE_REG_TEMP   0x01
 
#define UV5_MESASURE_STATE_REG_MRES1   0x02
 
#define UV5_MESASURE_STATE_REG_MRES2   0x03
 
#define UV5_MESASURE_STATE_REG_MRES3   0x04
 
#define UV5_MESASURE_STATE_REG_OUTCONV_L   0x05
 
#define UV5_MESASURE_STATE_REG_OUTCONV_H   0x06
 
#define UV5_START_MEASURMENT   0x80
 UV 5 description setting.
 
#define UV5_POWER_DOWN   0x40
 
#define UV5_SW_RESET   0x08
 
#define UV5_CONFIGURATION_MODE   0x02
 
#define UV5_MEASUREMENT_MODE   0x03
 
#define UV5_DEVID   0x20
 UV 5 AGEN register setting.
 
#define UV5_MUT   0x01
 
#define UV5_GAIN_2048X   0x00
 UV 5 CREG1 register setting.
 
#define UV5_GAIN_1024X   0x10
 
#define UV5_GAIN_512X   0x20
 
#define UV5_GAIN_256X   0x30
 
#define UV5_GAIN_128X   0x40
 
#define UV5_GAIN_64X   0x50
 
#define UV5_GAIN_32X   0x60
 
#define UV5_GAIN_16X   0x70
 
#define UV5_GAIN_8X   0x80
 
#define UV5_GAIN_4X   0x90
 
#define UV5_GAIN_2X   0xA0
 
#define UV5_GAIN_1X   0xB0
 
#define UV5_TIME_1_MS   0x00
 
#define UV5_TIME_2_MS   0x01
 
#define UV5_TIME_4_MS   0x02
 
#define UV5_TIME_8_MS   0x03
 
#define UV5_TIME_16_MS   0x04
 
#define UV5_TIME_32_MS   0x05
 
#define UV5_TIME_64_MS   0x06
 
#define UV5_TIME_128_MS   0x07
 
#define UV5_TIME_256_MS   0x08
 
#define UV5_TIME_512_MS   0x09
 
#define UV5_TIME_1024_MS   0x0A
 
#define UV5_TIME_2048_MS   0x0B
 
#define UV5_TIME_4096_MS   0x0C
 
#define UV5_TIME_8192_MS   0x0D
 
#define UV5_TIME_16384_MS   0x0E
 
#define UV5_EN_TM   0x40
 UV 5 CREG2 register setting.
 
#define UV5_EN_DIV   0x08
 
#define UV5_DIV_256   0x07
 
#define UV5_DIV_128   0x06
 
#define UV5_DIV_64   0x05
 
#define UV5_DIV_32   0x04
 
#define UV5_DIV_16   0x03
 
#define UV5_DIV_8   0x02
 
#define UV5_DIV_4   0x01
 
#define UV5_DIV_2   0x00
 
#define UV5_MMODE_CONT   0x00
 UV 5 CREG3 register setting.
 
#define UV5_MMODE_CMD   0x40
 
#define UV5_MMODE_SYNS   0x80
 
#define UV5_MMODE_SYND   0xC0
 
#define UV5_STANDBY_ON   0x10
 
#define UV5_READY_PUSH_PULL   0x00
 
#define UV5_READY_OPEN_DRAIN   0x08
 
#define UV5_CCLK_1024_KHZ   0x00
 
#define UV5_CCLK_2048_KHZ   0x01
 
#define UV5_CCLK_4096_KHZ   0x02
 
#define UV5_CCLK_8192_KHZ   0x03
 
#define UV5_TEMPERATURE_CALC_CONST   0.05
 
#define UV5_TEMPERATURE_CALC_VALUE   66.9
 
#define UV5_DEVICE_ADDRESS_00   0x74
 UV 5 device address setting.
 
#define UV5_DEVICE_ADDRESS_01   0x75
 
#define UV5_DEVICE_ADDRESS_10   0x76
 
#define UV5_DEVICE_ADDRESS_11   0x77
 
#define UV5_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  uv5_return_value_t { UV5_OK = 0 , UV5_ERROR = -1 }
 UV 5 Click return value data. More...
 

Functions

void uv5_cfg_setup (uv5_cfg_t *cfg)
 UV 5 configuration object setup function.
 
err_t uv5_init (uv5_t *ctx, uv5_cfg_t *cfg)
 UV 5 initialization function.
 
err_t uv5_default_cfg (uv5_t *ctx)
 UV 5 default configuration function.
 
err_t uv5_generic_write (uv5_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 UV 5 I2C writing 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_write_cfg_reg (uv5_t *ctx, uint8_t reg, uint8_t data_in)
 UV 5 configuration mode register write function.
 
err_t uv5_write_measu_reg (uv5_t *ctx, uint8_t reg, uint8_t *data_in)
 UV 5 measurement mode register write function.
 
err_t uv5_read_cfg_reg (uv5_t *ctx, uint8_t reg, uint8_t *data_out)
 UV 5 configuration mode register reading function.
 
err_t uv5_read_measu_reg (uv5_t *ctx, uint8_t reg, uint8_t *data_out)
 UV 5 measurement mode register reading function.
 
void uv5_set_syn_pin (uv5_t *ctx, uint8_t pin_state)
 UV 5 set SYN pin state function.
 
uint8_t uv5_get_rdy_pin (uv5_t *ctx)
 UV 5 get READY pin state function.
 
err_t uv5_sw_reset (uv5_t *ctx)
 UV 5 software reset function.
 
err_t uv5_temperature_read (uv5_t *ctx, float *temp_data)
 UV 5 read temperature function.
 
err_t uv5_channel_uva_read (uv5_t *ctx, uint16_t *uva_data)
 UV 5 read raw UVA data function.
 
err_t uv5_channel_uvb_read (uv5_t *ctx, uint16_t *uvb_data)
 UV 5 read raw UVB data function.
 
err_t uv5_channel_uvc_read (uv5_t *ctx, uint16_t *uvc_data)
 UV 5 read raw UVC data function.
 

Detailed Description

This file contains API for UV 5 Click Driver.

Enumeration Type Documentation

◆ uv5_return_value_t

UV 5 Click return value data.

Predefined enum values for driver return values.

Enumerator
UV5_OK 
UV5_ERROR