224#define APDS99XX_ID (0x29)
225#define APDS99XX_T_PRX_PULSE (16)
226#define APDS99XX_T_PRX_CNV (2720)
227#define APDS99XX_T_WAIT_STEP (2720)
228#define APDS99XX_T_ALS_STEP (2720)
229#define APDS99XX_CNTS_P_STEP (1023)
232#define APDS99XX_ID (0x20)
233#define APDS99XX_T_PRX_PULSE (16)
234#define APDS99XX_T_PRX_CNV (2720)
235#define APDS99XX_T_WAIT_STEP (2720)
236#define APDS99XX_T_ALS_STEP (2720)
237#define APDS99XX_CNTS_P_STEP (1023)
240#define APDS99XX_ID (0x39)
241#define APDS99XX_T_PRX_PULSE (16)
242#define APDS99XX_T_PRX_CNV (2730)
243#define APDS99XX_T_WAIT_STEP (2730)
244#define APDS99XX_T_ALS_STEP (2730)
245#define APDS99XX_CNTS_P_STEP (1023)
248#define APDS99XX_ID (0x69)
249#define APDS99XX_T_PRX_PULSE (14)
250#define APDS99XX_T_PRX_CNV (2400)
251#define APDS99XX_T_WAIT_STEP (2400)
252#define APDS99XX_T_ALS_STEP (2400)
253#define APDS99XX_CNTS_P_STEP (1024)
255#elif MODULE_APDS9960 || DOXYGEN
256#define APDS99XX_ID (0xab)
257#define APDS99XX_T_PRX_PULSE (36)
259#define APDS99XX_T_PRX_CNV (841)
261#define APDS99XX_T_WAIT_STEP (2780)
262#define APDS99XX_T_ALS_STEP (2780)
263#define APDS99XX_CNTS_P_STEP (1025)
266#error "Please provide a valid aps99xx variant (apds9900, apds9901, adps9930, apds9950, apds9960)"
273#define APDS99XX_I2C_ADDRESS (0x39)
293 #if MODULE_APDS9950 || MODULE_APDS9960 || DOXYGEN
296 #if MODULE_APDS9900 || MODULE_APDS9901 || APDS9930 || DOXYGEN
306 #if MODULE_APDS9930 || MODULE_APDS9960 || DOXYGEN
352#if MODULE_APDS99XX_FULL || DOXYGEN
426#if MODULE_APDS99XX_FULL || DOXYGEN
435#if MODULE_APDS9950 || MODULE_APDS9960 || DOXYGEN
504#if MODULE_APDS9900 || MODULE_APDS9901 || MODULE_APDS9930 || DOXYGEN
527#if MODULE_APDS9950 || MODULE_APDS9960 || DOXYGEN
628#if MODULE_APDS99XX_FULL || DOXYGEN
Low-level GPIO peripheral driver interface definitions.
void(* apds99xx_isr_t)(void *arg)
Interrupt service routine function prototype.
int apds99xx_power_down(const apds99xx_t *dev)
Power down the sensor.
int apds99xx_data_ready_prx(const apds99xx_t *dev)
Proximity sensing (PRX) data-ready status function.
apds99xx_prx_gain_t
Proximity sensing (PRX) gain.
int apds99xx_int_source(apds99xx_t *dev, apds99xx_int_source_t *src)
Get the source of an interrupt.
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.
apds99xx_prx_drive_t
Proximity sensing (PRX) LED drive strength.
int apds99xx_data_ready_als(const apds99xx_t *dev)
Ambient light sensing (ALS) data-ready status function.
int apds99xx_read_illuminance(const apds99xx_t *dev, uint16_t *lux)
Read one data sample of illuminance in lux.
int apds99xx_read_prx_raw(const apds99xx_t *dev, uint16_t *prx)
Read one data sample of proximity sensing (PRX)
int apds99xx_read_als_raw(const apds99xx_t *dev, uint16_t *raw)
Read one raw data sample of ambient light sensing (ALS)
int apds99xx_power_up(const apds99xx_t *dev)
Power up the sensor.
apds99xx_error_codes_t
Definition of error codes.
int apds99xx_read_rgb_raw(const apds99xx_t *dev, apds99xx_rgb_t *rgb)
Read one raw RGB color data sample (APDS9950 and APDS9960 only)
apds99xx_als_gain_t
Ambient light sensing (ALS) gain.
int apds99xx_init(apds99xx_t *dev, const apds99xx_params_t *params)
Initialize the APDS99XX sensor device.
@ APDS99XX_PRX_GAIN_4
4 x gain (APDS9930, APDS9960 only)
@ APDS99XX_PRX_GAIN_8
8 x gain (APDS9930, APDS9960 only)
@ APDS99XX_PRX_GAIN_1
1 x gain (default)
@ APDS99XX_PRX_GAIN_2
2 x gain (APDS9930, APDS9960 only)
@ APDS99XX_PRX_DRIVE_25
25.0 mA
@ APDS99XX_PRX_DRIVE_12_5
12.5 mA
@ APDS99XX_PRX_DRIVE_100
100.0 mA (default)
@ APDS99XX_PRX_DRIVE_50
50.0 mA
@ APDS99XX_ERROR_NO_DATA
no data are available
@ APDS99XX_ERROR_I2C
I2C communication error.
@ APDS99XX_ERROR_RAW_DATA
reading raw data failed
@ APDS99XX_ERROR_WRONG_ID
wrong id read
@ APDS99XX_ALS_GAIN_120
120 x gain (APDS9900, APDS9901, APDS9930 only)
@ APDS99XX_ALS_GAIN_16
16 x gain
@ APDS99XX_ALS_GAIN_64
64 x gain (APDS9950, APDS9960 only)
@ APDS99XX_ALS_GAIN_8
8 x gain
@ APDS99XX_ALS_GAIN_1
1 x gain (default)
Low-level I2C peripheral driver interface definition.
uint16_t als_thresh_high
High threshold value for ALS interrupts.
uint8_t prx_pers
Number of consecutive proximity values that have to be outside the thresholds to generate an interrup...
uint16_t als_thresh_low
Low threshold value for ALS interrupts.
uint16_t prx_thresh_low
Low threshold for proximity values (only the low byte is used for APDS9960)
bool als_int_en
ALS interrupt enabled.
bool prx_int_en
Proximity interrupt enabled.
uint8_t als_pers
Number of consecutive ALS values that have to be outside the thresholds to generate an interrupt:
uint16_t prx_thresh_high
High threshold for proximity values (only the low byte is used for APDS9960)
bool prx_int
Proximity interrupt happened.
bool als_int
ALS interrupt happened.
APDS99XX device initialization parameters.
unsigned dev
I2C device (default I2C_DEV(0))
gpio_t int_pin
interrupt pin: GPIO_UNDEF if not used
apds99xx_als_gain_t als_gain
Gain used for ALS.
uint16_t wait_steps
Waiting time in steps.
apds99xx_prx_gain_t prx_gain
Gain used for proximity sensing.
uint8_t prx_pulses
IR LED pulses for proximity sensing.
apds99xx_prx_drive_t prx_drive
IR LED current for proximity sensing (default APDS99XX_PRX_DRIVE_100)
uint16_t als_steps
ALS integration time in steps.
bool wait_long
Long waiting time.
APDS99XX sensor device data structure type.
apds99xx_params_t params
device initialization parameters
void * isr_arg
user ISR argument
bool gpio_init
GPIO is already initialized.
apds99xx_isr_t isr
user ISR
RGB count value data structure (APDS9950 and APDS9960 only)
uint16_t green
G photodiode count value (green)
uint16_t blue
B photodiode count value (blue)
uint16_t red
R photodiode count value (red)