opt4060.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ==============================
  2. OPT4060 driver
  3. ==============================
  4. 1. Overview
  5. =============================
  6. This driver supports the Texas Instrument RGBW high resolution color sensor over
  7. I2C.
  8. https://www.ti.com/lit/gpn/opt4060
  9. The driver supports:
  10. - Raw values for red, green, blue and clear.
  11. - Illuminance values.
  12. - Scaled color values for red, green and blue.
  13. - IIO events for thresholds.
  14. - IIO triggered buffer using both its own data ready trigger and triggers from
  15. other drivers.
  16. 2. Illuminance calculation
  17. =============================
  18. Illuminance is calculated using the wide spectrum green channel.
  19. lux = GREEN_RAW x 2.15e-3
  20. The value is accessed from:
  21. /sys/bus/iio/devices/iio:deviceX/in_illuminance_input
  22. See section 8.4.5.2 in the data sheet for additional details.
  23. 3. Color scale values
  24. =============================
  25. The sensor has different sensitivity for the different color components and
  26. compensating factors are exposed from the driver.
  27. The values are accessed from:
  28. /sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale
  29. /sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale
  30. /sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale
  31. A userspace application can multiply the raw values with the scale values so
  32. that for a particular test light source, typically white, the measurement
  33. intensity is the same across the different color channels. This is calculated
  34. in the following way:
  35. R = RED_RAW x SCALE_RED(2.4)
  36. G = GREEN_RAW x SCALE_GREEN(1.0)
  37. B = BLUE_RAW x SCALE_BLUE(1.3)
  38. The data sheet suggests using the scaled values to normalize the scaled R, G
  39. and B values. This is useful to get a value for the ratio between colors
  40. independent of light intensity. A userspace application can do this in the
  41. following way:
  42. R_NORMALIZED = R / (R + G + B)
  43. G_NORMALIZED = G / (R + G + B)
  44. B_NORMALIZED = B / (R + G + B)
  45. See section 8.4.5.2 in the data sheet for additional details.