zephyr_display – Display access for Zephyr boards

This module provides Display, a displayio display class for the device selected by the zephyr,display devicetree chosen property.

Note

This module is Zephyr-specific. On other ports the equivalent class is one of the displayio display classes, such as busdisplay.BusDisplay.

Available on these boards
  • Adafruit CLUE nRF52840 Express (Zephyr)
  • Adafruit MacroPad RP2040 (Zephyr)
  • Renesas Electronics Corporation RA8D1 Evaluation Kit (Zephyr)
  • STMicroelectronics STM32H750B Discovery Kit (Zephyr)
  • STMicroelectronics STM32H7B3I Discovery kit (Zephyr)
  • zephyr Native simulator - LVGL + ASan (Zephyr)
  • zephyr Native simulator - LVGL displayio compositor (Zephyr)
  • zephyr Native simulator - littlefs filesystem (Zephyr)
  • zephyr Native simulator - native_sim (Zephyr)

class zephyr_display.Display(*, rotation: int = 0, auto_refresh: bool = True)

Manage the display selected by the Zephyr devicetree

There is no display bus argument because the device comes from the zephyr,display chosen devicetree node.

Creating a Display releases the display built during startup (supervisor.runtime.display), as with other display classes.

Create a Display for the zephyr,display device.

Parameters:
  • rotation (int) – The rotation of the display in degrees. Must be a multiple of 90.

  • auto_refresh (bool) – Automatically refresh the screen.

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 not None this waits for the target frame rate and then refreshes the display, returning True. If the call has taken too long since the last refresh call for the given target frame rate, then the refresh returns False immediately without updating the screen to try to keep latency low.

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 is None this will update the display immediately. When auto_refresh is on, it updates the display immediately too; the display also updates without calls to this.

Parameters:
  • target_frames_per_second (Optional[int]) – The target frame rate that refresh() should try to achieve. Set to None for immediate refresh.

  • minimum_frames_per_second (int) – The minimum number of times the screen should be updated per second.

auto_refresh: bool

True when the display is refreshed automatically.

brightness: float

The brightness of the display as a float. 0.0 is off and 1.0 is full brightness.

Note

Zephyr displays do not implement brightness control yet, so reading or writing this raises RuntimeError.

width: int

The width of the display in pixels, with rotation applied.

height: int

The height of the display in pixels, with rotation applied.

rotation: int

The rotation of the display in degrees.

root_group: displayio.Group | None

The displayio.Group that is drawn on the display, or None when the display is cleared.

A displayio.Group can only be the root group of one display at a time. Setting a group that is already in use raises ValueError.