ST Expansion SW Team / VL53L1

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_53L1CB

Embed: (wiki syntax)

« Back to documentation index

VL53L1 Calibration Functions

VL53L1 Calibration Functions
[VL53L1 cut1.1 Function Definition]

Functions used for Calibration. More...

Functions

VL53L1_Error VL53L1_SetTuningParameter (VL53L1_DEV Dev, uint16_t TuningParameterId, int32_t TuningParameterValue)
 Set Tuning Parameter value for a given parameter ID.
VL53L1_Error VL53L1_GetTuningParameter (VL53L1_DEV Dev, uint16_t TuningParameterId, int32_t *pTuningParameterValue)
 Get Tuning Parameter value for a given parameter ID.
VL53L1_Error VL53L1_PerformRefSpadManagement (VL53L1_DEV Dev)
 Performs Reference Spad Management.
VL53L1_Error VL53L1_SmudgeCorrectionEnable (VL53L1_DEV Dev, VL53L1_SmudgeCorrectionModes Mode)
 Enable/Disable dynamic Xtalk compensation feature.
VL53L1_Error VL53L1_SetXTalkCompensationEnable (VL53L1_DEV Dev, uint8_t XTalkCompensationEnable)
 Enable/Disable Cross talk compensation feature.
VL53L1_Error VL53L1_GetXTalkCompensationEnable (VL53L1_DEV Dev, uint8_t *pXTalkCompensationEnable)
 Get Cross talk compensation rate enable.
VL53L1_Error VL53L1_PerformXTalkCalibration (VL53L1_DEV Dev, uint8_t CalibrationOption)
 Perform XTalk Calibration.
VL53L1_Error VL53L1_SetOffsetCalibrationMode (VL53L1_DEV Dev, VL53L1_OffsetCalibrationModes OffsetCalibrationMode)
 Define the mode to be used for the offset calibration.
VL53L1_Error VL53L1_SetOffsetCorrectionMode (VL53L1_DEV Dev, VL53L1_OffsetCorrectionModes OffsetCorrectionMode)
 Define the mode to be used for the offset correction.
VL53L1_Error VL53L1_PerformOffsetCalibration (VL53L1_DEV Dev, int32_t CalDistanceMilliMeter, FixPoint1616_t CalReflectancePercent)
 Perform Offset Calibration.
VL53L1_Error VL53L1_PerformOffsetSimpleCalibration (VL53L1_DEV Dev, int32_t CalDistanceMilliMeter)
 Perform Offset simple Calibration.
VL53L1_Error VL53L1_PerformOffsetZeroDistanceCalibration (VL53L1_DEV Dev)
 Perform Offset simple Calibration with a "zero distance" target.
VL53L1_Error VL53L1_PerformOffsetPerVcselCalibration (VL53L1_DEV Dev, int32_t CalDistanceMilliMeter)
 Perform Offset per Vcsel Calibration.
VL53L1_Error VL53L1_SetCalibrationData (VL53L1_DEV Dev, VL53L1_CalibrationData_t *pCalibrationData)
 Sets the Calibration Data.
VL53L1_Error VL53L1_GetCalibrationData (VL53L1_DEV Dev, VL53L1_CalibrationData_t *pCalibrationData)
 Gets the Calibration Data.
VL53L1_Error VL53L1_SetZoneCalibrationData (VL53L1_DEV Dev, VL53L1_ZoneCalibrationData_t *pZoneCalibrationData)
 Sets the Zone Calibration Data.
VL53L1_Error VL53L1_GetZoneCalibrationData (VL53L1_DEV Dev, VL53L1_ZoneCalibrationData_t *pZoneCalibrationData)
 Gets the Zone Calibration Data.
VL53L1_Error VL53L1_GetOpticalCenter (VL53L1_DEV Dev, FixPoint1616_t *pOpticalCenterX, FixPoint1616_t *pOpticalCenterY)
 Gets the optical center.

Detailed Description

Functions used for Calibration.


Function Documentation

VL53L1_Error VL53L1_GetCalibrationData ( VL53L1_DEV  Dev,
VL53L1_CalibrationData_t pCalibrationData 
)

Gets the Calibration Data.

Function Description
This function get all the Calibration Data issued from the functions VL53L1_PerformRefSpadManagement(), VL53L1_PerformXTalkCalibration, VL53L1_PerformOffsetCalibration()
Note:
This function doesn't Accesses the device
Parameters:
DevDevice Handle
*pCalibrationDatapointer where to store Calibration data.
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3493 of file vl53l1_api.c.

VL53L1_Error VL53L1_GetOpticalCenter ( VL53L1_DEV  Dev,
FixPoint1616_t *  pOpticalCenterX,
FixPoint1616_t *  pOpticalCenterY 
)

Gets the optical center.

Function Description
This function get the optical center issued from the nvm set at FTM stage expressed in the same coordinate system as the ROI are
Note:
This function doesn't Accesses the device
Parameters:
DevDevice Handle
pOpticalCenterXpointer to the X position of center in 16.16 fix point
pOpticalCenterYpointer to the Y position of center in 16.16 fix point
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3652 of file vl53l1_api.c.

