User Manual
DocID029105 Rev 1 15/26
UM2039 Ranging
26
5 Ranging
5.1 Start a measurement
The API allows to get a measurement in different ways, depending on the user
requirements:
• Start measurement only
• Start measurement and wait for data ready
• Start measurement, wait for data ready and report the data
5.1.1 Start measurement only
VL53L0X_StartMeasurement() function must be called to start a measurement. The
device will start a measurement using the chosen mode (single or continuous)
5.1.2 Start measurement and wait for data ready
VL53L0X_PerformSingleMeasurement() function starts a measurement and waits for
data ready, by polling on the ranging status or on the interrupt status.
The 2 following API functions are called internally:
•
VL53L0X_StartMeasurement()
•
VL53L0X_GetMeasurementDataReady()
5.1.3 Start measurement, wait for data ready and report the data
VL53L0X_PerformSingleRangingMeasurement() function starts a measurement,
waits for data ready (by polling on the ranging status or on the interrupt status) and reports
the data. This function also clears the interrupt after the measurement.
The 3 following API functions are called internally:
•
VL53L0X_PerformSingleMeasurement()
•
VL53L0X_GetRangingMeasurementData()
•
VL53L0X_ClearInterruptMask()
5.2 Stop a measurement
In continuous mode, Host can stop the measurement by calling
VL53L0X_StopMeasurement() function.
If the stop request occurs during a range measurement, then the measurement is
completed before stopping. If it occurs during the inter-measurement period then the stop
command takes immediate effect.
If the user wants to call an additional API function after the stop command (for example ref
temperature calibration if required - see Section 2.4), they have to ensure that the current
ranging measurement is finished first.
Therefore it is recommended to call VL53L0X_GetStopCompletedStatus() and poll
this function to ensure that the ranging measurement is completed, before calling additional
API functions.