Skip to main content

DisplayController Class

Package: GHIElectronics.Endpoint.Devices.Display
Namespace: GHIElectronics.Endpoint.Devices.Display

A display on the board. This class is abstract: the library ships one concrete subclass, Display.ParallelDisplayController, for the built-in parallel RGB panel into /dev/fb0. Customers wiring any other kind of panel (SPI, I2C, custom) subclass this directly and drive the hardware through the Core Spi/I2c/Gpio APIs. The abstract contract is: open the panel on DisplayController.Enable, close it on DisplayController.Disable, push pixels on DisplayController.Flush.

class DisplayController(IDisposable): ...

Constructors​

DisplayController()​

def __init__(self):

Properties​

Height​

Height: int # @property

Visible height of the panel in pixels.

Returns int

IsEnabled​

IsEnabled: bool # @property

True once the panel driver / init path has run and the panel is ready to receive pixels.

Returns bool

Width​

Width: int # @property

Visible width of the panel in pixels.

Returns int

Methods​

Disable()​

def Disable(self) -> None:

Reverse of DisplayController.Enable. Safe to call when nothing is enabled.

Dispose()​

def Dispose(self) -> None:

Calls DisplayController.Disable and releases any resources the subclass holds.

Enable()​

def Enable(self) -> None:

Loads the panel driver / runs the init sequence. Throws if the apply fails.

Flush(ReadOnlySpan<byte> pixels)​

def Flush(self, pixels: ReadOnlySpan[int]) -> None:

Push a full-screen frame. Pixel format defaults to PixelFormat.Format16bppRgb565.

Flush(ReadOnlySpan<byte> pixels, PixelFormat format)​

def Flush(self, pixels: ReadOnlySpan[int], format: PixelFormat) -> None:

Push a full-screen frame in the given format.

Flush(ReadOnlySpan<byte> pixels, PixelFormat format, int x, int y, int width, int height)​

def Flush(self, pixels: ReadOnlySpan[int], format: PixelFormat, x: int, y: int, width: int, height: int) -> None:

Push a region of the panel. The subclass handles any pixel-format conversion.

GetDefault()​

@staticmethod
def GetDefault() -> DisplayController:

The built-in display controller for this board, or null if /config/display.json says the type is DisplayType.None. Customers using a custom (SPI/I2C/other) panel instantiate their own subclass of Display.DisplayController directly instead.

Returns DisplayController

GetSettings()​

@staticmethod
def GetSettings() -> DisplaySettings:

Reads the built-in display's settings from /config/display.json. Changes to the returned object do nothing until passed back to DisplayController.SetSettings.

Returns DisplaySettings

SetSettings(DisplaySettings settings)​

@staticmethod
def SetSettings(settings: DisplaySettings) -> None:

Writes the settings to /config/display.json (persisted across reboots). Does NOT apply them to the live panel - call DisplayController.Enable for that.

def ShowLogo(self) -> None:

Reads the logo filename from /config/display.json, decodes the 24-bit BMP file from /config, and calls DisplayController.Flush with it. No-op if the file is missing or not a 24-bit uncompressed BMP. Virtual so a subclass can replace the behaviour (e.g. pre-convert to the panel's native format once instead of on every call).