A new WS2812B library with color palette and unlimited pixels support.

I have written a new bit-banging library for WS2812B LEDs, because I have found the ones I’ve used to be kinda dirty and built on complicated assembly code, and relatively limited or too bulky. I’ve relied on Adafruit’s library for my builds till now, but wanted a more elegant solution. Reading Josh.com gave me a lot of insight on how the WS2812B protocol worked, so I decided to code a proper library with my sauce.

Now… Would anyone even care for yet another LED library?

Well what does mine have to offer others don’t?

  • The low level bit-banging code is written in plain gcc C, without any inline assembly.

  • The class supports multiple pixel formats:

  • Three uint8_t per pixel

  • One uint32_t word per pixel

  • 1, 2, 4 or 8-bits per pixel, via a color palette of 2, 4, 16 or 256 colors

  • One uint16_t word per pixel, using a choice of 3 levels of brightness

const uint8_t numPixels  = 16;
// define a 4 colors palette
uint8_t paletteArray[3*4];
// Each pixel uses 2 bits out of 8 in a byte
uint8_t pixelArray[numPixels/4];

while (1) {
  // Update the pattern and its colors
  ...

  // this loop displays the pattern on the LEDs
  oldSREG = SREG;
  cli();
  for (i = 0; i < repeats; i++) {
    ws2812b_portD6.sendPixels<2>(numPixels, pixelArray,paletteArray);
  }
  SREG =oldSREG;

  delay(50);
}

Question

I have not really used not delved into FastLED. Does anyone know if its implementation of
color palettes still requires the use of a buffer for all the pixels?

My implementation does not, colors are mapped on the fly. I want to know if my library has
an edge on it because of that...