VL53L1X Distance Sensor on the Pico

Can anyone tell me if the full ST API for the VL53L1X distance sensor can be implemented or has been implemented on a Pico ? I have managed to get the sensor working (sort of) using very simple micropython code on the Pico (it basically initialises the device and reads a number via I2C) - but I would like to have the full API available - preferably in C. The ST supplied API code looks big/complicated and porting it to the Pico may not be a trivial exercise. Despite this, the ability to use the full API on a Pico might be a very useful feature for many projects. Any thoughts ?

Have a look see here, scroll down the page, might help?
Issues · pimoroni/BreakoutGarden (github.com)

Another spot to poke around is here,
pimoroni/pimoroni-pico: Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython. (github.com)

Thanks for the links. The VL53L1X driver code in the Pico add-on libraries should provide me with a good starting point to develop a more comprehensive API on the Pico. Most of the code I’ve looked at seems to be full of undocumented “magic numbers” - presumably because the sensor manufacturers have not published a fully documented register map. This makes everything more complicated than it should be - what were they thinking ?

I got it working on the original Pico using this code: GitHub - drakxtwo/vl53l1x_pico: micropython driver for the vl53l1x ToF sensor
But then I found this hung on the PicoW.

Then I discovered that you can run the CircuitPython libraries on top of MicroPython. Following this install guide Installing Blinka and Libraries | CircuitPython Libraries on MicroPython using the Raspberry Pi Pico | Adafruit Learning System I now have the CircuitPython adafruit_VL53L1X library (using the Python source, not the mpy file) working fine on my PicoW.

I did get the sensor working on an original Pico using a micropython driver that looks very similar to the one you reference. However, I found that certain I2C writes failed unpredictably for no apparent reason. While trying to debug this, I switched from the hardware I2C implementation to the software implementation (from machine import SoftI2C), and that change seems to have fixed all the problems.

Not sure why using SoftI2C works, but I’d guess there is a bus timing issue which may or may not be related to the sensor I am using. Anyway, everything is working fine now using micropython, but I still have not had time to investigate using the full ST API. If anyone has managed to implement this on the Pico I’d be very interested to hear about it.