framebufferio
– Native framebuffer display driving
The framebufferio
module contains classes to manage display output
including synchronizing with refresh rates and partial updating.
It is used in conjunction with classes from displayio
to actually
place items on the display; and classes like RGBMatrix
to actually
drive the display.
Available on these boards
- class framebufferio.FramebufferDisplay(framebuffer: circuitpython_typing.FrameBuffer, *, rotation: int = 0, auto_refresh: bool = True)
Manage updating a display with framebuffer in RAM
This initializes a display and connects it into CircuitPython. Unlike other objects in CircuitPython, Display objects live until
displayio.release_displays()
is called. This is done so that CircuitPython can use the display itself.Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
- Parameters:
framebuffer (FrameBuffer) – The framebuffer that the display is connected to
auto_refresh (bool) – Automatically refresh the screen
rotation (int) – The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
- refresh(*, target_frames_per_second: int | None = None, minimum_frames_per_second: int = 0) bool
When auto_refresh is off, and
target_frames_per_second
is notNone
this waits for the target frame rate and then refreshes the display, returningTrue
. If the call has taken too long since the last refresh call for the given target frame rate, then the refresh returnsFalse
immediately without updating the screen to hopefully help getting caught up.If the time since the last successful refresh is below the minimum frame rate, then an exception will be raised. The default
minimum_frames_per_second
of 0 disables this behavior.When auto_refresh is off, and
target_frames_per_second
isNone
this will update the display immediately.When auto_refresh is on, updates the display immediately. (The display will also update without calls to this.)
- framebuffer: circuitpython_typing.FrameBuffer
The framebuffer being used by the display
- fill_row(y: int, buffer: circuitpython_typing.WriteableBuffer) circuitpython_typing.WriteableBuffer
Extract the pixels from a single row
- Parameters:
y (int) – The top edge of the area
buffer (WriteableBuffer) – The buffer in which to place the pixel data
- root_group: displayio.Group
The root group on the display. If the root group is set to
displayio.CIRCUITPYTHON_TERMINAL
, the default CircuitPython terminal will be shown. If the root group is set toNone
, no output will be shown.