illuminance 2.0.0.0
illuminance.h File Reference

This file contains API for Illuminance 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  illuminance_t
 Illuminance Click context object. More...
 
struct  illuminance_cfg_t
 Illuminance Click configuration object. More...
 

Macros

#define ILLUMINANCE_REG_CONTROL   0x00
 Illuminance registers list.
 
#define ILLUMINANCE_REG_TIMING   0x01
 
#define ILLUMINANCE_REG_INTERRUPT   0x02
 
#define ILLUMINANCE_REG_THL_LOW   0x03
 
#define ILLUMINANCE_REG_THL_HIGH   0x04
 
#define ILLUMINANCE_REG_THH_LOW   0x05
 
#define ILLUMINANCE_REG_THH_HIGH   0x06
 
#define ILLUMINANCE_REG_ANALOG   0x07
 
#define ILLUMINANCE_REG_ID   0x12
 
#define ILLUMINANCE_REG_DATA0_LOW   0x14
 
#define ILLUMINANCE_REG_DATA0_HIGH   0x15
 
#define ILLUMINANCE_REG_DATA1_LOW   0x16
 
#define ILLUMINANCE_REG_DATA1_HIGH   0x17
 
#define ILLUMINANCE_REG_TIMER_LOW   0x18
 
#define ILLUMINANCE_REG_TIMER_HIGH   0x19
 
#define ILLUMINANCE_REG_ID2   0x1E
 
#define ILLUMINANCE_CMD_BIT   0x80
 Illuminance Command register setting.
 
#define ILLUMINANCE_TRANSACTION_REPEATED   0x00
 
#define ILLUMINANCE_TRANSACTION_AUTO_INC   0x20
 
#define ILLUMINANCE_TRANSACTION_SPEC_FUNC   0x60
 
#define ILLUMINANCE_SPEC_FUNC_INT_CLEAR   0x01
 
#define ILLUMINANCE_SPEC_FUNC_STOP_MAN_INT   0x02
 
#define ILLUMINANCE_SPEC_FUNC_START_MAN_INT   0x03
 
#define ILLUMINANCE_CONTROL_ADC_INTR   0x20
 Illuminance control register setting.
 
#define ILLUMINANCE_CONTROL_ADC_VALID   0x10
 
#define ILLUMINANCE_CONTROL_ADC_ENABLE   0x02
 
#define ILLUMINANCE_CONTROL_POWER_ON   0x01
 
#define ILLUMINANCE_ATIME_MAX   688.5
 Illuminance timing register setting.
 
#define ILLUMINANCE_ATIME_MIN   2.7
 
#define ILLUMINANCE_ATIME_STEP   2.7
 
#define ILLUMINANCE_DEFAULT_ATIME   200.0
 
#define ILLUMINANCE_ENABLE_INTERRUPT   0x10
 Illuminance interrupt register setting.
 
#define ILLUMINANCE_GAIN_1X   0x00
 Illuminance analog register setting.
 
#define ILLUMINANCE_GAIN_8X   0x01
 
#define ILLUMINANCE_GAIN_16X   0x02
 
#define ILLUMINANCE_GAIN_111X   0x03
 
#define ILLUMINANCE_ID_PARTNO   0x90
 Illuminance ID values.
 
#define ILLUMINANCE_ID2   0x30
 
#define ILLUMINANCE_SET_DEV_ADDR_GND   0x29
 Illuminance device address setting.
 
#define ILLUMINANCE_SET_DEV_ADDR_FLOAT   0x39
 
#define ILLUMINANCE_SET_DEV_ADDR_VCC   0x49
 
#define ILLUMINANCE_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  illuminance_return_value_t { ILLUMINANCE_OK = 0 , ILLUMINANCE_ERROR = -1 }
 Illuminance Click return value data. More...
 

Functions

void illuminance_cfg_setup (illuminance_cfg_t *cfg)
 Illuminance configuration object setup function.
 
err_t illuminance_init (illuminance_t *ctx, illuminance_cfg_t *cfg)
 Illuminance initialization function.
 
err_t illuminance_default_cfg (illuminance_t *ctx)
 Illuminance default configuration function.
 
err_t illuminance_generic_write (illuminance_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Illuminance I2C writing function.
 
err_t illuminance_generic_read (illuminance_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Illuminance I2C reading function.
 
err_t illuminance_write_register (illuminance_t *ctx, uint8_t reg, uint8_t data_in)
 Illuminance write register function.
 
err_t illuminance_read_register (illuminance_t *ctx, uint8_t reg, uint8_t *data_out)
 Illuminance read register function.
 
uint8_t illuminance_get_int_pin (illuminance_t *ctx)
 Illuminance get int pin function.
 
err_t illuminance_check_communication (illuminance_t *ctx)
 Illuminance check communication function.
 
err_t illuminance_set_atime (illuminance_t *ctx, float atime_ms)
 Illuminance set atime function.
 
err_t illuminance_set_gain (illuminance_t *ctx, uint8_t gain)
 Illuminance set gain function.
 
err_t illuminance_read_raw_data (illuminance_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
 Illuminance read raw data function.
 

Detailed Description

This file contains API for Illuminance Click Driver.

Enumeration Type Documentation

◆ illuminance_return_value_t

Illuminance Click return value data.

Predefined enum values for driver return values.

Enumerator
ILLUMINANCE_OK 
ILLUMINANCE_ERROR