VL53L1_Error VL53L1_GetTuningParameter ( VL53L1_DEV  Dev,
uint16_t  TuningParameterId,
int32_t *  pTuningParameterValue 
)

Get Tuning Parameter value for a given parameter ID.

Function Description
This function is used to get the value of the parameter identified by an unique ID.
Note:
This function doesn't Access to the device
Parameters:
DevDevice Handle
TuningParameterIdTuning Parameter ID
pTuningParameterValuePointer to Tuning Parameter Value for a given TuningParameterId.
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2743 of file vl53l1_api.c.

VL53L1_Error VL53L1_GetXTalkCompensationEnable ( VL53L1_DEV  Dev,
uint8_t *  pXTalkCompensationEnable 
)

Get Cross talk compensation rate enable.

Get if the Cross Talk is Enabled or Disabled.

Note:
This function doesn't access to the device
Parameters:
DevDevice Handle
pXTalkCompensationEnablePointer to the Cross talk compensation state 0=disabled or 1 = enabled
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2907 of file vl53l1_api.c.

VL53L1_Error VL53L1_GetZoneCalibrationData ( VL53L1_DEV  Dev,
VL53L1_ZoneCalibrationData_t pZoneCalibrationData 
)

Gets the Zone Calibration Data.

Function Description
This function get all the Zone Calibration Data issued from the functions VL53L1_PerformOffsetCalibration()
Note:
This function doesn't Accesses the device
Parameters:
DevDevice Handle
*pZoneCalibrationDatapointer where to store Zone Calibration data.
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3639 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformOffsetCalibration ( VL53L1_DEV  Dev,
int32_t  CalDistanceMilliMeter,
FixPoint1616_t  CalReflectancePercent 
)

Perform Offset Calibration.

Perform a Offset calibration of the Device. This function will launch a ranging measurement, if interrupts are enabled interrupts will be done. This function will program a new value for the Offset calibration value

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
DevDevice Handle
CalDistanceMilliMeterCalibration distance value used for the offset compensation.
CalReflectancePercentCalibration Target reflectance @ 940nm in percentage.
Returns:
VL53L1_ERROR_NONE
"Other error code" See VL53L1_Error

Definition at line 3076 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformOffsetPerVcselCalibration ( VL53L1_DEV  Dev,
int32_t  CalDistanceMilliMeter 
)

Perform Offset per Vcsel Calibration.

i.e. per distance mode

Perform offset calibration of the Device depending on the three distance mode settings: short, medium and long. This function will launch few ranging measurements and computes offset calibration in each of the three distance modes. The preset mode MUST be set by the application before to call this function.

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
DevDevice Handle
CalDistanceMilliMeterDistance of the target used for the offset compensation calibration.
Returns:
VL53L1_ERROR_NONE
VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL the calibration failed by lack of valid measurements
VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH means that the target distance combined to the number of loops performed in the calibration lead to an internal overflow. Try to reduce the distance of the target (140 mm)
"Other error code" See VL53L1_Error

Definition at line 3841 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformOffsetSimpleCalibration ( VL53L1_DEV  Dev,
int32_t  CalDistanceMilliMeter 
)

Perform Offset simple Calibration.

Perform a very simple offset calibration of the Device. This function will launch few ranging measurements and computes offset calibration. The preset mode and the distance mode MUST be set by the application before to call this function.

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
DevDevice Handle
CalDistanceMilliMeterCalibration distance value used for the offset compensation.
Returns:
VL53L1_ERROR_NONE
VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL the calibration failed by lack of valid measurements
VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH means that the target distance combined to the number of loops performed in the calibration lead to an internal overflow. Try to reduce the distance of the target (140 mm)
"Other error code" See VL53L1_Error

Definition at line 3145 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformOffsetZeroDistanceCalibration ( VL53L1_DEV  Dev )

Perform Offset simple Calibration with a "zero distance" target.

Perform a simple offset calibration of the Device. This function will launch few ranging measurements and computes offset calibration. The preset mode and the distance mode MUST be set by the application before to call this function. A target must be place very close to the device. Ideally the target shall be touching the coverglass.

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
DevDevice Handle
Returns:
VL53L1_ERROR_NONE
VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL the calibration failed by lack of valid measurements
VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH means that the target distance is too large, try to put the target closer to the device
"Other error code" See VL53L1_Error

Definition at line 3245 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformRefSpadManagement ( VL53L1_DEV  Dev )

Performs Reference Spad Management.

Function Description
The reference SPAD initialization procedure determines the minimum amount of reference spads to be enables to achieve a target reference signal rate and should be performed once during initialization.
Note:
This function Access to the device
Parameters:
DevDevice Handle
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2766 of file vl53l1_api.c.

VL53L1_Error VL53L1_PerformXTalkCalibration ( VL53L1_DEV  Dev,
uint8_t  CalibrationOption 
)

Perform XTalk Calibration.

Perform a XTalk calibration of the Device. This function will launch a ranging measurement, if interrupts are enabled an interrupt will be done. This function will clear the interrupt generated automatically. This function will program a new value for the XTalk compensation and it will enable the cross talk before exit.

