VL53L0X API Specification: Platform

VL53L0X API

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.

2. Read & Write access

API low-level functions rely on a few set of read & write functions which perform the access to the device. These functions must be implemented with respect to the platform on which API is compiled and running. Internal PAL register access functions should be used :

3. Data Types declaration

API functions rely on data types which are defined in VL53L0X_types.h file (under platform/template directory). This file may require user attention and porting in case of warning messages.

4. Delay for polling operations

API polling high level functions do call the function VL53L0X_PollingDelay() inside their while loop. A default implementation of the VL53L0X_PollingDelay() function is provided. You may decide to change and implement your own VL53L0X_PollingDelay() function.

5. API logging

All API functions entry and leave can be logged to help debugging issues. By default logging is disabled please define VL53L0X_LOG_ENABLE at compilation level. If logging is enabled, a small set of macros must be implemented to adapt logging operation to the platform : _LOG_FUNCTION_START, _LOG_FUNCTION_END and _LOG_FUNCTION_END_FMT