displaydev.pixeldisplay

displaydev.pixeldisplay — addressable LED grids (NeoPixel, DotStar, etc.).

MicroPython: PixelFramebuffer (RGB888 grid + strip map) and PixelDisplay live here. CircuitPython board configs use adafruit_pixel_framebuf.PixelFramebuffer with OmniPython PixelDisplay.

class displaydev.pixeldisplay.PixelFramebuffer(pixels, width, height, orientation=1, alternating=True, reverse_x=False, reverse_y=False, top=0, bottom=0, rotation=0)[source]

Bases: object

NeoPixel / DotStar grid framebuffer for MicroPython.

Same constructor signature as adafruit_pixel_framebuf.PixelFramebuffer. Flush changed pixels to the strip with display().

property width

Logical grid width in pixels.

property height

Logical grid height in pixels.

property stride

Pixels per row in the logical framebuffer.

fill_rect(x, y, w, h, c)[source]

Fill a rectangle with an RGB888 packed color 0xRRGGBB.

pixel(x, y, c=None)[source]

Get or set one RGB888 packed pixel 0xRRGGBB.

blit()[source]

Not implemented — use display to flush the strip.

display()[source]

Copy changed pixels to the LED strip and show.

class displaydev.pixeldisplay.PixelDisplay(pixel_buffer, *, quiet=False)[source]

Bases: DisplayDriver

DisplayDriver for addressable-LED matrix layouts.

Exposes the usual RGB565 DisplayDriver API (color_depth=16). The inner PixelFramebuffer stores RGB888 for the LED strip; conversion uses color_rgb.

Parameters:

pixel_buffer – PixelFramebuffer (or Adafruit equivalent on CircuitPython).

can_rotate is False: the matrix’s wiring sets its orientation, taken from pixel_buffer when the driver starts.

init()[source]

No-op init hook (LED strip is already configured).

fill_rect(x, y, w, h, c)[source]

Fill a rectangle with an RGB565 color (converted to RGB888).

Parameters:
  • x – Left edge.

  • y – Top edge.

  • w – Width.

  • h – Height.

  • c – RGB565 color.

Returns:

Result of the inner framebuffer fill_rect.

blit_rect(buf, x, y, w, h)[source]

Blit RGB565 bytes into the LED framebuffer.

Parameters:
  • buf – Source buffer of w * h * 2 bytes.

  • x – Destination left edge.

  • y – Destination top edge.

  • w – Width in pixels.

  • h – Height in pixels.

Returns:

tuple – (x, y, w, h).

Raises:

ValueError – When buf length does not match dimensions.

pixel(x, y, c)[source]

Set a single RGB565 pixel (converted to RGB888).

Parameters:
  • x – X coordinate.

  • y – Y coordinate.

  • c – RGB565 color.

Returns:

Result of the inner framebuffer pixel.

show(_timer=None)[source]

Flush dirty pixels to the LED strip via pixel_buffer.display().