Warning:
This function is a blocking function
Note:
This function Access to the device
Parameters:
DevDevice Handle
CalibrationOptionSelect the Calibration to be run :
CalibrationOption
  • VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET the calibration uses current preset and distance mode without altering them.
    User must call VL53L1_SetPresetMode() with VL53L1_PRESETMODE_AUTONOMOUS, VL53L1_PRESETMODE_LITE_RANGING or VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS parameter prior to launch calibration
  • VL53L1_XTALKCALIBRATIONMODE_NO_TARGET the calibration sets appropriate preset and distance mode and thus override existing ones
    User must call VL53L1_SetPresetMode() again after calibration to set the desired one. during this calibration mode no object must be put below a 80cm distance from the target
  • VL53L1_XTALKCALIBRATIONMODE_FULL_ROI the calibration sets appropriate preset and distance mode and thus override existing ones
    User must call VL53L1_SetPresetMode() again after calibration to set the desired one. The ROI settings must define a single 16x16 ROI before to launch this function. The calibration uses a target which should be located at least @60cm from the device. The actual location of the target shall be passed through the bare driver tuning parameters table
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2923 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetCalibrationData ( VL53L1_DEV  Dev,
VL53L1_CalibrationData_t pCalibrationData 
)

Sets the Calibration Data.

Function Description
This function set all the Calibration Data issued from the functions VL53L1_PerformRefSpadManagement(), VL53L1_PerformXTalkCalibration, VL53L1_PerformOffsetCalibration()
Note:
This function doesn't Accesses the device
Parameters:
DevDevice Handle
*pCalibrationDataPointer to Calibration data to be set.
Returns:
VL53L1_ERROR_NONE Success
VL53L1_ERROR_INVALID_PARAMS pCalibrationData points to an older version of the inner structure. Need for support to convert its content.
"Other error code" See VL53L1_Error

Definition at line 3335 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetOffsetCalibrationMode ( VL53L1_DEV  Dev,
VL53L1_OffsetCalibrationModes  OffsetCalibrationMode 
)

Define the mode to be used for the offset calibration.

Define the mode to be used for the offset calibration. This function should be called before run the VL53L1_PerformOffsetCalibration()

Parameters:
DevDevice Handle
OffsetCalibrationModeOffset Calibration Mode valid values are:

  • VL53L1_OFFSETCALIBRATIONMODE_STANDARD
  • VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY
  • VL53L1_OFFSETCALIBRATIONMODE_MULTI_ZONE
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3014 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetOffsetCorrectionMode ( VL53L1_DEV  Dev,
VL53L1_OffsetCorrectionModes  OffsetCorrectionMode 
)

Define the mode to be used for the offset correction.

Define the mode to be used for the offset correction.

Parameters:
DevDevice Handle
OffsetCorrectionModeOffset Correction Mode valid values are:

  • VL53L1_OFFSETCORRECTIONMODE_STANDARD
  • VL53L1_OFFSETCORRECTIONMODE_PERZONE
  • VL53L1_OFFSETCORRECTIONMODE_PERVCSEL
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3045 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetTuningParameter ( VL53L1_DEV  Dev,
uint16_t  TuningParameterId,
int32_t  TuningParameterValue 
)

Set Tuning Parameter value for a given parameter ID.

Function Description
This function is used to improve the performance of the device. It permit to change a particular value used for a timeout or a threshold or a constant in an algorithm. The function will change the value of the parameter identified by an unique ID.
Note:
This function doesn't Access to the device
Parameters:
DevDevice Handle
TuningParameterIdTuning Parameter ID
TuningParameterValueTuning Parameter Value
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2717 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetXTalkCompensationEnable ( VL53L1_DEV  Dev,
uint8_t  XTalkCompensationEnable 
)

Enable/Disable Cross talk compensation feature.

Enable/Disable Cross Talk correction.

Parameters:
DevDevice Handle
XTalkCompensationEnableCross talk compensation to be set 0 = disabled or 1 = enabled.
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2890 of file vl53l1_api.c.

VL53L1_Error VL53L1_SetZoneCalibrationData ( VL53L1_DEV  Dev,
VL53L1_ZoneCalibrationData_t pZoneCalibrationData 
)

Sets the Zone Calibration Data.

Function Description
This function set all the Zone nCalibration Data issued from the functions VL53L1_PerformOffsetCalibration() in multi zone
Note:
This function doesn't Accesses the device
Parameters:
DevDevice Handle
*pZoneCalibrationDataPointer to Zone Calibration data to be set.
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 3625 of file vl53l1_api.c.

VL53L1_Error VL53L1_SmudgeCorrectionEnable ( VL53L1_DEV  Dev,
VL53L1_SmudgeCorrectionModes  Mode 
)

Enable/Disable dynamic Xtalk compensation feature.

Enable/Disable dynamic Xtalk compensation (aka smudge correction).

Parameters:
DevDevice Handle
ModeSet the smudge correction mode See VL53L1_SmudgeCorrectionModes
Returns:
VL53L1_ERROR_NONE Success
"Other error code" See VL53L1_Error

Definition at line 2842 of file vl53l1_api.c.