Up until a few weeks ago the ESP32 version of MicroPython was missing support for APA102/DotStar LEDs. Now there are two drivers to choose from. One written by Matt T that focuses on simplicity and performance. Matt’s library is based on the Adafruit DotStar library back ported to MicroPython. The main difference between Matt’s code and Adafruit’s is that Matt’s code requires an SPI object and Adafruit’s requires separate Pin objects for Clock and Data. I look forward to trying this library on my next project after I upgrade to MicroPython 1.10. You can find Matt’s library here: https://github.com/mattytrentini/micropython-dotstar
The other MicroPython ESP32 APA102/Dotstar library was written by me. At the time I started the project I didn’t know that Matt was working on his library. In any case I needed a working APA102/DotStar library for a project using MicroPython 1.9.4. so I wrote one!
At this point my library is probably only of historical interest.
My class implements the Adafruit DotStar API, the MicroPython ESP8266 APA102 API, and the MicroPython SPI DotStar API. The code is derived from the Adafruit DotStar CircuitPython class and back ported to MicroPython. The focus of this implementation is backward compatibility, performance was a secondary goal. If GPIO pins are specified for clock and data the older lower performance “bit banging” technique is used rather than the newer software SPI technique. This preserved the existing API that only required clock and data pins instead of an SPI object.
This implementation has only been tested on the ESP32 and MicroPython 1.9.4
Two example/test files are included. The examples show simple class usage and some variations on the Adafruit DotStar examples that are more compact.
The files are available here: https://github.com/RobertJBabb/micropython_generic_apa102