My friend has some LED matrix control software that he wrote, and asked me if I wanted to port it to run on the Pi Pico, because it has some interesting IO options.
This posed a couple of challenges - some of them were already solved (static linking of "modules" is supported, there were already some no-os ports).
The biggest problem was that the Pico SDK is CMake, and sled
is Makefile based, and I wanted this to be easily integrated without making a ton of changes. So... I had CMake spit out a list of all its compiler flags and include/library paths, and fed that to the existing Makefile build system. It mostly works, but has trouble tracking changes on the Make side.
Currently, it supports outputting to WS2812 LED strings, and ST7789 SPI LCDs, with HUB75 panels potentially planned in future.
The LCD output has 4x scaling as a full framebuffer is 240*240*3 = 168.75KiB
, or slightly more than half of the RP2040's 264KiB of RAM. We need to store a seperate front and back buffer, due to effects writing directly into the screen buffer and expecting that the pixels they write are stored between frames. Scaling reduces this to only 64*64*3 = 12KiB
per buffer, which is definitely small enough.
16x16 WS2812 panel: ST7789 LCD:
The code can be found at https://github.com/Stary2001/sled-pico.