Loading...
Searching...
No Matches
#include <stdbool.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
+ Include dependency graph for apds99xx.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  apds99xx_params_t
 APDS99XX device initialization parameters. More...
 
struct  apds99xx_int_config_t
 Interrupt configuration. More...
 
struct  apds99xx_int_source_t
 Interrupt source. More...
 
struct  apds99xx_t
 APDS99XX sensor device data structure type. More...
 
union  apds99xx_rgb_t
 RGB count value data structure (APDS9950 and APDS9960 only) More...
 

Macros

#define APDS99XX_I2C_ADDRESS   (0x39)
 APDS99XX I2C addresses.
 

Typedefs

typedef void(* apds99xx_isr_t) (void *arg)
 Interrupt service routine function prototype.
 

Enumerations

enum  apds99xx_error_codes_t {
  APDS99XX_OK , APDS99XX_ERROR_I2C , APDS99XX_ERROR_WRONG_ID , APDS99XX_ERROR_NO_DATA ,
  APDS99XX_ERROR_RAW_DATA
}
 Definition of error codes. More...
 
enum  apds99xx_als_gain_t {
  APDS99XX_ALS_GAIN_1 = 0 , APDS99XX_ALS_GAIN_8 , APDS99XX_ALS_GAIN_16 , APDS99XX_ALS_GAIN_64 ,
  APDS99XX_ALS_GAIN_120
}
 Ambient light sensing (ALS) gain. More...
 
enum  apds99xx_prx_gain_t { APDS99XX_PRX_GAIN_1 = 0 , APDS99XX_PRX_GAIN_2 , APDS99XX_PRX_GAIN_4 , APDS99XX_PRX_GAIN_8 }
 Proximity sensing (PRX) gain. More...
 
enum  apds99xx_prx_drive_t { APDS99XX_PRX_DRIVE_100 = 0 , APDS99XX_PRX_DRIVE_50 , APDS99XX_PRX_DRIVE_25 , APDS99XX_PRX_DRIVE_12_5 }
 Proximity sensing (PRX) LED drive strength. More...
 

Functions

int apds99xx_init (apds99xx_t *dev, const apds99xx_params_t *params)
 Initialize the APDS99XX sensor device.
 
int apds99xx_data_ready_als (const apds99xx_t *dev)
 Ambient light sensing (ALS) data-ready status function.
 
int apds99xx_read_als_raw (const apds99xx_t *dev, uint16_t *raw)
 Read one raw data sample of ambient light sensing (ALS)
 
int apds99xx_read_illuminance (const apds99xx_t *dev, uint16_t *lux)
 Read one data sample of illuminance in lux.
 
int apds99xx_read_rgb_raw (const apds99xx_t *dev, apds99xx_rgb_t *rgb)
 Read one raw RGB color data sample (APDS9950 and APDS9960 only)
 
int apds99xx_data_ready_prx (const apds99xx_t *dev)
 Proximity sensing (PRX) data-ready status function.
 
int apds99xx_read_prx_raw (const apds99xx_t *dev, uint16_t *prx)
 Read one data sample of proximity sensing (PRX)
 
int apds99xx_power_down (const apds99xx_t *dev)
 Power down the sensor.
 
int apds99xx_power_up (const apds99xx_t *dev)
 Power up the sensor.
 
int apds99xx_int_config (apds99xx_t *dev, apds99xx_int_config_t *cfg, apds99xx_isr_t isr, void *isr_arg)
 Configure the interrupts of the sensor.
 
int apds99xx_int_source (apds99xx_t *dev, apds99xx_int_source_t *src)
 Get the source of an interrupt.
 

APDS99XX device properties

Defines for different device properties for supported sensor types.

These properties can be used by the application for calculations.

#define APDS99XX_ID   (0xab)
 Device ID of ADPS-9960.
 
#define APDS99XX_T_PRX_PULSE   (36)
 LED IR pulse period t_pulse in us (for PPLEN=8 us)
 
#define APDS99XX_T_PRX_CNV   (841)
 Proximity ADC conversion time t_prx_conv in us (tINIT + tCNVT for PPLEN=8 us)
 
#define APDS99XX_T_WAIT_STEP   (2780)
 Wait time step size t_step in us.
 
#define APDS99XX_T_ALS_STEP   (2780)
 ALS integration time step size t_step in.
 
#define APDS99XX_CNTS_P_STEP   (1025)
 Counts per step cnts_p_step