Light sensor sample code functions.
More...
Light sensor sample code functions.
◆ LTR329_init()
Configure sensor with measurement rate of 2s & integration time of 50ms.
Sensor is in stand-by mode.
- Return values
-
LTR329_ERR_NONE | No error |
LTR329_ERR_I2C | Error on I2C communication |
LTR329_ERR_ID | Bad ID value |
◆ LTR329_set_standby_mode()
error_t LTR329_set_standby_mode |
( |
void |
| ) |
|
Put sensor in stand-by mode.
- Return values
-
LTR329_ERR_NONE | No error |
LTR329_ERR_I2C | Error on I2C communication |
◆ LTR329_set_active_mode()
Put sensor in active mode & configure sensor gain.
- Parameters
-
[in] | gain | Light measurement gain |
- Return values
-
LTR329_ERR_NONE | No error |
LTR329_ERR_I2C | Error on I2C communication |
LTR329_ERR_GAIN | Gain has an invalid value |
◆ LTR329_measure()
Get a light measurement.
Values must be divided by the configured gain to convert it in lux.
- Parameters
-
[out] | light_ch0 | Light level on channel 0 (visible) |
[out] | light_ch1 | Light level on channel 1 (infrared) |
- Return values
-
LTR329_ERR_NONE | No error |
LTR329_ERR_I2C | Error on I2C communication |
LTR329_ERR_MEASURE_TIMEOUT | Error, measurement is too long |