light4  2.1.0.0
Data Structures | Macros | Enumerations | Functions
light4.h File Reference

This file contains API for Light 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  light4_t
 Light 4 Click context object. More...
 
struct  light4_cfg_t
 Light 4 Click configuration object. More...
 

Macros

#define LIGHT4_REG_UV_CALIB   0x08
 Light 4 description register. More...
 
#define LIGHT4_REG_MOD_CHANNEL_CTRL   0x40
 
#define LIGHT4_REG_ENABLE   0x80
 
#define LIGHT4_REG_MEAS_MODE0   0x81
 
#define LIGHT4_REG_MEAS_MODE1   0x82
 
#define LIGHT4_REG_SAMPLE_TIME0   0x83
 
#define LIGHT4_REG_SAMPLE_TIME1   0x84
 
#define LIGHT4_REG_ALS_NR_SAMPLES0   0x85
 
#define LIGHT4_REG_ALS_NR_SAMPLES1   0x86
 
#define LIGHT4_REG_FD_NR_SAMPLES0   0x87
 
#define LIGHT4_REG_FD_NR_SAMPLES1   0x88
 
#define LIGHT4_REG_WTIME   0x89
 
#define LIGHT4_REG_AILT0   0x8A
 
#define LIGHT4_REG_AILT1   0x8B
 
#define LIGHT4_REG_AILT2   0x8C
 
#define LIGHT4_REG_AIHT0   0x8D
 
#define LIGHT4_REG_AIHT1   0x8B
 
#define LIGHT4_REG_AIHT2   0x8F
 
#define LIGHT4_REG_AUX_ID   0x90
 
#define LIGHT4_REG_REV_ID   0x91
 
#define LIGHT4_REG_ID   0x92
 
#define LIGHT4_REG_STATUS   0x93
 
#define LIGHT4_REG_ALS_STATUS   0x94
 
#define LIGHT4_REG_ALS_DATA0_LSB   0x95
 
#define LIGHT4_REG_ALS_DATA0_MSB   0x96
 
#define LIGHT4_REG_ALS_DATA1_LSB   0x97
 
#define LIGHT4_REG_ALS_DATA1_MSB   0x98
 
#define LIGHT4_REG_ALS_DATA2_LSB   0x99
 
#define LIGHT4_REG_ALS_DATA2_MSB   0x9A
 
#define LIGHT4_REG_ALS_STATUS2   0x9B
 
#define LIGHT4_REG_ALS_STATUS3   0x9C
 
#define LIGHT4_REG_STATUS2   0x9D
 
#define LIGHT4_REG_STATUS3   0x9E
 
#define LIGHT4_REG_STATUS4   0x9F
 
#define LIGHT4_REG_STATUS5   0xA0
 
#define LIGHT4_REG_CFG0   0xA1
 
#define LIGHT4_REG_CFG1   0xA2
 
#define LIGHT4_REG_CFG2   0xA3
 
#define LIGHT4_REG_CFG3   0xA4
 
#define LIGHT4_REG_CFG4   0xA5
 
#define LIGHT4_REG_CFG5   0xA6
 
#define LIGHT4_REG_CFG6   0xA7
 
#define LIGHT4_REG_CFG7   0xA8
 
#define LIGHT4_REG_CFG8   0xA9
 
#define LIGHT4_REG_CFG9   0xAA
 
#define LIGHT4_REG_AGC_NR_SAMPLES_LSB   0xAC
 
#define LIGHT4_REG_AGC_NR_SAMPLES_MSB   0xAD
 
#define LIGHT4_REG_TRIGGER_MODE   0xAE
 
#define LIGHT4_REG_CONTROL   0xB1
 
#define LIGHT4_REG_INTENAB   0xBA
 
#define LIGHT4_REG_SIEN   0xBB
 
#define LIGHT4_REG_MOD_COMP_CFG1   0xCE
 
#define LIGHT4_REG_MEAS_SEQR_FD_0   0xCF
 
