2018-08-01 06:09 PM
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:
Note: I'm using version 1.0.2 of the API, which appears to be the latest