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:
objectNeoPixel / DotStar grid framebuffer for MicroPython.
Same constructor signature as
adafruit_pixel_framebuf.PixelFramebuffer. Flush changed pixels to the strip withdisplay().- property width
Logical grid width in pixels.
- property height
Logical grid height in pixels.
- property stride
Pixels per row in the logical framebuffer.
- class displaydev.pixeldisplay.PixelDisplay(pixel_buffer, *, quiet=False)[source]
Bases:
DisplayDriverDisplayDriver for addressable-LED matrix layouts.
Exposes the usual RGB565
DisplayDriverAPI (color_depth=16). The innerPixelFramebufferstores RGB888 for the LED strip; conversion usescolor_rgb.- Parameters:
pixel_buffer –
PixelFramebuffer(or Adafruit equivalent on CircuitPython).
can_rotateis False: the matrix’s wiring sets its orientation, taken frompixel_bufferwhen the driver starts.- 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 * 2bytes.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
buflength does not match dimensions.