#define LIGHT4_REG_MEAS_SEQR_ALS_FD_1   0xD0
 
#define LIGHT4_REG_MEAS_SEQR_APERS_AND_VSYNC_WAIT   0xD1
 
#define LIGHT4_REG_MEAS_SEQR_RESIDUAL_0   0xD2
 
#define LIGHT4_REG_MEAS_SEQR_RESIDUAL_1_AND_WAIT   0xD3
 
#define LIGHT4_REG_MEAS_SEQR_STEP0_MOD_GAINX_L   0xD4
 
#define LIGHT4_REG_MEAS_SEQR_STEP0_MOD_GAINX_H   0xD5
 
#define LIGHT4_REG_MEAS_SEQR_STEP1_MOD_GAINX_L   0xD6
 
#define LIGHT4_REG_MEAS_SEQR_STEP1_MOD_GAINX_H   0xD7
 
#define LIGHT4_REG_MEAS_SEQR_STEP2_MOD_GAINX_L   0xD8
 
#define LIGHT4_REG_MEAS_SEQR_STEP2_MOD_GAINX_H   0xD9
 
#define LIGHT4_REG_MEAS_SEQR_STEP3_MOD_GAINX_L   0xDA
 
#define LIGHT4_REG_MEAS_SEQR_STEP3_MOD_GAINX_H   0xDB
 
#define LIGHT4_REG_MEAS_SEQR_STEP0_MOD_PHDX_L   0xDC
 
#define LIGHT4_REG_MEAS_SEQR_STEP0_MOD_PHDX_H   0xDD
 
#define LIGHT4_REG_MEAS_SEQR_STEP1_MOD_PHDX_L   0xDE
 
#define LIGHT4_REG_MEAS_SEQR_STEP1_MOD_PHDX_H   0xDF
 
#define LIGHT4_REG_MEAS_SEQR_STEP2_MOD_PHDX_L   0xE0
 
#define LIGHT4_REG_MEAS_SEQR_STEP2_MOD_PHDX_H   0xE1
 
#define LIGHT4_REG_MEAS_SEQR_STEP3_MOD_PHDX_L   0xE2
 
#define LIGHT4_REG_MEAS_SEQR_STEP3_MOD_PHDX_H   0xE3
 
#define LIGHT4_REG_MOD_CALIB_CFG0   0xE4
 
#define LIGHT4_REG_MOD_CALIB_CFG2   0xE6
 
#define LIGHT4_REG_VSYNC_PERIOD_LSB   0xF2
 
#define LIGHT4_REG_VSYNC_PERIOD_MSB   0xF3
 
#define LIGHT4_REG_VSYNC_PERIOD_TARGET_LSB   0xF4
 
#define LIGHT4_REG_VSYNC_PERIOD_TARGET_MSB   0xF5
 
#define LIGHT4_REG_VSYNC_CONTROL   0xF6
 
#define LIGHT4_REG_VSYNC_CFG   0xF7
 
#define LIGHT4_REG_VSYNC_GPIO_INT   0xF8
 
#define LIGHT4_REG_MOD_FIFO_DATA_CFG0   0xF9
 
#define LIGHT4_REG_MOD_FIFO_DATA_CFG1   0xFA
 
#define LIGHT4_REG_MOD_FIFO_DATA_CFG2   0xFB
 
#define LIGHT4_REG_FIFO_THR   0xDC
 
#define LIGHT4_REG_FIFO_STATUS0   0xFD
 
#define LIGHT4_REG_FIFO_STATUS1   0xFE
 
#define LIGHT4_REG_FIFO_DATA   0xFF
 
#define LIGHT4_FDEN   0x40
 Light 4 description setting. More...
 
#define LIGHT4_AEN   0x02
 
#define LIGHT4_PON   0x01
 
#define LIGHT4_MOD2_DISABLE   0x04
 Light 4 MOD_CHANNEL_CTRL register setting. More...
 
#define LIGHT4_MOD1_DISABLE   0x02
 
