Condensed Version of Public VL53L0X

Dependents:   ToF-Only-Tryout

Embed: (wiki syntax)

« Back to documentation index

VL53L0X Class Reference

VL53L0X Class Reference

Class representing a VL53L0 sensor component. More...

#include <VL53L0X.h>

Public Member Functions

 VL53L0X (I2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr=VL53L0X_DEFAULT_ADDRESS)
 Constructor.
VL53L0X_Error Start_Sensor (uint8_t new_addr=VL53L0X_DEFAULT_ADDRESS)
 Turns on, checks the ID, Set new device address, Initialize the calss, and the sensor with default values.
void Power_Off (void)
 PowerOff the sensor with the XShutdown Pin.
virtual ~VL53L0X ()
 Destructor.
VL53L0X_Error Start_Measurement (TOperatingMode operating_mode, void(*fptr)(void))
 Start the measure indicated by operating mode.
TRangeResults Get_Measurement (TOperatingMode operating_mode)
 Get results for the measure indicated by operating mode.
VL53L0X_Error Stop_Measurement (TOperatingMode operating_mode)
 Stop the currently running measure indicate by operating_mode.
TRangeResults Handle_irq (TOperatingMode operating_mode)
 Interrupt handling func to be called by user after an INT is occourred.
void Enable_interrupt_measure_detection_irq (void)
 Enable interrupt measure IRQ.
void Disable_interrupt_measure_detection_irq (void)
 Disable interrupt measure IRQ "0" on success.
void Attach_interrupt_measure_detection_irq (void(*fptr)(void))
 Attach a function to call when an interrupt is detected, i.e.
VL53L0X_Error Prepare ()
 Prepare device for operation.
void Range_start_continuous_mode ()
 Start continuous ranging mode.
uint32_t Get_distance ()
 Get ranging result and only that.
void Static_init ()
 Do basic device init (and eventually patch loading) This function will change the VL53L0X_State from VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
void Perf_Ref_calibration (uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable)
 Perform Reference Calibration.
void Get_Ref_calibration (uint8_t *p_vhv_settings, uint8_t *p_phase_cal)
 Get Reference Calibration Parameters.
void Perf_Ref_SPAD_management (uint32_t *ref_SPAD_count, uint8_t *is_aperture_SPADS)
 Performs Reference SPAD Management.
void Set_Reference_SPADS (uint32_t refSPADCount, uint8_t is_aperture_SPADS)
 Applies Reference SPAD configuration.
void Get_Reference_SPADS (uint32_t *p_SPAD_count, uint8_t *p_is_aperture_SPADS)
 Retrieves SPAD configuration.
int32_t Get_Offset_Cal_um ()
 Get part to part calibration offset.
void Set_Offset_Cal_um (int32_t Offset_Cal_um)
 Set or over-hide part to part calibration offset.
void Perf_xtalk_measurement (uint32_t timeout_ms, TFP1616 *p_xtalk_per_SPAD, uint8_t *p_ambient_too_high)
 Perform XTalk Measurement.
void Set_xtalk_compensation_enable (uint8_t xtalk_compensation_enable)
 Enable/Disable Cross talk compensation feature.
void Set_Xtalk_CompRate_MHz (TFP1616 Xtalk_CompRate_MHz)
 Set Cross talk compensation rate.
void Get_Xtalk_CompRate_MHz (TFP1616 *p_Xtalk_CompRate_MHz)
 Get Cross talk compensation rate.
void Set_device_mode (VL53L0X_DeviceModes device_mode)
 Set a new device mode.
void Get_gpio_config (uint8_t pin, VL53L0X_DeviceModes *p_device_mode, TGPIO_Func *p_functionality, VL53L0X_InterruptPolarity *p_polarity)
 Get current configuration for GPIO pin for a given device.
void Set_GPIO_config (VL53L0X_DeviceModes device_mode, TGPIO_Func functionality, VL53L0X_InterruptPolarity polarity)
 Set the configuration of GPIO pin for a given device.
