cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L0x API data access inconsistency

Austin Glaser
Associate

The VL53L0X API (https://my.st.com/content/my_st_com/en/products/embedded-software/proximity-sensors-software/stsw-img005.license=1533144599665.html) requires definition of a platform-dependent structure of type VL53L0X_DevData_t. This structure must contain a field of type VL53L0X_DevData_t, where the API stores all portable state data.

API functions primarily access this embedded field through a pair of (again, platform dependent) macros -- PALDevDataGet and PALDevDataSet. However, there are portions of the API which don't follow this convention -- instead, they directly access a struct field named Data.

This forces platform implementations to declare the device structure in a precise way, while also forcing the declaration of that macro. This is non-ideal, and the problematic areas of the code should be fixed to be consistent. Specifically, there are direct field accesses at:

  • vl53l0x_api_core.c: 419
  • vl53l0x_api_calibration.c: 735, 337, 774, 793, 806, 807, 846, 854, 879, 887, 912, 922, 980, 991, 992

Note: I'm using version 1.0.2 of the API, which appears to be the latest

0 REPLIES 0