_pixelbuf — Fast RGB(W) pixel buffer and helpers

The _pixelbuf module provides PixelBuf and ByteOrder classes to accelerate RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.

Libraries

class _pixelbuf.ByteOrder

Classes representing byteorders for CircuitPython .. attribute:: bpp

The number of bytes per pixel (read-only)
has_white

Whether the pixel has white (in addition to RGB)

has_luminosity

Whether the pixel has luminosity (in addition to RGB)

byteorder

Tuple of byte order (r, g, b) or (r, g, b, w) or (r, g, b, l)

_pixelbuf.wheel(n)

C implementation of the common wheel() function found in many examples. Returns the colorwheel RGB value as an integer value for n (usable in PixelBuf, neopixel, and dotstar).

_pixelbuf.RGB
  • order Red, Green, Blue
  • bpp 3
_pixelbuf.RBG
  • order Red, Blue, Green
  • bpp 3
_pixelbuf.GRB
  • order Green, Red, Blue
  • bpp 3

Commonly used by NeoPixel.

_pixelbuf.GBR
  • order Green, Blue, Red
  • bpp 3
_pixelbuf.BRG
  • order Blue, Red, Green
  • bpp 3
_pixelbuf.BGR
  • order Blue, Green, Red
  • bpp 3

Commonly used by Dotstar.

_pixelbuf.RGBW
  • order Red, Green, Blue, White
  • bpp 4
  • has_white True
_pixelbuf.RBGW
  • order Red, Blue, Green, White
  • bpp 4
  • has_white True
_pixelbuf.GRBW
  • order Green, Red, Blue, White
  • bpp 4
  • has_white True

Commonly used by RGBW NeoPixels.

_pixelbuf.GBRW
  • order Green, Blue, Red, White
  • bpp 4
  • has_white True
_pixelbuf.BRGW
  • order Blue, Red, Green, White
  • bpp 4
  • has_white True
_pixelbuf.BGRW
  • order Blue, Green, Red, White
  • bpp 4
  • has_white True
_pixelbuf.LRGB
  • order Luminosity, Red, Green, Blue
  • bpp 4
  • has_luminosity True
_pixelbuf.LRBG
  • order Luminosity, Red, Blue, Green
  • bpp 4
  • has_luminosity True
_pixelbuf.LGRB
  • order Luminosity, Green, Red, Blue
  • bpp 4
  • has_luminosity True
_pixelbuf.LGBR
  • order Luminosity, Green, Blue, Red
  • bpp 4
  • has_luminosity True
_pixelbuf.LBRG
  • order Luminosity, Blue, Red, Green
  • bpp 4
  • has_luminosity True
_pixelbuf.LBGR
  • order Luminosity, Blue, Green, Red
  • bpp 4
  • has_luminosity True

Actual format commonly used by DotStar (5 bit luminance value)