void Start_Measurement ()
 Start device measurement.
void Stop_Measurement ()
 Stop device measurement.
uint8_t Get_Stop_Completed ()
 Return device stop completion ErrState.
uint8_t Get_Measurement_Ready ()
 Return Measurement is Ready.
void Get_ranging_results (TRangeResults *p_ranging_results)
 Retrieve the measurements from device for a given setup.
void Clear_interrupt_mask (uint32_t interrupt_mask)
 Clear given system interrupt condition.
void Get_interrupt_mask_status (uint32_t *p_interrupt_mask_status)
 Return device interrupt ErrState.
void Perf_single_ranging_measurement (TRangeResults *p_ranging_results)
 Performs a single ranging measurement and retrieve the ranging measurement data.
void Perf_single_measurement ()
 Single shot measurement.
void Get_device_error_status (TDevError *p_device_error_status)
 Read current ErrState of the error register for the selected device.
void Get_device_error_string (TDevError error_code, char *p_device_error_string)
 Human readable error string for a given Error Code.
uint32_t Get_Measure_Time_Budget_us ()
 Get Ranging Timing Budget in microseconds.
void Set_Measure_Time_Budget_us (uint32_t Measure_Time_Budget_us)
 Set Ranging Timing Budget in microseconds.
uint8_t Get_limit_chk_en (uint16_t limit_check_id)
 Get specific limit check enable state.
void Set_limit_chk_en (uint16_t limit_check_id, uint8_t limit_chk_en)
 Enable/Disable a specific limit check.
TFP1616 Get_limit_chk_val (uint16_t limit_check_id)
 Get a specific limit check value.
void Set_limit_chk_val (uint16_t limit_check_id, TFP1616 limit_chk_val)
 Set a specific limit check value.
void Get_limit_check_current (uint16_t limit_check_id, TFP1616 *p_limit_check_current)
 Get the current value of the signal used for the limit check.
void Get_limit_check_status (uint16_t limit_check_id, uint8_t *p_limit_check_status)
 Return a the Status of the specified check limit.
void Get_measure_period_ms (uint32_t *p_measure_period_ms)
 Get continuous mode Inter-Measurement period in milliseconds.
void Set_measure_period_ms (uint32_t measure_period_ms)
 Program continuous mode Inter-Measurement period in milliseconds.
void Reset_device ()
 Do an hard reset or soft reset (depending on implementation) of the device call of this function, device must be in same state as right after a power-up sequence.This function will change the VL53L0X_State to VL53L0X_STATE_POWERDOWN.
uint8_t Get_Wrap_Around_Chk_En ()
 Get setup of Wrap around Check.
void Set_wrap_around_Chk_En (uint8_t wrap_around_Chk_En)
 Enable (or disable) Wrap around Check.
void Set_vcsel_PPeriod (VL53L0X_Range_Phase Vcsel_Range_Phase, uint8_t vcsel_PPeriod)
 Sets the VCSEL pulse period.
void Set_interrupt_thresholds (VL53L0X_DeviceModes device_mode, TFP1616 threshold_low, TFP1616 threshold_high)
 Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device.
void Get_interrupt_thresholds (VL53L0X_DeviceModes device_mode, TFP1616 *p_threshold_low, TFP1616 *p_threshold_high)
 Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device.
VL53L0X_Sequence_Steps_t Get_sequence_step_enables ()
 Gets the (on/off) state of all sequence steps.
void Set_sequence_step_enable (VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled)
 Sets the (on/off) state of a requested sequence step.
void Get_fraction_enable (uint8_t *p_enabled)
 Gets the fraction enable parameter indicating the resolution of range measurements.
void Set_range_fraction_enable (uint8_t enable)
 Sets the resolution of range measurements.
void Get_version (VL53L0X_Version_t *p_version)
 Return the VL53L0X Device Implementation Version.
