uv4 2.0.0.0
uv4.h File Reference

This file contains API for UV 4 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  uv4_t
 Click ctx object definition. More...
 
struct  uv4_cfg_t
 Click configuration structure definition. More...
 

Macros

#define UV4_MAP_MIKROBUS(cfg, mikrobus)
 
#define UV4_RETVAL   uint8_t
 
#define UV4_OK   0x00
 
#define UV4_INIT_ERROR   0xFF
 
#define UV4_PART_ID_REG   0x00
 
#define UV4_HW_ID_REG   0x01
 
#define UV4_REV_ID_REG   0x02
 
#define UV4_INFO_0_REG   0x03
 
#define UV4_INFO_1_REG   0x04
 
#define UV4_INPUT_3_REG   0x07
 
#define UV4_INPUT_2_REG   0x08
 
#define UV4_INPUT_1_REG   0x09
 
#define UV4_INPUT_0_REG   0x0A
 
#define UV4_COMMAND_REG   0x0B
 
#define UV4_IRQ_ENABLE_REG   0x0F
 
#define UV4_RESPONSE_1_REG   0x10
 
#define UV4_RESPONSE_0_REG   0x11
 
#define UV4_IRQ_STATUS_REG   0x12
 
#define UV4_OUTPUT_0_REG   0x13
 
#define UV4_OUTPUT_1_REG   0x14
 
#define UV4_OUTPUT_2_REG   0x15
 
#define UV4_OUTPUT_3_REG   0x16
 
#define UV4_OUTPUT_4_REG   0x17
 
#define UV4_OUTPUT_5_REG   0x18
 
#define UV4_OUTPUT_6_REG   0x19
 
#define UV4_OUTPUT_7_REG   0x1A
 
#define UV4_OUTPUT_8_REG   0x1B
 
#define UV4_OUTPUT_9_REG   0x1C
 
#define UV4_OUTPUT_10_REG   0x1D
 
#define UV4_OUTPUT_11_REG   0x1E
 
#define UV4_OUTPUT_12_REG   0x1F
 
#define UV4_OUTPUT_13_REG   0x20
 
#define UV4_OUTPUT_14_REG   0x21
 
#define UV4_OUTPUT_15_REG   0x22
 
#define UV4_OUTPUT_16_REG   0x23
 
#define UV4_OUTPUT_17_REG   0x24
 
#define UV4_OUTPUT_18_REG   0x25
 
#define UV4_OUTPUT_19_REG   0x26
 
#define UV4_OUTPUT_20_REG   0x27
 
#define UV4_OUTPUT_21_REG   0x28
 
#define UV4_OUTPUT_22_REG   0x29
 
#define UV4_OUTPUT_23_REG   0x2A
 
#define UV4_OUTPUT_24_REG   0x2B
 
#define UV4_OUTPUT_25_REG   0x2C
 
#define UV4_I2C_ADDR_PARAM   0x00
 
#define UV4_CHAN_LIST_PARAM   0x01
 
#define UV4_ADCCONFIG_0_PARAM   0x02
 
#define UV4_ADCSENS_0_PARAM   0x03
 
#define UV4_ADCPOST_0_PARAM   0x04
 
#define UV4_MEASCONFIG_0_PARAM   0x05
 
#define UV4_ADCCONFIG_1_PARAM   0x06
 
#define UV4_ADCSENS_1_PARAM   0x07
 
#define UV4_ADCPOST_1_PARAM   0x08
 
#define UV4_MEASCONFIG_1_PARAM   0x09
 
#define UV4_ADCCONFIG_2_PARAM   0x0A
 
#define UV4_ADCSENS_2_PARAM   0x0B
 
#define UV4_ADCPOST_2_PARAM   0x0C
 
#define UV4_MEASCONFIG_2_PARAM   0x0D
 
#define UV4_ADCCONFIG_3_PARAM   0x0E
 
#define UV4_ADCSENS_3_PARAM   0x0F
 
#define UV4_ADCPOST_3_PARAM   0x10
 
#define UV4_MEASCONFIG_3_PARAM   0x11
 
#define UV4_ADCCONFIG_4_PARAM   0x12
 
#define UV4_ADCSENS_4_PARAM   0x13
 
#define UV4_ADCPOST_4_PARAM   0x14
 
#define UV4_MEASCONFIG_4_PARAM   0x15
 
#define UV4_ADCCONFIG_5_PARAM   0x16
 
#define UV4_ADCSENS_5_PARAM   0x17
 
#define UV4_ADCPOST_5_PARAM   0x18
 
#define UV4_MEASCONFIG_5_PARAM   0x19
 
#define UV4_MEASRATE_H_PARAM   0x1A
 
#define UV4_MEASRATE_L_PARAM   0x1B
 
#define UV4_MEASCOUNT_0_PARAM   0x1C
 
#define UV4_MEASCOUNT_1_PARAM   0x1D
 
#define UV4_MEASCOUNT_2_PARAM   0x1E
 
#define UV4_THRESHOLD0_H_PARAM   0x25
 
#define UV4_THRESHOLD0_L_PARAM   0x26
 
#define UV4_THRESHOLD1_H_PARAM   0x27
 
#define UV4_THRESHOLD1_L_PARAM   0x28
 
#define UV4_THRESHOLD2_H_PARAM   0x29
 
#define UV4_THRESHOLD2_L_PARAM   0x2A
 
#define UV4_BURST_PARAM   0x2B
 
#define UV4_RESET_CTR_CMD   0x00
 
#define UV4_RESET_SW_CMD   0x01
 
#define UV4_FORCE_CMD   0x11
 
#define UV4_PAUSE_CMD   0x12
 
#define UV4_START_CMD   0x13
 
#define UV4_ALL_INTERR_DISABLE   0x00
 
