Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tcs34725.h File Reference

Public header for TCS34725 color sensor. More...

Go to the source code of this file.

Enumerations

enum  tcs34725_channel { SENSOR_CHAN_TCS34725_LUX = SENSOR_CHAN_PRIV_START , SENSOR_CHAN_TCS34725_COLOR_TEMP }
 Driver-specific sensor channel identifiers for the TCS34725. More...

Detailed Description

Public header for TCS34725 color sensor.

Enumeration Type Documentation

◆ tcs34725_channel

Driver-specific sensor channel identifiers for the TCS34725.

These channels expose derived values computed from the raw clear, red, green, and blue ADC readings using the ams DN40 algorithm:

  • SENSOR_CHAN_TCS34725_LUX - illuminance in lux
  • SENSOR_CHAN_TCS34725_COLOR_TEMP - correlated color temperature in Kelvin
Note
VALIDITY FLAG: For both of these channels, sensor_channel_get() returns the result in val->val1, and a validity flag in val->val2:
  • val->val2 == 1: the DN40 calculation succeeded; val->val1 holds a genuine, trustworthy measurement.
  • val->val2 == 0: the calculation could not produce a reliable result (RGBC channel saturation, clear channel below the usable minimum, or - most commonly - highly saturated/pure single-color light that falls outside the DN40 formula's valid input domain). In this case val->val1 is always 0 and MUST NOT be interpreted as a real measurement (it does not mean "zero lux" or "0 Kelvin").

Applications should always check val->val2 before using val->val1 for these two channels. The raw SENSOR_CHAN_RED/GREEN/BLUE/LIGHT channels are always valid and do not use val->val2 for anything (it is always 0 for those channels).

Use these identifiers with sensor_channel_get() after a successful sensor_sample_fetch() call.

Enumerator
SENSOR_CHAN_TCS34725_LUX 

Calculated illuminance (lux), from the DN40 algorithm.

SENSOR_CHAN_TCS34725_COLOR_TEMP 

Calculated correlated color temperature (CT), in Kelvin.