Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
als_driver.h File Reference
Application-level methods used by VL6180X for ALS operations. More...
Go to the source code of this file.
Data Structures | |
| struct | sensor_AlsData |
| This data type defines range measurment data. More... | |
Functions | |
| sensor_error | als_set_dynamic_config (uint8_t device_base_address) |
| Device setup for ALS parameters. These settings can be applied at any time. The status of operation bit (bit 0) of the SYSALS_START is not important. | |
| sensor_error | als_set_systemMode (uint8_t device_base_address, uint8_t mode) |
| Set Mode and Operation commands in the SYSALS_START register. | |
| uint8_t | als_get_systemMode (uint8_t device_base_address) |
| Report status of ALS mode-select and Stop/Start. | |
| uint16_t | als_get_result (uint8_t device_base_address) |
| Report 16-bit result from last ALS operation. | |
| uint16_t | als_get_lux (uint8_t device_base_address) |
| Report 16-bit result from last ALS operation. | |
| sensor_error | als_set_thresholds (uint8_t device_base_address, uint16_t low_threshold, uint16_t high_threshold) |
| Set min/max ALS thresholds (units?) in SYSALS_THRESH_LOW & SYSALS_THRESH_HIGH registers. | |
| sensor_error | als_set_high_threshold (uint8_t device_base_address, uint16_t threshold) |
| Set ALS high threshold the SYSALS_THRESH_HIGH register. | |
| uint16_t | als_get_high_threshold (uint8_t device_base_address) |
| Report ALS high threshold from the SYSALS_THRESH_HIGH register. | |
| sensor_error | als_set_low_threshold (uint8_t device_base_address, uint16_t threshold) |
| Set ALS low threshold the SYSALS_THRESH_LOW register. | |
| uint16_t | als_get_low_threshold (uint8_t device_base_address) |
| Report ALS low threshold from the SYSALS_THRESH_LOW register. | |
| sensor_error | als_set_interMeasurement_period (uint8_t device_base_address, uint16_t intermeasurement_period) |
| Set ALS intermeasurement period in the SYSALS_INTERMEASUREMENT_PERIOD register. | |
| uint16_t | als_get_interMeasurement_period (uint8_t device_base_address) |
| Report ALS intermeasurement period from the SYSALS_INTERMEASUREMENT_PERIOD register. | |
| sensor_error | als_set_analogue_gain (uint8_t device_base_address, uint8_t light_analogue_gain) |
| Set dark/light ALS analogue gains in the SYSALS_ANALOGUE_GAIN register. | |
| uint8_t | als_get_analogue_gain (uint8_t device_base_address) |
| Report ALS analogue gain from the SYSALS_ANALOGUE_GAIN register. | |
| sensor_error | als_set_integration_period (uint8_t device_base_address, uint16_t integration_period) |
| Set ALS Integration Period in the SYSALS_INTEGRATION_PERIOD register. | |
| uint16_t | als_get_integration_period (uint8_t device_base_address) |
| Report ALS Integration Period from the SYSALS_INTEGRATION_PERIOD register. | |
| uint8_t | als_get_result_status (uint8_t device_base_address) |
| Report ALS Result Status from RESULT_ALS_STATUS register. | |
| bool_t | als_get_device_ready (uint8_t device_base_address) |
| Report result_ALS_device_ready status in the ALS_RANGE_STATUS register. | |
| uint8_t | als_get_result_error_codes (uint8_t device_base_address) |
| Report ALS Result Error Codes from RESULT_ALS_STATUS register. | |
| sensor_error | als_set_interleaved_mode (uint8_t device_base_address) |
| Enable Interleaved Mode. | |
| sensor_error | als_clear_interleaved_mode (uint8_t device_base_address) |
| Disable Interleaved Mode. | |
| uint8_t | als_get_interleaved_mode (uint8_t device_base_address) |
| Report Interleaved Mode. | |
| sensor_error | als_set_system_interrupt_config_gpio (uint8_t device_base_address, uint8_t ALS_GPIO_interrupt_config) |
| Set System Interrupt Config GPIO for ALS operations. | |
| uint8_t | als_get_system_interrupt_config_gpio (uint8_t device_base_address) |
| Report System Interrupt Config GPIO ALS. | |
| uint8_t | als_get_result_interrupt_status_gpio (uint8_t device_base_address) |
| Report GPIO Interrupt Result Status for an ALS operation. | |
| sensor_error | als_set_system_interrupt_clear (uint8_t device_base_address) |
| Clear ALS System Interrupt. | |
| sensor_error | als_set_history_buffer_mode_enable (uint8_t device_base_address) |
| Set history buffer to ALS mode and enable. | |
Detailed Description
Application-level methods used by VL6180X for ALS operations.
Definition in file als_driver.h.
Function Documentation
| sensor_error als_clear_interleaved_mode | ( | uint8_t | device_base_address ) |
Disable Interleaved Mode.
- Parameters:
-
[in] device_base_address
- Return values:
-
sensor_error
Definition at line 356 of file als_driver.cpp.
Report ALS analogue gain from the SYSALS_ANALOGUE_GAIN register.
- Parameters:
-
[in] device_base_address
- Return values:
-
an 8-bit integer.
Definition at line 257 of file als_driver.cpp.
Report result_ALS_device_ready status in the ALS_RANGE_STATUS register.
- Parameters:
-
[in] device_base_address
- Return values:
-
True if the result_ALS_device_ready bit in the RESULT_ALS_STATUS register is set, otherwise False.
Definition at line 323 of file als_driver.cpp.
Report ALS high threshold from the SYSALS_THRESH_HIGH register.
- Parameters:
-
[in] device_base_address
- Return values:
-
uint16_t (unsigned, word-wide integer)
Definition at line 155 of file als_driver.cpp.
Report ALS Integration Period from the SYSALS_INTEGRATION_PERIOD register.
- Parameters:
-
[in] device_base_address
- Return values:
-
a 16-bit integer.
Definition at line 300 of file als_driver.cpp.
Report Interleaved Mode.
- Parameters:
-
[in] device_base_address
- Return values:
-
an 8-bit integer.
Definition at line 365 of file als_driver.cpp.
Report ALS intermeasurement period from the SYSALS_INTERMEASUREMENT_PERIOD register.
Range 0-2.55s, 1 code = 10 ms
- Parameters:
-
[in] device_base_address
- Return values:
-
an 16-bit integer as time in ms.
Definition at line 196 of file als_driver.cpp.
Report ALS low threshold from the SYSALS_THRESH_LOW register.
- Parameters:
-
[in] device_base_address
- Return values:
-
uint16_t (unsigned, word-wide integer)
Definition at line 175 of file als_driver.cpp.
Report 16-bit result from last ALS operation.
Reads the latest ALS measurement and reports to the calling operation in LUX.
- Parameters:
-
[in] device_base_address
- Return values:
-
uint16_t (unsigned, word-wide integer)
Definition at line 118 of file als_driver.cpp.
Report 16-bit result from last ALS operation.
Accesses the RESULT_ALS_VAL register, to report the latest ALS raw measurement.
- Parameters:
-
[in] device_base_address
- Return values:
-
uint16_t (unsigned, word-wide integer)
Definition at line 107 of file als_driver.cpp.
Report ALS Result Error Codes from RESULT_ALS_STATUS register.
- Parameters:
-
[in] device_base_address
- Return values:
-
an 8-bit integer.
Definition at line 337 of file als_driver.cpp.
Report GPIO Interrupt Result Status for an ALS operation.
Returns the ALS-only portion of the RESULT_INTERRUPT_STATUS_GPIO register.
Possible returns are :
0: No threshold events reported
1: Level Low threshold event
2: Level High threshold event
3: Out Of Window threshold event
4: New Sample Ready threshold event
- Parameters:
-
[in] device_base_address
- Return values:
-
Integer
Definition at line 418 of file als_driver.cpp.
Report ALS Result Status from RESULT_ALS_STATUS register.
- Parameters:
-
[in] device_base_address
- Return values:
-
an 8-bit integer.
Definition at line 314 of file als_driver.cpp.
Report System Interrupt Config GPIO ALS.
Returns the ALS-only portion of the SYSTEM_INTERRUPT_CONFIG_GPIO register.
Possible returns are :
CONFIG_GPIO_INTERRUPT_DISABLED = 0x00
CONFIG_GPIO_INTERRUPT_LEVEL_LOW = 0x01
CONFIG_GPIO_INTERRUPT_LEVEL_HIGH = 0x02
CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW = 0x03
CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY = 0x04
- Parameters:
-
[in] device_base_address
- Return values:
-
Integer
Definition at line 406 of file als_driver.cpp.
Report status of ALS mode-select and Stop/Start.
Returns a reading of the SYSALS_START register.
Possible results are :
ALS_START_SINGLESHOT 0x01 (bit 0 set / bit 1 clear)
ALS_START_CONTINUOUS 0x03 (bit 0 set / bit 1 set)
ALS_STOP 0x01 (bit 0 set / bit 1 don't care)
- Parameters:
-
[in] device_base_address
- Return values:
-
uint8_t (unsigned, byte-wide integer)
Definition at line 96 of file als_driver.cpp.
Set dark/light ALS analogue gains in the SYSALS_ANALOGUE_GAIN register.
Light gain will be clipped to a maximum value of 7.
Dark Gain is frozen at 4.
[2:0] sysals_analogue_gain_light: ALS analogue gain (light channel)
0: ALS Gain = 20
1: ALS Gain = 10
2: ALS Gain = 5.0
3: ALS Gain = 2.5
4: ALS Gain = 1.67
5: ALS Gain = 1.25
6: ALS Gain = 1.0
7: ALS Gain = 40 (testmode)
- Parameters:
-
[in] device_base_address [in] light_analogue_gain light gain
- Return values:
-
sensor_error
Definition at line 208 of file als_driver.cpp.
| sensor_error als_set_dynamic_config | ( | uint8_t | device_base_address ) |
Device setup for ALS parameters. These settings can be applied at any time. The status of operation bit (bit 0) of the SYSALS_START is not important.
- Parameters:
-
[in] device_base_address
- Return values:
-
sensor_error
Definition at line 46 of file als_driver.cpp.
Set ALS high threshold the SYSALS_THRESH_HIGH register.
- Parameters:
-
[in] device_base_address [in] threshold Word-wide, integer, ALS high threshold to be written to the SYSALS_THRESH_HIGH register.
- Return values:
-
sensor_error
Definition at line 146 of file als_driver.cpp.
| sensor_error als_set_history_buffer_mode_enable | ( | uint8_t | device_base_address ) |
Set history buffer to ALS mode and enable.
- Parameters:
-
[in] device_base_address
- Return values:
-
sensor_error
Definition at line 439 of file als_driver.cpp.
| sensor_error als_set_integration_period | ( | uint8_t | device_base_address, |
| uint16_t | integration_period | ||
| ) |
Set ALS Integration Period in the SYSALS_INTEGRATION_PERIOD register.
- Parameters:
-
[in] device_base_address [in] integration_period Integration period for ALS mode, in ms. 1 code = 1ms [codes (0:464) == (1ms:465ms)]
- Return values:
-
sensor_error
Definition at line 268 of file als_driver.cpp.
| sensor_error als_set_interleaved_mode | ( | uint8_t | device_base_address ) |
Enable Interleaved Mode.
- Parameters:
-
[in] device_base_address
- Return values:
-
sensor_error
Definition at line 347 of file als_driver.cpp.
| sensor_error als_set_interMeasurement_period | ( | uint8_t | device_base_address, |
| uint16_t | intermeasurement_period | ||
| ) |
Set ALS intermeasurement period in the SYSALS_INTERMEASUREMENT_PERIOD register.
Range 10ms-2.55s, 1 code = 10 ms, code 0 = 10ms
- Parameters:
-
[in] device_base_address [in] intermeasurement_period,: Time delay in ms between measurements in continuous-ALS mode.
- Return values:
-
sensor_error
Definition at line 184 of file als_driver.cpp.
Set ALS low threshold the SYSALS_THRESH_LOW register.
- Parameters:
-
[in] device_base_address [in] threshold ALS low threshold to be written to the SYSALS_THRESH_LOW register.
- Return values:
-
sensor_error
Definition at line 166 of file als_driver.cpp.
| sensor_error als_set_system_interrupt_clear | ( | uint8_t | device_base_address ) |
Clear ALS System Interrupt.
- Parameters:
-
[in] device_base_address
- Return values:
-
sensor_error
Definition at line 429 of file als_driver.cpp.
| sensor_error als_set_system_interrupt_config_gpio | ( | uint8_t | device_base_address, |
| uint8_t | ALS_GPIO_interrupt_config | ||
| ) |
Set System Interrupt Config GPIO for ALS operations.
Returns True a valid command was completed successfully, otherwise False.
Possible settings are :
CONFIG_GPIO_INTERRUPT_DISABLED = 0x00
CONFIG_GPIO_INTERRUPT_LEVEL_LOW = 0x01
CONFIG_GPIO_INTERRUPT_LEVEL_HIGH = 0x02
CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW = 0x03
CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY = 0x04
- Parameters:
-
[in] device_base_address [in] ALS_GPIO_interrupt_config,:
- Return values:
-
sensor_error
Definition at line 378 of file als_driver.cpp.
Set Mode and Operation commands in the SYSALS_START register.
Possible combinations are :
ALS_START_SINGLESHOT 0x01 (bit 0 set / bit 1 clear)
ALS_START_CONTINUOUS 0x03 (bit 0 set / bit 1 set)
ALS_STOP 0x01 (bit 0 set / bit 1 don't care)
- Parameters:
-
[in] device_base_address [in] mode Mode select/operation command to be written to the SYSALS_START register.
- Return values:
-
sensor_error
Definition at line 63 of file als_driver.cpp.
| sensor_error als_set_thresholds | ( | uint8_t | device_base_address, |
| uint16_t | low_threshold, | ||
| uint16_t | high_threshold | ||
| ) |
Set min/max ALS thresholds (units?) in SYSALS_THRESH_LOW & SYSALS_THRESH_HIGH registers.
- Parameters:
-
[in] device_base_address [in] low_threshold Byte-wide, integer, ALS low threshold to be written to the SYSALS_THRESH_LOW register. [in] high_threshold Byte-wide, integer, ALS high threshold to be written to the SYSALS_THRESH_HIGH register.
- Return values:
-
sensor_error
Definition at line 136 of file als_driver.cpp.
Generated on Tue Jul 12 2022 22:19:50 by
1.7.2