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

This file contains API for Light 3 Click Driver. More...

#include "mikrosdk_version.h"
#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  light3_t
 Light 3 Click context object. More...
 
struct  light3_cfg_t
 Light 3 Click configuration object. More...
 

Macros

#define LIGHT3_REG_RESULT_MSB_CH0   0x00
 Light 3 description register. More...
 
#define LIGHT3_REG_RESULT_LSB_CH0   0x01
 
#define LIGHT3_REG_RESULT_MSB_CH1   0x02
 
#define LIGHT3_REG_RESULT_LSB_CH1   0x03
 
#define LIGHT3_REG_RESULT_FIFO_MSB_CH0   0x04
 
#define LIGHT3_REG_RESULT_FIFO_LSB_CH0   0x05
 
#define LIGHT3_REG_RESULT_FIFO_MSB_CH1   0x06
 
#define LIGHT3_REG_RESULT_FIFO_LSB_CH1   0x07
 
#define LIGHT3_REG_TRESHOLD_LOW   0x08
 
#define LIGHT3_REG_TRESHOLD_HIGH   0x09
 
#define LIGHT3_REG_CONFIG   0x0A
 
#define LIGHT3_REG_INT_CONFIG   0x0B
 
#define LIGHT3_REG_ERROR_FLAGS   0x0C
 
#define LIGHT3_REG_DEVICE_ID   0x11
 
#define LIGHT3_QWAKE_EN   0x8000u
 Light 3 description setting. More...
 
#define LIGHT3_RANGE_561_LUX   0x0000u
 
#define LIGHT3_RANGE_1_1_KLUX   0x0400u
 
#define LIGHT3_RANGE_2_2_KLUX   0x0800u
 
#define LIGHT3_RANGE_4_4_KLUX   0x0C00u
 
#define LIGHT3_RANGE_8_9_KLUX   0x1000u
 
#define LIGHT3_RANGE_17_9_KLUX   0x1400u
 
#define LIGHT3_RANGE_35_9_KLUX   0x1800u
 
#define LIGHT3_RANGE_71_8_KLUX   0x1C00u
 
#define LIGHT3_RANGE_143_KLUX   0x2000u
 
#define LIGHT3_RANGE_AUTO_RANGE   0x3000u
 
#define LIGHT3_CONV_TIME_600_US   0x0000u
 
#define LIGHT3_CONV_TIME_1_MS   0x0040u
 
#define LIGHT3_CONV_TIME_1_8_MS   0x0080u
 
#define LIGHT3_CONV_TIME_3_4_MS   0x00C0u
 
#define LIGHT3_CONV_TIME_6_5_MS   0x0100u
 
#define LIGHT3_CONV_TIME_12_7_MS   0x0140u
 
#define LIGHT3_CONV_TIME_25_MS   0x0180u
 
#define LIGHT3_CONV_TIME_50_MS   0x01C0u
 
#define LIGHT3_CONV_TIME_100_MS   0x0200u
 
#define LIGHT3_CONV_TIME_200_MS   0x0240u
 
#define LIGHT3_CONV_TIME_400_MS   0x0280u
 
#define LIGHT3_CONV_TIME_800_MS   0x02C0u
 
#define LIGHT3_MODE_POWER_DOWN   0x0000u
 
#define LIGHT3_MODE_AUTO_RANGE_ONE_SHOT   0x0010u
 
#define LIGHT3_MODE_ONE_SHOT   0x0020u
 
#define LIGHT3_MODE_CONTINUOUS   0x0030u
 
#define LIGHT3_LATCH   0x0008u
 
#define LIGHT3_INT_POL_ACTIVE_LOW   0x0000u
 
#define LIGHT3_INT_POL_ACTIVE_HIGH   0x0004u
 
#define LIGHT3_FAULT_COUNT_1   0x0000u
 
#define LIGHT3_FAULT_COUNT_2   0x0001u
 
#define LIGHT3_FAULT_COUNT_4   0x0002u
 
#define LIGHT3_FAULT_COUNT_8   0x0003u
 
#define LIGHT3_INT_CONFIG_REG_DEF_VALUE   0x8000u
 Light 3 INT_CONFIG register description setting. More...
 
#define LIGHT3_TRESHOLD_CH0_SEL   0x0000u
 
#define LIGHT3_TRESHOLD_CH1_SEL   0x0020u
 
#define LIGHT3_INT_DIR_INPUT   0x0000u
 
#define LIGHT3_INT_DIR_OUTPUT   0x0010u
 
#define LIGHT3_INT_CFG_SMBUS_ALERT   0x0000u
 
#define LIGHT3_INT_EVERY_CONV   0x0004u
 
#define LIGHT3_INT_EVERY_2_CONV   0x0008u
 
#define LIGHT3_INT_EVERY_4_CONV   0x000Cu
 
#define LIGHT3_I2C_BURST_ENABLED   0x0001u
 
#define LIGHT3_LUX_CONV_FACTOR   0.000535f
 Light 3 conversion factor setting. More...
 
#define LIGHT3_PIN_STATE_LOW   0x00
 Light 3 pin states setting. More...
 
#define LIGHT3_PIN_STATE_HIGH   0x01
 
#define LIGHT3_DEVICE_ADDRESS_0   0x44
 Light 3 device address setting. More...
 
#define LIGHT3_DEVICE_ADDRESS_1   0x45
 
#define LIGHT3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  light3_return_value_t { LIGHT3_OK = 0 , LIGHT3_ERROR = -1 }
 Light 3 Click return value data. More...
 

Functions

void light3_cfg_setup (light3_cfg_t *cfg)
 Light 3 configuration object setup function. More...
 
err_t light3_init (light3_t *ctx, light3_cfg_t *cfg)
 Light 3 initialization function. More...
 
err_t light3_default_cfg (light3_t *ctx)
 Light 3 default configuration function. More...
 
err_t light3_generic_write (light3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Light 3 I2C writing function. More...
 
err_t light3_generic_read (light3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Light 3 I2C reading function. More...
 
uint8_t light3_get_int_pin (light3_t *ctx)
 Light 3 get INT pin state function. More...
 
err_t light3_sw_reset (light3_t *ctx)
 Light 3 software reset function. More...
 
err_t light3_write_reg (light3_t *ctx, uint8_t reg, uint16_t data_in)
 Light 3 register writing function. More...
 
err_t light3_read_reg (light3_t *ctx, uint8_t reg, uint16_t *data_out)
 Light 3 register reading function. More...
 
err_t light3_get_ch0_data (light3_t *ctx, float *lux)
 Light 3 read CH0 data function. More...
 
err_t light3_get_ch1_data (light3_t *ctx, float *lux)
 Light 3 read CH1 data function. More...
 
err_t light3_get_ch0_fifo_data (light3_t *ctx, float *lux)
 Light 3 read CH0 FIFO data function. More...
 
err_t light3_get_ch1_fifo_data (light3_t *ctx, float *lux)
 Light 3 read CH1 FIFO data function. More...
 

Detailed Description

This file contains API for Light 3 Click Driver.

Enumeration Type Documentation

◆ light3_return_value_t

Light 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
LIGHT3_OK 
LIGHT3_ERROR