CTL_STATUS_t ctl_light_sensor_measure(CTL_LIGHT_SENSOR_t *self,
                                      float *lux);

ctl_light_sensor_measure samples the light sensor self and writes the perceived ambient light level in lux to lux[0]. If the sensor supports separate visible+IR and IR-only sensors, the light level reported by those sensors is written to lux[1] and lux[2]. If separate readings are not supported, lux[1] and lux[2] are set to NaN.

Return Value

ctl_light_sensor_measure returns a standard status code. If the status indicates an error, the returned sample data is undefined.

Thread Safety

ctl_light_sensor_measure is thread-safe if the method measure is thread-safe. Typically, for SPI and I2C transports, you ensure thread safety by associating a mutex with the bus used by the transport.