Pixie_Chroma icon indicating copy to clipboard operation
Pixie_Chroma copied to clipboard

Add Adafruit Neopixel library compatibility

Open connornishijima opened this issue 2 years ago • 0 comments

Basic idea:

Provide compatibility with microcontrollers covered by the Adafruit Neopixel library, but not FastLED yet.

How:

  • If a platform unsupported by FastLED is detected, (i.e. RP2040) a compilation flag "ADAFRUIT_MODE" is defined.
  • A warning is shown during compilation that the library is in "Compatibility Mode" and performance may slightly suffer
  • FastLED.h is not included during compile. Instead, some manually curated FastLED module are included from a new file compatibility_tools.h
  • When a user specifies a FastLED detail like a CHSV color or a CRGBPalette16, these are handled by the FastLED structs and functions borrowed verbatim for the compatibility_tools.h file.
  • Upon calling pix.show(), the CRGB LED buffers are parsed into Neopixel's 32-bit color data using union for speed.
  • This converted LED array is then sent out using the underlying Neopixel library

This way, any microcontroller that the Neopixel library can work with (which FastLED can't yet) can be used in Compatibility Mode with little or no extra work by the user.

connornishijima avatar Jul 06 '22 18:07 connornishijima