void Get_product_revision (uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor)
 Reads the Product Revision for a for given Device This function can be used to distinguish cut1.0 from cut1.1.
VL53L0X_DeviceParams_t Get_device_parameters ()
 Retrieve current device parameters.
void Get_Device_spec_version (VL53L0X_Version_t *p_Device_spec_version)
 Return the Device Specification Version used for the current implementation.
void Get_Device_state (VL53L0X_State *p_Device_state)
 Reads the internal state of the Device for a given Device.

Data Fields

uint32_t FinalRangeTimeoutMicroSecs
uint8_t FinalRangeVcselPPeriod
uint32_t PreRangeTimeoutMicroSecs
uint8_t PreRangeVcselPPeriod
uint16_t SigmaEstRefArray
uint16_t SigmaEstEffPulseWidth
uint16_t SigmaEstEffAmbWidth
uint32_t PartUIDUpper
uint32_t PartUIDLower
TFP1616 SignalRateMeasFixed400mm
VL53L0X_State Current_State

Detailed Description

Class representing a VL53L0 sensor component.

Definition at line 41 of file VL53L0X.h.


Constructor & Destructor Documentation

VL53L0X ( I2C *  i2c,
DigitalOut *  pin,
PinName  pin_gpio1,
uint8_t  dev_addr = VL53L0X_DEFAULT_ADDRESS 
)

Constructor.

Parameters:
[in]&i2cdevice I2C to be used for communication
[in]&pin_gpio1pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
[in]dev_addrdevice address, 0x29 by default

Definition at line 88 of file VL53L0X.h.

virtual ~VL53L0X (  ) [virtual]

Destructor.

Definition at line 115 of file VL53L0X.h.


Member Function Documentation

void Attach_interrupt_measure_detection_irq ( void(*)(void)  fptr )

Attach a function to call when an interrupt is detected, i.e.

measurement is ready

Parameters:
[in]fptrpointer to call back function to be called whenever an interrupt occours "0" on success

Definition at line 210 of file VL53L0X.h.

void Clear_interrupt_mask ( uint32_t  interrupt_mask )

Clear given system interrupt condition.

Function Description
Clear given interrupt(s) cause by writing into register SYSINT_CLEAR register.
Note:
This function Access to the device
Parameters:
interrupt_maskWhich interrupt source to clear. Use any combinations of INTERRUPT_CLEAR_RANGING , INTERRUPT_CLEAR_ALS , INTERRUPT_CLEAR_ERROR.
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts

Definition at line 916 of file VL53L0X.cpp.

void Disable_interrupt_measure_detection_irq ( void   )

Disable interrupt measure IRQ "0" on success.

Definition at line 202 of file VL53L0X.h.

void Enable_interrupt_measure_detection_irq ( void   )

Enable interrupt measure IRQ.

Definition at line 195 of file VL53L0X.h.

void Get_device_error_status ( TDevError *  p_device_error_status )

Read current ErrState of the error register for the selected device.

Note:
This function Access to the device
Parameters:
p_device_error_statusPointer to current error code of the device
Returns:
None; instead check class Field "ErrState"
void Get_device_error_string ( TDevError  error_code,
char *  p_device_error_string 
)

Human readable error string for a given Error Code.

Note:
This function doesn't access to the device
Parameters:
error_codeThe error code as stored on TDevError
p_device_error_stringThe error string corresponding to the ErrorCode
Returns:
None; instead check class Field "ErrState"
VL53L0X_DeviceParams_t Get_device_parameters (  )

Retrieve current device parameters.

Function Description
Get actual parameters of the device
  • Then start ranging operation.
Note:
This function Access to the device
Returns:
VL53L0X_DeviceParams_t Current device parameters. Also check class Field "ErrState"

Definition at line 807 of file VL53L0X.cpp.

void Get_Device_spec_version ( VL53L0X_Version_t p_Device_spec_version )

Return the Device Specification Version used for the current implementation.

