i
VL53L0X API Specification
Version 1.0.4.4960
1/2/2017 4:42:00 PM
ii
iii
Table of Contents
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Error! Not a valid heading level in TOC entry on page i
Documentation ....................................................................................................................................................... 1
Introduction ........................................................................................................................................................ 1
Overview ........................................................................................................................................................ 1
Device Info from API ..................................................................................................................................... 1
Coding Standards ............................................................................................................................................ 1
Platform .................................................................................................................................................................. 1
RangeStatus ............................................................................................................................................................ 2
Strings ..................................................................................................................................................................... 3
Disclaimer............................................................................................................................................................... 4
Module Index .......................................................................................................................................................... 4
Data Structure Index ............................................................................................................................................... 5
File Index ................................................................................................................................................................ 5
Module Documentation .......................................................................................................................................... 6
VL53L0X Platform Functions ............................................................................................................................ 6
PAL Register Access Functions ......................................................................................................................... 8
Basic type definition ......................................................................................................................................... 11
VL53L0X cut1.1 Function Definition .............................................................................................................. 11
VL53L0X General Functions ........................................................................................................................... 12
VL53L0X Init Functions .................................................................................................................................. 19
VL53L0X Parameters Functions ...................................................................................................................... 22
VL53L0X Measurement Functions .................................................................................................................. 39
VL53L0X Interrupt Functions .......................................................................................................................... 47
VL53L0X SPAD Functions .............................................................................................................................. 51
VL53L0X Defines ............................................................................................................................................ 54
Error and Warning code returned by API ......................................................................................................... 58
Defines Device modes ...................................................................................................................................... 60
Defines Histogram modes ................................................................................................................................. 61
List of available Power Modes ......................................................................................................................... 62
Defines the current status of the device ............................................................................................................ 63
Defines the Polarity .......................................................................................................................................... 65
Vcsel Period Defines ........................................................................................................................................ 65
Defines the steps ............................................................................................................................................... 66
Defines the Polarity .......................................................................................................................................... 66
General Macro Defines ..................................................................................................................................... 68
VL53L0X cut1.1 Device Specific Defines ....................................................................................................... 70
Device Error ..................................................................................................................................................... 71
Check Enable list .............................................................................................................................................. 73
Gpio Functionality ............................................................................................................................................ 74
Define Registers ............................................................................................................................................... 75
Data Structure Documentation ............................................................................................................................. 83
VL53L0X_Dev_t .............................................................................................................................................. 83
VL53L0X_DevData_t ...................................................................................................................................... 84
iv
VL53L0X_DeviceInfo_t................................................................................................................................... 87
VL53L0X_DeviceParameters_t........................................................................................................................ 88
VL53L0X_DeviceSpecificParameters_t........................................................................................................... 90
VL53L0X_DMaxLUT_t................................................................................................................................... 92
VL53L0X_HistogramData_t ............................................................................................................................ 93
VL53L0X_HistogramMeasurementData_t....................................................................................................... 93
VL53L0X_RangeData_t ................................................................................................................................... 94
VL53L0X_RangingMeasurementData_t .......................................................................................................... 95
VL53L0X_SchedulerSequenceSteps_t ............................................................................................................. 96
VL53L0X_SpadData_t ..................................................................................................................................... 97
VL53L0X_Version_t ........................................................................................................................................ 98
File Documentation .............................................................................................................................................. 99
PAL_disclaimer.c ............................................................................................................................................. 99
vl53l0x_api.h .................................................................................................................................................... 99
vl53l0x_api_calibration.h ............................................................................................................................... 105
vl53l0x_api_core.h ......................................................................................................................................... 106
vl53l0x_api_ranging.h .................................................................................................................................... 109
vl53l0x_api_strings.h ..................................................................................................................................... 109
vl53l0x_def.h .................................................................................................................................................. 117
vl53l0x_device.h ............................................................................................................................................. 120
vl53l0x_doxydoc.c ......................................................................................................................................... 122
vl53l0x_i2c_platform.h .................................................................................................................................. 122
vl53l0x_interrupt_threshold_settings.h .......................................................................................................... 129
vl53l0x_platform.h ......................................................................................................................................... 129
vl53l0x_platform_log.h .................................................................................................................................. 131
vl53l0x_tuning.h ............................................................................................................................................. 132
vl53l0x_types.h............................................................................................................................................... 133
Index ................................................................................................................................................................... 134
1
Documentation
Introduction
The Photonics Abstraction Layer (PAL) is intended to provide an API functions to aid the
development of applications.
Overview
This document is intended to aid in the development of applications around PAL sensor family and
describes the various API functions provided by the API delivered by ST as open source C code.
Some of the API files are hardware and platform dependent (specially I2C access) so need to be
adapted to the platform used by the customer.
Device Info from API
The API provide a function that can be used to obtain information of the device used like the cut
version. This function is VL53L0X_GetDeviceInfo() .
Coding Standards
The implementation of this API will follow Linux Kernel rules as defined in
https://www.kernel.org/doc/Documentation/CodingStyle
Platform
All API settings that are platform-dependent must be adapted to the platform on which API is
compiled/running.
This is done in VL53L0X_platform.h file. Platform settings are described in the VL53L0X Platform
Functions module.
1. PAL device type definition
User must provide VL53L0X_Dev_t type (in VL53L0X_platform.h file) as all API functions and
macros rely on VL53L0X_Dev_t dev (given as first argument). This dev object does the link
between API and platform abstraction layer and is passed from function to function down to final
platform abstraction layer that handles final access to the device :
int VL53L0X_xxxx(VL53L0X_Dev_t dev, ... )
In single device case, dev can be as simple as an integer being the i2c device address
For more elaborated platform, dev can be a pointer to a structure containing all necessary items for
the platform.