_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).

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

Commonly used by NeoPixel.

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

Commonly used by Dotstar.

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

Commonly used by RGBW NeoPixels.

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

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