bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
603 stars 284 forks source link

Support RGBW WS2812 neopixels #691

Closed ssav7912 closed 2 years ago

ssav7912 commented 3 years ago

This patch adds support for RGB-W WS2812 neopixel components.

NeoPixel constructor now takes 3 arguments (pin, num_leds, num_channels). num_channels is used to determine whether an extra white channel needs to be sent to the LED chip.

neopixelsend.s assembly also now takes num_channels as a parameter in R3 to use as "parallel - serial conversion mask" in R6 instead of hardcoding value.

Commenting was largely for my own benefit deciphering the micropython internal structure and so may be untidy/uncertain.

dpgeorge commented 2 years ago

Thanks for the contribution. This is a good feature to have.

I've actually implemented this feature (RGBW pixel support) in 8d3078846c0129c2a1db20bd115b1501b5c07cd8 and 652116dd094d241807b0e16b8b51847c5eb469fa which: