Display Classes#
The classes definied in ultimo_display
handle interaction with
display devices attached to the microcontroller. Since these devices are
diverse, the package is more of a framework for writing compatible devices
than a collection of concrete implementations.
The package provides two classes: an abstract base class
text_device.ATextDevice
and a concrete framebuffer-based
implementation framebuffer_text_device.FrameBufferTextDevice
.
Warning
This API may change in the future depending on the capabilities of other types of display hardware. In particular, it may grow support for drawing text in different colors on displays for which it is appropriate.
Text Devices#
The concept of an ATextDevice
is that it represents display of
monospaced text in rows and columns which has a cursor that can be displayed.
The API is fairly straightforward, providing methods to display text at a
(column, row)
position, erase a number of characters at a (column, row)
position, set the cursor’s (column, row)
position, hide the cursor, and
clear the display.
It also provides a ATextDevice.display_text()
method that creates
an Ultimo Consumer
that expects strings and displays
the values at a location.
Concrete subclasses will need to provide implementations of most of these
methods, although ATextDevice.erase()
and
ATextDevice.display_text()
have default implementations which may
suffice for many devices.
FrameBuffer Text Devices#
The FrameBufferTextDevice
provides a concrete implementation of
ATextDevice
using a framebuf.FrameBuffer
or another object which implements the same API.
It expects to be provided with an already-allocated buffer of the appropriate size for the number of rows and columns, and the pixel depth, along with the size of the display in characters, the pixel format, and optional background and foreground colors.
Warning
The FrameBufferTextDevice
has not been extensively tested.