#define UV4_CHAN0_INTERR_ENABLE   0x01
 
#define UV4_CHAN1_INTERR_ENABLE   0x02
 
#define UV4_CHAN2_INTERR_ENABLE   0x04
 
#define UV4_CHAN3_INTERR_ENABLE   0x08
 
#define UV4_CHAN4_INTERR_ENABLE   0x10
 
#define UV4_CHAN5_INTERR_ENABLE   0x20
 
#define UV4_ALL_CHANNELS_DISABLE   0x00
 
#define UV4_CHAN0_ENABLE   0x01
 
#define UV4_CHAN1_ENABLE   0x02
 
#define UV4_CHAN2_ENABLE   0x04
 
#define UV4_CHAN3_ENABLE   0x08
 
#define UV4_CHAN4_ENABLE   0x10
 
#define UV4_CHAN5_ENABLE   0x20
 
#define UV4_DATARATE_1024   0x00
 
#define UV4_DATARATE_2048   0x20
 
#define UV4_DATARATE_4096   0x40
 
#define UV4_DATARATE_512   0x60
 
#define UV4_OPT_FUNC_SMALL_IR   0x00
 
#define UV4_OPT_FUNC_MEDIUM_IR   0x01
 
#define UV4_OPT_FUNC_LARGE_IR   0x02
 
#define UV4_OPT_FUNC_WHITE   0x0B
 
#define UV4_OPT_FUNC_LARGE_WHITE   0x0D
 
#define UV4_OPT_FUNC_UV   0x18
 
#define UV4_OPT_FUNC_UV_DEEP   0x19
 
#define UV4_NORMAL_GAIN   0x00
 
#define UV4_HIGH_RANGE   0x80
 
#define UV4_1_MEASUREMENT   0x00
 
#define UV4_2_MEASUREMENTS   0x10
 
#define UV4_4_MEASUREMENTS   0x20
 
#define UV4_8_MEASUREMENTS   0x30
 
#define UV4_16_MEASUREMENTS   0x40
 
#define UV4_32_MEASUREMENTS   0x50
 
#define UV4_64_MEASUREMENTS   0x60
 
#define UV4_128_MEASUREMENTS   0x70
 
#define UV4_MEASTIME_24MICROSEC   0x00
 
#define UV4_MEASTIME_48MICROSEC   0x01
 
#define UV4_MEASTIME_96MICROSEC   0x02
 
#define UV4_MEASTIME_25MILISEC   0x0A
 
#define UV4_MEASTIME_50MILISEC   0x0B
 
#define UV4_16BIT_OUT   0x00
 
#define UV4_24BIT_OUT   0x40
 
#define UV4_NO_SHIFT_RIGHT   0x00
 
#define UV4_1BIT_SHIFT_RIGHT   0x08
 
#define UV4_2BITS_SHIFT_RIGHT   0x10
 
#define UV4_3BITS_SHIFT_RIGHT   0x18
 
#define UV4_4BITS_SHIFT_RIGHT   0x20
 
#define UV4_THRESHOLDS_DISABLE   0x00
 
#define UV4_THRESHOLD0_INTERR_ENABLE   0x01
 
#define UV4_THRESHOLD1_INTERR_ENABLE   0x02
 
#define UV4_THRESHOLD2_INTERR_ENABLE   0x03
 
#define UV4_NO_COUNTER_SELECTED   0x00
 
#define UV4_MEASCOUNT1_SELECT   0x40
 
#define UV4_MEASCOUNT2_SELECT   0x80
 
#define UV4_MEASCOUNT3_SELECT   0xC0
 
#define UV4_BURST_DISABLE   0x00
 
#define UV4_BURST_ENABLE   0x80
 
#define UV4_AUTOINC_ENABLE   0x00
 
#define UV4_AUTOINC_DISABLE   0x40
 
#define UV4_OK   0x00
 
#define UV4_ADDR_ERR   0x01
 
#define UV4_PARAM_ERR   0x02
 
#define UV4_CMMND_ERR   0x03
 
#define UV4_LOC_ERR   0x04
 
#define UV4_ACCM_OVERFLOW   0x05
 
#define UV4_BUFF_OVERFLOW   0x06
 
#define UV4_RST_OCCURED   0x07
 
#define UV4_INTERR_OCCURED   0xFF
 
#define UV4_NO_INTERR   0x00
 

Functions

void uv4_cfg_setup (uv4_cfg_t *cfg)
 Config Object Initialization function.
 
UV4_RETVAL uv4_init (uv4_t *ctx, uv4_cfg_t *cfg)
 Initialization function.
 
void uv4_default_cfg (uv4_t *ctx)
 Click Default Configuration function.
 
UV4_RETVAL uv4_write_reg (uv4_t *ctx, const uint8_t reg_address, const uint8_t transfer_data)
 Generic write function.
 
UV4_RETVAL uv4_read_reg (uv4_t *ctx, uint8_t reg_address, uint8_t *data_out, uint8_t n_bytes)
 Generic read function.
 
UV4_RETVAL uv4_write_param_data (uv4_t *ctx, uint8_t param_address, uint8_t transfer_data)
 Parameter Data Write Function.
 
UV4_RETVAL uv4_read_param_data (uv4_t *ctx, uint8_t param_address, uint8_t *param_out)
 Parameter Data Read Function.
 
void uv4_read_measurements (uv4_t *ctx, uint32_t *measure_out)
 Measurements Read Function.
 
UV4_RETVAL uv4_check_err_and_ctr (uv4_t *ctx, uint8_t *cnt_data)
 Error And Counter Check function.
 
UV4_RETVAL uv4_check_interr (uv4_t *ctx)
 Error And Counter Check function.
 

Detailed Description

This file contains API for UV 4 Click driver.