StrathSEDS-on-GitHub / firefly-firmware

Firmware for StrathSEDS' entry to Mach-23
Mozilla Public License 2.0
3 stars 0 forks source link

Write a better backend for Neopixel #4

Closed X-yl closed 5 months ago

X-yl commented 8 months ago

Right now, we use some godawful bitbanging directly to the neopixel. This is bad as we can't fucking use the neopixel without optimisations otherwise the bitbanging is too slow. It also unnecessarily hogs the CPU.

In addition, because all the neopixels are wired together in series and we don't have any abstractions for this, any write to neopixels affects all the previous neopixels in the chain.

Firefly 1.1 will have the Neopixel wired to an SPI bus so we can use this well known hack to drive the Neopixel using the much faster SPI bus: https://learn.adafruit.com/circuitpython-neopixels-using-spi/overview

In addition, we should add an abstraction that allows writes to individual neopixels without affecting the others. I would recommend perhaps doing this in a way that allows the Neopixel controller task to be provided with lambdas for each pixel so we can have 4 different patterns going on at the same time. We could use each Neopixel for different sensors to monitor them all at a glance.