I need to use the vl53l1x sensor for my projects cause it has lots of powerful features. I started creating a module for him based on ULD API which is offered by st, therefore in order to avoid a huge refactoring i would like to present the approach and get some early feedback about the structure and if it is in agreement with RIOT.
This is case in my mind is more of a wrapper than an actual driver. I structure in a way in order to achieve two things:
be as separate as possible from the st API, so it would be easy to upgrade it, follow somehow RIOT’S driver structure.
Below is the structure:
So in st’s api, the platfrom files are were the implementation should take place. So the vl53l1x.h file contains wrapper functions for all functions of st’s API, but also the definitions for the i2c implementation functions which platform.h functions will call.
So while this in my mind seems a clean approach, i ask you if you think these 2 extra function call layer will add overhead. Also because platfrom callers are unaware of the multiple i2c channels that some mcu’s have, in the vl53l1x.c file it would require a global variable in order to pass the i2c device from the wrappers to the implementation functions with a global variable in order avoiding to pollute the st API. The latter seems to me a little hacky and weird so if you have some better approach in mind let me know.
Thanks in advance!