Note:
This function doesn't access to the device
Parameters:
p_Device_spec_versionPointer to current Device Specification Version
Returns:
None; instead check class Field "ErrState"
void Get_Device_state ( VL53L0X_State *  p_Device_state )

Reads the internal state of the Device for a given Device.

Note:
This function doesn't access to the device
Parameters:
p_Device_statePointer to current state of the Device for a given Device
Returns:
None; instead check class Field "ErrState"
void Get_fraction_enable ( uint8_t *  p_enabled )

Gets the fraction enable parameter indicating the resolution of range measurements.

Function Description
Gets the fraction enable state, which translates to the resolution of range measurements as follows :Enabled:=0.25mm resolution, Not Enabled:=1mm resolution.
Note:
This function Accesses the device
Parameters:
p_enabledOutput Parameter reporting the fraction enable state.
Returns:
None; instead check class Field "ErrState"
void Get_gpio_config ( uint8_t  pin,
VL53L0X_DeviceModes *  p_device_mode,
TGPIO_Func p_functionality,
VL53L0X_InterruptPolarity *  p_polarity 
)

Get current configuration for GPIO pin for a given device.

Note:
This function Access to the device
Parameters:
pinID of the GPIO Pin
p_device_modePointer to Device Mode associated to the Gpio.
p_functionalityPointer to Pin functionality. Refer to TGPIO_Func
p_polarityPointer to interrupt polarity. Active high or active low see VL53L0X_InterruptPolarity
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
VL53L0X_ERROR_GPIO_FUNC_NOT_SUPPORTED This error occurs when Funcionality programmed is not in the supported list: Supported value are: GPIO_FUNC_OFF, GPIO_FUNC_THRESHOLD_CROSSED_LOW, GPIO_FUNC_THRESHOLD_CROSSED_HIGH, GPIO_FUNC_THRESHOLD_CROSSED_OUT, GPIO_FUNC_NEW_MEASURE_READY
void Get_interrupt_mask_status ( uint32_t *  p_interrupt_mask_status )

Return device interrupt ErrState.

Function Description
Returns currently raised interrupts by the device. User shall be able to activate/deactivate interrupts through VL53L0X_SetGpioConfig()
Note:
This function Access to the device
Parameters:
p_interrupt_mask_statusPointer to ErrState variable to update
Returns:
None; instead check class Field "ErrState"

Definition at line 871 of file VL53L0X.cpp.

void Get_interrupt_thresholds ( VL53L0X_DeviceModes  device_mode,
TFP1616 p_threshold_low,
TFP1616 p_threshold_high 
)

Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device.

Function Description
Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device
Note:
This function Access to the device
DeviceMode is ignored for the current device
Parameters:
device_modeDevice Mode from which read thresholds
p_threshold_lowLow threshold (mm, lux ..., depending on the mode)
p_threshold_highHigh threshold (mm, lux ..., depending on the mode)
Returns:
None; instead check class Field "ErrState"

Definition at line 1178 of file VL53L0X.cpp.

void Get_limit_check_current ( uint16_t  limit_check_id,
TFP1616 p_limit_check_current 
)

Get the current value of the signal used for the limit check.

Function Description
This function get a the current value of the signal used for the limit check. To obtain the latest value you should run a ranging before. The value reported is linked to the limit check identified with the limit_check_id.
Note:
This function Access to the device
Parameters:
limit_check_idLimit Check ID (0<= limit_check_id < VL53L0X_GetNumberOfLimitCheck() ).
p_limit_check_currentPointer to current Value for a given limit_check_id.
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS This error is returned when limit_check_id value is out of range.
void Get_limit_check_status ( uint16_t  limit_check_id,
uint8_t *  p_limit_check_status 
)

Return a the Status of the specified check limit.

