VEML6035 - Ambient Light Sensor#
Driver for the Vishay VEML6025 ambient light sensor.
Enumerations#
Integration time settings.
Wait time between measurements in power save mode.
Interrupt persistence settings.
Functions#
Initialize and enable the VEML6035 sensor to operate in normal mode.
Retrieve the sample counts from the ALS channel and calculate the lux value.
Retrieve the sample counts from the WHITE channel and calculate the lux vaule.
Enable or disable sensor measurements.
Reset sensor configuration to the same state as after a power on reset.
Configure sensor sensitivity settings.
Set integration time.
Enable power save mode, with a defined wait time between measurements.
Configure interrupt mode.
Enable or disable threshold interrupts.
Read threshold interrupt status register and return interrupt status for high and low threshold.
Enumeration Documentation#
sl_veml6035_integration_time_t#
sl_veml6035_integration_time_t
Integration time settings.
Enumerator | |
---|---|
veml6035_integration_time_800_ms | 800ms integration time |
veml6035_integration_time_400_ms | 400ms integration time |
veml6035_integration_time_200_ms | 200ms integration time |
veml6035_integration_time_100_ms | 100ms integration time |
veml6035_integration_time_50_ms | 50ms integration time |
veml6035_integration_time_25_ms | 25ms integration time |
114
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_psm_wait_t#
sl_veml6035_psm_wait_t
Wait time between measurements in power save mode.
Enumerator | |
---|---|
veml6035_psm_wait_3200_ms | 3200ms wait time |
veml6035_psm_wait_1600_ms | 1600ms wait time |
veml6035_psm_wait_800_ms | 800ms wait time |
veml6035_psm_wait_400_ms | 400ms wait time |
124
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_als_pers_t#
sl_veml6035_als_pers_t
Interrupt persistence settings.
Enumerator | |
---|---|
veml6035_als_pers_1 | 1 sensor reading above/under threshold before interrupt trigger |
veml6035_als_pers_2 | 2 sensor readings above/under threshold before interrupt trigger |
veml6035_als_pers_4 | 4 sensor readings above/under threshold before interrupt trigger |
veml6035_als_pers_8 | 8 sensor readings above/under threshold before interrupt trigger |
132
of file hardware/driver/veml6035/inc/sl_veml6035.h
Function Documentation#
sl_veml6035_init#
sl_status_t sl_veml6035_init (sl_i2cspm_t * i2cspm, bool white_enable)
Initialize and enable the VEML6035 sensor to operate in normal mode.
[in] | i2cspm | The I2C peripheral to use. |
[in] | white_enable | Set to true to enable WHITE channel sensor readings in addition to the ALS channel. |
Note
This function configures the sensor to a default integration time of 100 ms and the lowest possible sensitivity configuration in order to achieve maximum illumination range. If the lux count is too low, consider configuring sensitivity settings with sl_veml6035_configure_sensitivity.
156
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_get_als_lux#
sl_status_t sl_veml6035_get_als_lux (sl_i2cspm_t * i2cspm, float * lux)
Retrieve the sample counts from the ALS channel and calculate the lux value.
[in] | i2cspm | The I2C peripheral to use. |
[out] | lux | The measured ambient light illuminance in lux. |
172
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_get_white_lux#
sl_status_t sl_veml6035_get_white_lux (sl_i2cspm_t * i2cspm, float * lux)
Retrieve the sample counts from the WHITE channel and calculate the lux vaule.
[in] | i2cspm | The I2C peripheral to use. |
[out] | lux | The measured white light illuminance in lux. |
188
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_enable_sensor#
sl_status_t sl_veml6035_enable_sensor (sl_i2cspm_t * i2cspm, bool enable)
Enable or disable sensor measurements.
[in] | i2cspm | The I2C peripheral to use. |
[in] | enable | Set to true to enable sensor, set to false to disable sensor. |
Note
Disabling the sensor does not make sensor lose its configuration and last measurement values.
204
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_reset#
sl_status_t sl_veml6035_reset (sl_i2cspm_t * i2cspm)
Reset sensor configuration to the same state as after a power on reset.
[in] | i2cspm | The I2C peripheral to use. |
Note
This function does not clear data output registers, or interrupt status register.
218
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_configure_sensitivity#
sl_status_t sl_veml6035_configure_sensitivity (sl_i2cspm_t * i2cspm, bool low_sensitivity, uint8_t gain)
Configure sensor sensitivity settings.
[in] | i2cspm | The I2C peripheral to use. |
[in] | low_sensitivity | Set to true for low sensitivity (1/8th of normal), false for normal sensitiviy. |
[in] | gain | Sensitivity gain, possible values: 1, 2, 4 |
Note
A low sensitivity results in a larger light sensing range, while a high sensitivity yields a higher resolution at low illumination levels.
239
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_configure_integration_time#
sl_status_t sl_veml6035_configure_integration_time (sl_i2cspm_t * i2cspm, sl_veml6035_integration_time_t integration_time)
Set integration time.
[in] | i2cspm | The I2C peripheral to use. |
[in] | integration_time | Integration time |
Note
The default integration time is 100ms. This can be increased to achieve a higher resolution, or decreased to achieve a faster measurement rate.
257
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_configure_psm#
sl_status_t sl_veml6035_configure_psm (sl_i2cspm_t * i2cspm, sl_veml6035_psm_wait_t psm_wait, bool enable)
Enable power save mode, with a defined wait time between measurements.
[in] | i2cspm | The I2C peripheral to use. |
[in] | psm_wait | The desired interval between measurements |
[in] | enable | Set to true to enable power save mode, false to disable power save mode. |
275
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_configure_interrupt_mode#
sl_status_t sl_veml6035_configure_interrupt_mode (sl_i2cspm_t * i2cspm, uint16_t high_threshold, uint16_t low_threshold, sl_veml6035_als_pers_t persistence, bool white_enable, bool enable)
Configure interrupt mode.
[in] | i2cspm | The I2C peripheral to use. |
[in] | high_threshold | Threshold for interrupt to trigger when lux value above |
[in] | low_threshold | Interrupt should trigger when lux count below this value |
[in] | persistence | How many sensor reads out of threshold window before interrupt triggers |
[in] | white_enable | Selection for which channel the interrupt should trigger. True for WHITE channel, false for ALS channel. |
[in] | enable | Set to true to enable interrupts, false to disable interrupts |
304
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_enable_interrupt_mode#
sl_status_t sl_veml6035_enable_interrupt_mode (sl_i2cspm_t * i2cspm, bool enable)
Enable or disable threshold interrupts.
[in] | i2cspm | The I2C peripheral to use. |
[in] | enable | Set to true to enable interrupt mode, false to disable interrupt mode |
323
of file hardware/driver/veml6035/inc/sl_veml6035.h
sl_veml6035_read_interrupt_status#
sl_status_t sl_veml6035_read_interrupt_status (sl_i2cspm_t * i2cspm, bool * threshold_low, bool * threshold_high)
Read threshold interrupt status register and return interrupt status for high and low threshold.
[in] | i2cspm | The I2C peripheral to use |
[out] | threshold_low | True if crossing low threshold interrupt was triggered |
[out] | threshold_high | True if crossing high threshold interrupt was triggered |
341
of file hardware/driver/veml6035/inc/sl_veml6035.h