displaydev.fbdisplay
displaydev.fbdisplay
- class displaydev.fbdisplay.FBDisplay(buffer, width=None, height=None, reverse_bytes_in_word=False, *, bitmap=None, display=None, quiet=False)[source]
Bases:
DisplayDriverA class to interface with CircuitPython FrameBuffer objects.
- Parameters:
buffer (FrameBuffer) – The CircuitPython FrameBuffer object (e.g.
dotclockframebuffer.DotClockFramebuffer, already in PSRAM).width (int, optional) – The width of the display. Defaults to None.
height (int, optional) – The height of the display. Defaults to None.
reverse_bytes_in_word (bool, optional) – Whether to reverse the bytes in a word. Defaults to False.
bitmap – Optional
displayio.Bitmappaint surface (typically allocated in SPIRAM/PSRAM). When set withbitmaptools, blit/fill use Carrayblit/fill_region— the Adafruit Qualia RGB666 path — instead of Python loops into the raw framebuffer.display – Optional
framebufferio.FramebufferDisplaythat ownsbitmapas its root group.show()callsdisplay.refresh()so dirty regions are composited in C into the DotClock PSRAM framebuffer.
share_framebufferandneeds_refreshare properties, below.can_rotateis False: the framebuffer is laid out at the panel’s own size, sorotationswapswidthandheightbut every blit and fill still lands in the panel’s orientation. LVGL turns its frames itself (lvgl_rotationon the board’s display), and other programs keep the panel’s orientation.Whether a GUI may paint the scanout buffer directly.
Not when a
framebufferio.FramebufferDisplaywas given: it composites its own root group into that buffer at the panel rate (and keeps PSRAM’s cache in step for the scanout), so direct paint would race it and could reach the panel late. The GUI paints throughblit_rectinstead, intobitmapwhen there is one.
- property needs_refresh
Whether
appdev.Appmust drive periodicshow().This cannot be a class attribute, because one class covers two runtimes that need opposite answers:
CircuitPython’s
framebufferio.FramebufferDisplay(fb, auto_refresh=True)composites at the panel rate on its own, and presenting it again tears against the free-running DPI scanout (see the Qualia board config).MicroPython’s
dotclockframebuffer.DotClockFramebufferuses double panel buffers withauto_refresh=False: nothing reaches the panel untilrefresh()promotes the back buffer.
DisplayDriverdefaults this toFalse, which is right for the first and wrong for the second — so without LVGL, every MicroPython program had to callshow()itself, and forgetting looked exactly like dead hardware. The driver already knows which case it is: this is the same testshowmakes before presenting, asked once rather than left to the caller.
- framebuffers()[source]
Panel scanout buffer(s) for direct GUI rendering.
Returns
(buf1, buf2_or_None, nbytes, stride_bytes). Prefers native dual FBs fromdotclockframebuffer.DotClockFramebuffer.framebufferswhen present; otherwise a singlememoryviewof the raw buffer (e.g. mipidsi).
- fill_rect(x, y, w, h, c)[source]
Fills a rectangle with the given color.
- Parameters:
- Returns:
(tuple) – A tuple containing the x, y, w, h values
- blit_rect(buf, x, y, w, h)[source]
Blits a buffer to the display at the given coordinates.
- Parameters:
buf (memoryview) – The buffer to blit.
x (int) – The x-coordinate of the buffer.
y (int) – The y-coordinate of the buffer.
w (int) – The width of the buffer.
h (int) – The height of the buffer.
- Returns:
(tuple) – A tuple containing the x, y, w, h values.
- show(_timer=None)[source]
Refreshes the display.
Present the frame. Drivers with
auto_refresh=True(CP QualiaFramebufferDisplay) already composite into the scanned buffer — skip here. MicroPythondotclockframebuffer.DotClockFramebufferuses double panel FBs withauto_refresh=False, soshow()must callrefresh()to promote the back buffer (LVGL wires this asrefresh_cb).
- show_nowait()[source]
Start presenting the frame and return without waiting for it.
On a double-buffered native framebuffer that can split its present (MicroPython
DotClockFramebufferwithpresent()/wait()), this promotes the back buffer and returns at once; callwait_shownbefore painting the framebuffers again. Elsewhere it isshow.- Returns:
bool –
Truewhen a present is pending andwait_shownmust follow,Falsewhen the frame is already out.
- wait_shown()[source]
Return once the frame
show_nowaitstarted is on screen.Does nothing when no present is pending.