Function Description
This function returns the Status of the specified check limit. The value indicate if the check is fail or not. The limit check is identified with the limit_check_id.
Note:
This function doesn't Access to the device
Parameters:
limit_check_idLimit Check ID (0<= limit_check_id < VL53L0X_GetNumberOfLimitCheck() ).
p_limit_check_statusPointer to the Limit Check Status of the given check limit. LimitCheckStatus : 0 the check is not fail 1 the check if fail or not enabled
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS This error is returned when limit_check_id value is out of range.
uint8_t Get_limit_chk_en ( uint16_t  limit_check_id )

Get specific limit check enable state.

Function Description
This function get the enable state of a specific limit check. The limit check is identified with the limit_check_id.
Note:
This function Access to the device
Parameters:
limit_check_idLimit Check ID (0<= limit_check_id < VL53L0X_GetNumberOfLimitCheck() ).
Returns:
uint8_t Check limit enable value. if 1 the check limit corresponding to limit_check_id is Enabled if 0 the check limit corresponding to limit_check_id is disabled
also check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS This error is returned when limit_check_id value is out of range.

Definition at line 492 of file VL53L0X.cpp.

TFP1616 Get_limit_chk_val ( uint16_t  limit_check_id )

Get a specific limit check value.

Function Description
This function get a specific limit check value from device then it updates internal values and check enables. The limit check is identified with the limit_check_id.
Note:
This function Access to the device
Parameters:
limit_check_idLimit Check ID (0<= limit_check_id < VL53L0X_GetNumberOfLimitCheck() ).
Returns:
TFP1616 Limit check Value for a given limit_check_id.
Also check class Field "ErrState";returned VL53L0X_ERROR_INVALID_PARAMS when limit_check_id value is out of range.

Definition at line 460 of file VL53L0X.cpp.

void Get_measure_period_ms ( uint32_t *  p_measure_period_ms )

Get continuous mode Inter-Measurement period in milliseconds.

Function Description
When trying to set too short time return INVALID_PARAMS minimal value
Note:
This function Access to the device
Parameters:
p_measure_period_msPointer to programmed Inter-Measurement Period in milliseconds.
Returns:
None; instead check class Field "ErrState"

Definition at line 424 of file VL53L0X.cpp.

uint32_t Get_Measure_Time_Budget_us (  )

Get Ranging Timing Budget in microseconds.

Function Description
Returns the programmed the maximum time allowed by the user to the device to run a full ranging sequence for the current mode (ranging, histogram, ASL ...)
Note:
This function Access to the device
Returns:
uint32_t Max measurement time in microseconds. Valid values are: >= 17000 microsecs when wraparound enabled >= 12000 microsecs when wraparound disabled Also check class Field "ErrState"

Definition at line 753 of file VL53L0X.cpp.

TRangeResults Get_Measurement ( TOperatingMode  operating_mode )

Get results for the measure indicated by operating mode.

Parameters:
[in]operating_modespecifies requested measure results
Returns:
TRangeResults The MeasureData_t structure with all results

Definition at line 347 of file VL53L0X.cpp.

uint8_t Get_Measurement_Ready (  )

Return Measurement is Ready.

Function Description
This function indicate that a measurement data is ready. This function check if interrupt mode is used then check is done accordingly. If perform function clear the interrupt, this function will not work, like in case of VL53L0X_PerformSingleRangingMeasurement(). The previous function is blocking function, VL53L0X_GetMeasurementDataReady is used for non-blocking capture.
Note:
This function Access to the device
Returns:
uint8_t Is Measurement Ready 0= not ready, 1 = ready Also check class Field "ErrState"

Definition at line 879 of file VL53L0X.cpp.

int32_t Get_Offset_Cal_um (  )

Get part to part calibration offset.

Get part to part calibration offset; Should only be used after a successful call to VL53L0X_DataInit to backup device NVM value.

Function Description
Should only be used after a successful call to VL53L0X_DataInit to backup device NVM value
Note:
This function Access to the device
Parameters:
p_Offset_Cal_um
Returns:
int32_t; Return part to part calibration offset from device (microns), also check class Field "ErrState"