#define LIGHT4_MOD0_DISABLE   0x01
 
#define LIGHT4_MOD_ENABLE_ALL   0x00
 
#define LIGHT4_MIEN   0x80
 Light 4 ENABLE register setting. More...
 
#define LIGHT4_AIEN   0x04
 
#define LIGHT4_FIEN   0x02
 
#define LIGHT4_SIEN   0x01
 
#define LIGHT4_SOFT_RESET   0x08
 Light 4 CONTROL register setting. More...
 
#define LIGHT4_FIFO_CLR   0x02
 
#define LIGHT4_CLEAR_SAI_ACTIVE   0x01
 
#define LIGHT4_MEAS_SEQR_STEP_MASK   0xC0
 Light 4 ALS_STATUS register setting. More...
 
#define LIGHT4_ALS_DATA0_ANALOG_SATURATION_STATUS   0x20
 
#define LIGHT4_ALS_DATA1_ANALOG_SATURATION_STATUS   0x10
 
#define LIGHT4_ALS_DATA2_ANALOG_SATURATION_STATUS   0x08
 
#define LIGHT4_ALS_DATA0_SCALED_STATUS   0x04
 
#define LIGHT4_ALS_DATA1_SCALED_STATUS   0x02
 
#define LIGHT4_ALS_DATA2_SCALED_STATUS   0x01
 
#define LIGHT4_PIN_STATE_HIGH   0x01
 Light 4 Pin state setting. More...
 
#define LIGHT4_PIN_STATE_LOW   0x00
 
#define LIGHT4_AUX_ID   0x06
 Light 4 Device ID setting. More...
 
#define LIGHT4_REV_ID   0x11
 
#define LIGHT4_DEVICE_ID   0x5C
 
#define LIGHT4_CHANNEL0_SEL   0x00
 Light 4 Channel selection setting. More...
 
#define LIGHT4_CHANNEL1_SEL   0x01
 
#define LIGHT4_CHANNEL2_SEL   0x02
 
#define LIGHT4_DEVICE_ADDRESS   0x39
 Light 4 device address setting. More...
 
#define LIGHT4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  light4_return_value_t { LIGHT4_OK = 0, LIGHT4_ERROR = -1, LIGHT4_ANALOG_SAT = -2 }
 Light 4 Click return value data. More...
 

Functions

void light4_cfg_setup (light4_cfg_t *cfg)
 Light 4 configuration object setup function. More...
 
err_t light4_init (light4_t *ctx, light4_cfg_t *cfg)
 Light 4 initialization function. More...
 
err_t light4_default_cfg (light4_t *ctx)
 Light 4 default configuration function. More...
 
err_t light4_generic_write (light4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Light 4 I2C writing function. More...
 
err_t light4_generic_read (light4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Light 4 I2C reading function. More...
 
void light4_set_en_pin (light4_t *ctx, uint8_t pin_state)
 Light 4 set EN pin function. More...
 
void light4_set_snc_pin (light4_t *ctx, uint8_t pin_state)
 Light 4 set SNC pin function. More...
 
uint8_t light4_get_int_pin (light4_t *ctx)
 Light 4 get INT pin function. More...
 
err_t light4_write_reg (light4_t *ctx, uint8_t reg, uint8_t data_in)
 Light 4 Register writing function. More...
 
err_t light4_read_reg (light4_t *ctx, uint8_t reg, uint8_t *data_out)
 Light 4 Register reading function. More...
 
err_t light4_sw_reset (light4_t *ctx)
 Light 4 Software reset function. More...
 
err_t light4_read_channel_data (light4_t *ctx, uint8_t channel_sel, float *channel_data)
 Light 4 get channel data function. More...
 

Detailed Description

This file contains API for Light 4 Click Driver.

Enumeration Type Documentation

◆ light4_return_value_t

Light 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
LIGHT4_OK 
LIGHT4_ERROR 
LIGHT4_ANALOG_SAT