Definition at line 371 of file VL53L0X.cpp.

void Get_product_revision ( uint8_t *  p_product_revision_major,
uint8_t *  p_product_revision_minor 
)

Reads the Product Revision for a for given Device This function can be used to distinguish cut1.0 from cut1.1.

Note:
This function Access to the device
Parameters:
p_product_revision_majorPointer to Product Revision Major for a given Device
p_product_revision_minorPointer to Product Revision Minor for a given Device
Returns:
None; instead check class Field "ErrState"
void Get_Ref_calibration ( uint8_t *  p_vhv_settings,
uint8_t *  p_phase_cal 
)

Get Reference Calibration Parameters.

Function Description
Get Reference Calibration Parameters.
Note:
This function Access to the device
Parameters:
p_vhv_settingsPointer to VHV parameter
p_phase_calPointer to PhaseCal Parameter
Returns:
None; instead check class Field "ErrState"
void Get_Reference_SPADS ( uint32_t *  p_SPAD_count,
uint8_t *  p_is_aperture_SPADS 
)

Retrieves SPAD configuration.

Function Description
This function retrieves the current number of applied reference SPADS and also their type : Aperture or Non-Aperture.
Note:
This function Access to the device
Parameters:
p_SPAD_countNumber ref SPAD Count
p_is_aperture_SPADSReports if SPADS are of type aperture or non-aperture. 1:=aperture, 0:=Non-Aperture
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference SPAD configuration.
VL53L0X_Sequence_Steps_t Get_sequence_step_enables (  )

Gets the (on/off) state of all sequence steps.

Function Description
This function retrieves the state of all sequence step in the scheduler.
Note:
This function Accesses the device
Returns:
VL53L0X_Sequence_Steps_t Struct containing result. Also check class Field "ErrState"

Definition at line 512 of file VL53L0X.cpp.

void Get_version ( VL53L0X_Version_t p_version )

Return the VL53L0X Device Implementation Version.

Note:
This function doesn't access to the device
Parameters:
p_versionPointer to current Device Implementation Version
Returns:
None; instead check class Field "ErrState"
uint8_t Get_Wrap_Around_Chk_En (  )

Get setup of Wrap around Check.

Function Description
This function get the wrapAround check enable parameters
Note:
This function Access to the device
Returns:
uint8_t Wrap around Check state 0=disabled or 1 = enabled
None Also check class Field "ErrState"

Definition at line 499 of file VL53L0X.cpp.

void Get_Xtalk_CompRate_MHz ( TFP1616 p_Xtalk_CompRate_MHz )

Get Cross talk compensation rate.

Function Description
Get Cross talk compensation rate.
Note:
This function Access to the device
Parameters:
p_Xtalk_CompRate_MHzPointer to Compensation rate in Mega counts per second (16.16 fix point) see datasheet for details
Returns:
None; instead check class Field "ErrState"

Definition at line 439 of file VL53L0X.cpp.

void Perf_Ref_calibration ( uint8_t *  p_vhv_settings,
uint8_t *  p_phase_cal,
uint8_t  get_data_enable 
)

Perform Reference Calibration.

Perform a reference calibration of the Device. This function should be run from time to time before doing a ranging measurement. This function will launch a special ranging measurement, so if interrupt are enable an interrupt will be done. This function will clear the interrupt generated automatically.

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
p_vhv_settingsPointer to vhv settings parameter.
p_phase_calPointer to PhaseCal parameter.
get_data_enable1 to enable to get the data
Returns:
None; instead check class Field "ErrState"

Definition at line 1018 of file VL53L0X.cpp.

void Perf_single_measurement (  )

Single shot measurement.

Function Description
Perform simple measurement sequence (Start measure, Wait measure to end, and returns when measurement is done). Once function returns, user can get valid data by calling VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement depending on defined measurement mode User should Clear the interrupt in case this are enabled by using the function VL53L0X_ClearInterruptMask().
Warning:
This function is a blocking function
Note:
This function Access to the device
Returns:
None; instead check class Field "ErrState"

Definition at line 1354 of file VL53L0X.cpp.

void Perf_xtalk_measurement ( uint32_t  timeout_ms,
TFP1616 p_xtalk_per_SPAD,
uint8_t *  p_ambient_too_high 
)

Perform XTalk Measurement.

Measures the current cross talk from glass in front of the sensor. This functions performs a histogram measurement and uses the results to measure the crosstalk. For the function to be successful, there must be no target in front of the sensor.

Warning:
This function is a blocking function
This function is not supported when the final range vcsel clock period is set below 10 PCLKS.
Note:
This function Access to the device
Parameters:
timeout_msHistogram measurement duration.
p_xtalk_per_SPADOutput parameter containing the crosstalk measurement result, in MHz/SPAD. Format fixpoint 16:16.
p_ambient_too_highOutput parameter which indicate that pXtalkPerSPAD is not good if the Ambient is too high.
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported for this operation. Must not be less than 10PCLKS.
void Power_Off ( void   )

PowerOff the sensor with the XShutdown Pin.

Definition at line 110 of file VL53L0X.h.

void Reset_device (  )

Do an hard reset or soft reset (depending on implementation) of the device call of this function, device must be in same state as right after a power-up sequence.This function will change the VL53L0X_State to VL53L0X_STATE_POWERDOWN.

Note:
This function Access to the device
Returns:
None; instead check class Field "ErrState"
void Set_device_mode ( VL53L0X_DeviceModes  device_mode )

Set a new device mode.

Function Description
Set device to a new mode (ranging, histogram ...)
Note:
This function doesn't Access to the device
Parameters:
device_modeNew device mode to apply Valid values are: VL53L0X_DEVICEMODE_SINGLE_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY VL53L0X_HISTOGRAMMODE_RETURN_ONLY VL53L0X_HISTOGRAMMODE_BOTH
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when DeviceMode is not in the supported list

Definition at line 1148 of file VL53L0X.cpp.

void Set_interrupt_thresholds ( VL53L0X_DeviceModes  device_mode,
TFP1616  threshold_low,
TFP1616  threshold_high 
)

Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device.

Function Description
Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...) for a given device
Note:
This function Access to the device
DeviceMode is ignored for the current device
Parameters:
device_modeDevice Mode for which change thresholds
threshold_lowLow threshold (mm, lux ..., depending on the mode)
threshold_highHigh threshold (mm, lux ..., depending on the mode)
Returns:
None; instead check class Field "ErrState"

Definition at line 1164 of file VL53L0X.cpp.

void Set_limit_chk_val ( uint16_t  limit_check_id,
TFP1616  limit_chk_val 
)

Set a specific limit check value.

Function Description
This function set a specific limit check value. The limit check is identified with the limit_check_id.
Note:
This function Access to the device
Parameters:
limit_check_idLimit Check ID (0<= limit_check_id < VL53L0X_GetNumberOfLimitCheck() ).
limit_chk_valLimit check Value for a given limit_check_id
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS This error is returned when either limit_check_id or LimitCheckValue value is out of range.

Definition at line 845 of file VL53L0X.cpp.

void Set_measure_period_ms ( uint32_t  measure_period_ms )

Program continuous mode Inter-Measurement period in milliseconds.

Function Description
When trying to set too short time return INVALID_PARAMS minimal value
Note:
This function Access to the device
Parameters:
measure_period_msInter-Measurement Period in ms.
Returns:
None; instead check class Field "ErrState"
void Set_Offset_Cal_um ( int32_t  Offset_Cal_um )

Set or over-hide part to part calibration offset.

See also:
VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationData_um()
Note:
This function Access to the device
Parameters:
p_Offset_Cal_umOffset (microns)
Returns:
None; instead check class Field "ErrState"

Definition at line 391 of file VL53L0X.cpp.

void Set_range_fraction_enable ( uint8_t  enable )

Sets the resolution of range measurements.

Function Description
Set resolution of range measurements to either 0.25mm if fraction enabled or 1mm if not enabled.
Note:
This function Accesses the device
Parameters:
enableEnable high resolution
Returns:
None; instead check class Field "ErrState"
void Set_vcsel_PPeriod ( VL53L0X_Range_Phase  Vcsel_Range_Phase,
uint8_t  vcsel_PPeriod 
)

Sets the VCSEL pulse period.

Function Description
This function retrieves the VCSEL pulse period for the given period type.
Note:
This function Accesses the device
Parameters:
Vcsel_Range_PhaseVCSEL period identifier (pre-range|final).
vcsel_PPeriodVCSEL period value
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not supported.

Definition at line 530 of file VL53L0X.cpp.

void Set_wrap_around_Chk_En ( uint8_t  wrap_around_Chk_En )

Enable (or disable) Wrap around Check.

Note:
This function Access to the device
Parameters:
wrap_around_Chk_EnWrap around Check to be set 0=disabled, other = enabled
Returns:
None; instead check class Field "ErrState"
void Set_xtalk_compensation_enable ( uint8_t  xtalk_compensation_enable )

Enable/Disable Cross talk compensation feature.

Note:
This function is not Implemented. Enable/Disable Cross Talk by set to zero the Cross Talk value by using VL53L0X_SetXtalk_CompRate_MHz().
Parameters:
xtalk_compensation_enableCross talk compensation to be set 0=disabled else = enabled
Returns:
VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
void Set_Xtalk_CompRate_MHz ( TFP1616  Xtalk_CompRate_MHz )

Set Cross talk compensation rate.

Function Description
Set Cross talk compensation rate.
Note:
This function Access to the device
Parameters:
Xtalk_CompRate_MHzCompensation rate in Mega counts per second (16.16 fix point) see datasheet for details
Returns:
None; instead check class Field "ErrState"
void Start_Measurement (  )

Start device measurement.

Started measurement will depend on device parameters set through VL53L0X_SetParameters() This is a non-blocking function. This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to VL53L0X_STATE_RUNNING.

Note:
This function Access to the device
Returns:
None; instead check class Field "ErrState"
VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when DeviceMode programmed with VL53L0X_SetDeviceMode is not in the supported list: Supported mode are: VL53L0X_DEVICEMODE_SINGLE_RANGING, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING, VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
VL53L0X_ERROR_TIME_OUT Time out on start measurement

Definition at line 1294 of file VL53L0X.cpp.

VL53L0X_Error Start_Sensor ( uint8_t  new_addr = VL53L0X_DEFAULT_ADDRESS )

Turns on, checks the ID, Set new device address, Initialize the calss, and the sensor with default values.

After completion the device will answer to the address new_addr. This new_addr should be set to individual values when several devices are used in parallel before using the individual sensors. When a single device us used, there is no need to set new_addr.

Returns:
VL53L0X_Error = 0 on success

Definition at line 59 of file VL53L0X.cpp.


Field Documentation

VL53L0X_State Current_State

Current state of this device; use Set_Current_State to change it

Definition at line 1188 of file VL53L0X.h.

Execution time of the final range

Definition at line 56 of file VL53L0X.h.

Vcsel pulse period (pll clocks) for the final range measurement

Definition at line 58 of file VL53L0X.h.

uint32_t PartUIDLower

Unique Part ID Lower

Definition at line 75 of file VL53L0X.h.

uint32_t PartUIDUpper

Unique Part ID Upper

Definition at line 74 of file VL53L0X.h.

Execution time of the final range

Definition at line 60 of file VL53L0X.h.

Vcsel pulse period (pll clocks) for the pre-range measurement

Definition at line 62 of file VL53L0X.h.

Peek Signal rate at 400 mm

Definition at line 76 of file VL53L0X.h.