In development. It changes without notice.
Topic
Display
The panel: its surface, its text, its frames and its light.
What draws calls the functions of display::, which draw on a surface (graphics::
A panel driver takes the description of its controller (what to send at the start, how it rotates, how large its memory is) from Display Panel Drivers and does all the traffic on the bus itself. The panel's size, its pins and its bus come from Build Configuration. On the boards whose light hangs off the power chip, that chip drives it.
Files | |
| file | src/ |
| A frame buffer held as row bands, in one block or in one block per band. | |
| file | src/ |
| Allocation-free integer rectangle intersection for the software clip. | |
| file | src/ |
| Multi-region dirty-rectangle tracker that merges nearby areas. | |
| file | src/ |
| Compile-time display panel and bus descriptors for the active variant. | |
| file | src/ |
Device-agnostic display drawing API (the display:: namespace). | |
| file | src/ |
The CoreInk e-paper back-end of the display:: API (display_hal.h). | |
| file | src/ |
The SPI TFT back-end (ST7789 / ILI9342) of the display:: API (display_hal.h). | |
| file | src/ |
| Shared display text helpers (UTF-8 to Latin-1 folding). | |
| file | src/ |
| Display primitive types: RGB565 color constants and text datums. | |
| file | src/ |
| Self-contained monochrome e-paper panel driver implementing the graphics Surface. | |
| file | src/ |
| The atlas each font role is drawn from, per panel class. | |
| file | src/ |
| Self-contained anti-aliased UI font format and runtime decoder. | |
| file | src/ |
When a frame the loop task paints reads an input: the rule behind display::. | |
| file | src/ |
| Backend-independent 2D drawing primitives over an abstract Surface. | |
| file | src/ |
| Ink/paper decisions for 1-bit monochrome panels: the text threshold and the ordered (Bayer) dither for brand art. | |
| file | src/ |
| PMIC-controlled display backlight and panel-rail control. | |
| file | src/ |
| Shared RGB565 alpha-blend helpers for anti-aliased rendering. | |
| file | src/ |
| Self-contained SPI display panel driver implementing the graphics Surface. | |
| file | src/ |
| Backend-independent bitmap text renderer over a graphics Surface. | |
Typedefs | |
| using | kleidos:: |
| A function an open frame runs to read an input (setFramePoll). | |
| using | kleidos:: |
| A function the panel runs once each time it goes from asleep to awake. | |
Functions | |
| constexpr bool | kleidos:: |
Intersect rect in place with the rectangle [x, y, w, h]. | |
| constexpr PanelController | kleidos:: |
| Get the panel controller selected by the active variant. | |
| constexpr BusInterface | kleidos:: |
| Get the bus interface selected by the active variant's display pin assignments. | |
| constexpr PanelSpec | kleidos:: |
| Assemble the full panel descriptor from the active variant's config. | |
| constexpr kleidos:: | kleidos:: |
| Frame-memory size of a panel controller. | |
| constexpr kleidos:: | kleidos:: |
| The part of the controller's memory a panel shows. | |
| constexpr bool | kleidos:: |
| Whether a panel's declared placement lies inside its controller's memory. | |
| kleidos:: | kleidos:: |
| Get the SPI host for the active variant. | |
| BusSpec | kleidos:: |
| Assemble the full bus descriptor for the active variant. | |
| const char * | kleidos:: |
| Get the human-readable name for a panel controller. | |
| const char * | kleidos:: |
| Get the human-readable name for a bus interface. | |
| bool | kleidos:: |
| Check whether the given panel/bus combination is supported. | |
| void | kleidos:: |
| Initialize the active display backend (SPI panel or e-paper). | |
| void | kleidos:: |
| Swap the ink/paper polarity for the light/dark theme on 1-bit panels. | |
| bool | kleidos:: |
| Switch e-paper partial refreshes between the quality and fast waveforms. | |
| bool | kleidos:: |
| Select the e-paper user refresh mode ("Full" vs the hybrid default). | |
| bool | kleidos:: |
| Bring the e-paper panel up without clearing it. | |
| bool | kleidos:: |
| Take the frame drawn since initEpaperRetained as what the glass shows. | |
| void | kleidos:: |
Run hook on every poll while the e-paper panel is busy. | |
| void | kleidos:: |
| Read an input from inside the frames the loop task paints. | |
| bool | kleidos:: |
| bool | kleidos:: |
| Read back an e-paper RAM plane or CPU frame buffer (QA/debug). | |
| bool | kleidos:: |
| Override the e-paper fast-animation waveform at runtime (QA tuning). | |
| bool | kleidos:: |
| Render a 2-bit grayscale image on the e-paper (QA/ | |
| bool | kleidos:: |
| Render a retained full-frame 6-tone grayscale image (QA/static UI). | |
| bool | kleidos:: |
| Begin composing the current frame as 6-tone grayscale (static UI). | |
| bool | kleidos:: |
| Finish a tone-compose pass by driving the retained 6-tone frame. | |
| void | kleidos:: |
| Discard an armed tone-compose pass without a gray render. | |
| bool | kleidos:: |
| Whether a 6-tone tone-compose pass is currently armed. | |
| bool | kleidos:: |
| Whether a 6-tone gray frame is currently retained on the panel. | |
| bool | kleidos:: |
| Whether the e-paper controller currently holds the fast-animation LUT. | |
| bool | kleidos:: |
Power the e-paper panel's analog rails down once the glass has been still for idleMs. | |
| bool | kleidos:: |
| Run one windowed grayscale update pass for wall-clock profiling (QA probe). | |
| void | kleidos:: |
| Put the active display into its low-power sleep state. | |
| void | kleidos:: |
| Before a deep sleep: drive the backlight pin to its off level and hold it there through the sleep. | |
| bool | kleidos:: |
| Re-initialize a controller that lost its supply. | |
| bool | kleidos:: |
| Take the backlight pad back for the display driver. | |
| void | kleidos:: |
| Set backlight brightness as a chip-agnostic percent (0..100). | |
| uint8_t | kleidos:: |
| Get the last brightness setting. | |
| void | kleidos:: |
| Fill the entire screen with a single color. | |
| void | kleidos:: |
| Fill a rectangular region with a single color. | |
| uint32_t | kleidos:: |
| How many times the whole glass has been cleared since boot. | |
| void | kleidos:: |
| Draw a 1-pixel-wide rectangle outline. | |
| void | kleidos:: |
| Fill a rounded rectangle. | |
| void | kleidos:: |
| Draw a rounded rectangle outline. | |
| void | kleidos:: |
| Draw a Bresenham line. | |
| void | kleidos:: |
| Draw a 1-pixel-tall horizontal line. | |
| void | kleidos:: |
Fill a disc of radius r around (x, y). | |
| void | kleidos:: |
Draw a 1-pixel circle of radius r around (x, y). | |
| void | kleidos:: |
| Draw a single pixel. | |
| void | kleidos:: |
| Set text color with an opaque background. | |
| void | kleidos:: |
| Set text color with a transparent background. | |
| void | kleidos:: |
| Set text scale factor. | |
| void | kleidos:: |
| Set text alignment datum. | |
| void | kleidos:: |
| Select a logical font role. Call before drawString/ | |
| int | kleidos:: |
| Approximate font height for the current font (used for layout). | |
| int | kleidos:: |
| Pixel width of a string in the current font (advance, not bounding box). | |
| int | kleidos:: |
| Pixel width of a string in the bold face of the current font. | |
| void | kleidos:: |
| Draw a string with the current text settings. | |
| void | kleidos:: |
| Fake-bold: draws the string twice with a 1px horizontal offset so AA glyphs look heavier without needing a separate bold typeface. Use sparingly (selected rows, section headers, headlines). | |
| void | kleidos:: |
| Place the top-left corner of the next print or printf text. | |
| void | kleidos:: |
| Print a NUL-terminated string at the cursor. | |
| void | kleidos:: |
| Print an integer at the cursor. | |
| void | kleidos:: |
| printf-style output at the cursor. | |
| void | kleidos:: |
| Turn the drawing by quarter turns (0 to 3) clockwise. | |
| bool | kleidos:: |
| Check whether the active backend supports read-back of pixel data. | |
| bool | kleidos:: |
| Check whether the read-back surface holds a frame the UI actually drew. | |
| void | kleidos:: |
| Read a rectangular region into an RGB565 buffer. | |
| bool | kleidos:: |
| Read a panel controller register over the display bus. | |
| bool | kleidos:: |
Fill out with how the panel controller was identified. | |
| bool | kleidos:: |
| Describe the panel controller's memory and how the driver reaches it. | |
| bool | kleidos:: |
| Read a rectangle of the panel controller's memory. | |
| bool | kleidos:: |
Memory cell the driver draws logical pixel (x, y) into. | |
| uint32_t | kleidos:: |
| Seqlock counter for tear-free read-back of a composed frame. | |
| uint32_t | kleidos:: |
| Count of the draws the panel has taken since boot, composed into a frame or streamed to the glass. | |
| void | kleidos:: |
| Enable/ | |
| bool | kleidos:: |
| Read the accumulated damage union. | |
| void | kleidos:: |
| Drop the accumulated damage (call after a successful capture). | |
| void | kleidos:: |
| Write a block of RGB565 pixels to a rectangular region. | |
| void | kleidos:: |
| Block until the panel has caught up with all queued writes. No-op on panels without a deferred refresh. On e-paper a frame that changes the glass wakes a sleeping panel first; one that does not leaves it asleep. | |
| void | kleidos:: |
| Constrain subsequent draws to a rectangle (software clip). | |
| void | kleidos:: |
Release the software clip armed by setClip (restore full-screen drawing). | |
| void | kleidos:: |
| Open a frame: a batched write transaction. | |
| void | kleidos:: |
Close a frame opened by startWrite(). | |
| void | kleidos:: |
| Mark the open frame as a heavy one: a full-frame compose or a popup card. | |
| void | kleidos:: |
| Temporarily release the live-render shadow framebuffer to free SRAM. | |
| void | kleidos:: |
Try to reallocate the shadow framebuffer released by releaseLiveFramebuffer(). | |
| bool | kleidos:: |
| void | kleidos:: |
| Draw text into an off-screen sprite, then push to display in one transfer. Zero flicker: the old content is replaced atomically. | |
| void | kleidos:: |
| Same as drawStringBuffered, but selects a logical font role at its native size (no nearest-neighbor scaling). Use this for crisp glyphs instead of textSize=N which scales Font0 blockily. | |
| constexpr int16_t | kleidos:: |
| Get the logical screen width in pixels (constexpr). | |
| constexpr int16_t | kleidos:: |
| Get the logical screen height in pixels (constexpr). | |
| constexpr int16_t | kleidos:: |
| Get the screen center X coordinate in pixels (constexpr). | |
| constexpr int16_t | kleidos:: |
| Get the screen center Y coordinate in pixels (constexpr). | |
| void | kleidos:: |
| Wake the active display from its sleep state. | |
| void | kleidos:: |
Run hook each time wakeup() brings a sleeping panel back, inside that call, before anything draws on the panel. | |
| bool | kleidos:: |
Whether setPanelPark() is holding the panel asleep. | |
| bool | kleidos:: |
Whether the panel is in the sleep state sleep() put it in. | |
| bool | kleidos:: |
Fill out with the active SPI panel's bus status for diagnostics. | |
| size_t | kleidos:: |
Fold a UTF-8 string to Latin-1 (best-effort), writing up to outputCapacity bytes including the NUL terminator. | |
| bool | kleidos:: |
| Check whether a string needs folding for the active font. | |
| size_t | kleidos:: |
| Copy a UTF-8 string upper-cased, for the Latin-1 letters the atlas draws. | |
| constexpr FontLadder | kleidos:: |
The ladder a panel of width x height draws with. | |
| constexpr FontRung | kleidos:: |
The rung ladder draws role at. | |
| uint16_t | kleidos:: |
Resolve a codepoint to its glyph id within font. | |
| bool | kleidos:: |
| Get the descriptor for a glyph id. | |
| uint8_t | kleidos:: |
| Read one glyph's A4 alpha value at a box-local pixel. | |
| constexpr bool | kleidos:: |
Text rule on a 1-bit panel: does a glyph pixel of coverage draw ink? | |
| bool | kleidos:: |
Ordered-dither decision: does coverage render as ink at (x, y)? | |
| bool | kleidos:: |
| Power the display logic rails and leave a PMIC- or expander-driven LCD reset line released. | |
| bool | kleidos:: |
| Pulse the LCD reset line the PMIC (Core2 v1.3, AXP192 GPIO4) or the I/O expander (CoreS3 SE, AW9523B P1.1) drives. | |
| bool | kleidos:: |
| Whether the board's LCD reset line is the PMIC's or the expander's. | |
| bool | kleidos:: |
| Set the PMIC-controlled backlight to a chip-agnostic brightness percent. | |
| uint8_t | kleidos:: |
| Expand a 4-bit (A4) coverage nibble to the full 0..255 alpha range. | |
| uint16_t | kleidos:: |
Alpha-blend foreground over background in RGB565 space. | |
| int | kleidos:: |
| Get the glyph height for a font role. | |
| int | kleidos:: |
| Get the rendered width of a string. | |
| void | kleidos:: |
| Draw a string onto a Surface. | |
| void | kleidos:: |
| Count the anti-aliased glyph atlases wired for this board's UI roles. | |
Variables | |
| constexpr size_t | kleidos:: |
| Suggested scratch buffer size for folding. | |
| constexpr char | kleidos:: |
| Single-byte sentinel the fold emits for U+2022 BULLET (•). | |
| constexpr unsigned int | kleidos:: |
| Code point the AA renderer looks up for kMaskGlyphByte (U+2022 BULLET). | |
| constexpr char | kleidos:: |
| Single-byte stand-in for U+2026 HORIZONTAL ELLIPSIS in folded text. | |
| constexpr unsigned int | kleidos:: |
| Code point the AA renderer looks up for kEllipsisGlyphByte. | |
| constexpr uint16_t | kleidos:: |
| Pure black (R=0, G=0, B=0). | |
| constexpr uint16_t | kleidos:: |
| Deep navy blue (R=0, G=0, B=31). | |
| constexpr uint16_t | kleidos:: |
| Dark green (R=0, G=63, B=0). | |
| constexpr uint16_t | kleidos:: |
| Dark grey (50% luminance). | |
| constexpr uint16_t | kleidos:: |
| Pure blue (R=0, G=0, B=31). | |
| constexpr uint16_t | kleidos:: |
| Pure green (R=0, G=63, B=0). | |
| constexpr uint16_t | kleidos:: |
| Cyan (G=63, B=31). | |
| constexpr uint16_t | kleidos:: |
| Pure red (R=31, G=0, B=0). | |
| constexpr uint16_t | kleidos:: |
| Magenta (R=31, B=31). | |
| constexpr uint16_t | kleidos:: |
| Yellow (R=31, G=63). | |
| constexpr uint16_t | kleidos:: |
| Pure white (R=31, G=63, B=31). | |
| constexpr uint16_t | kleidos:: |
| Warm orange. | |
| constexpr uint8_t | kleidos:: |
| Anchor: top-left of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: top-center of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: top-right of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: middle-left of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: middle-center of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: middle-right of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: bottom-left of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: bottom-center of the text bounding box. | |
| constexpr uint8_t | kleidos:: |
| Anchor: bottom-right of the text bounding box. | |
| constexpr std::array< std::array< uint8_t, 5 >, 4 > | kleidos:: |
Atlas size per ladder (rows, in FontLadder order) and role (columns, in Font order: SMALL, BODY, HEADING, LARGE, MONO). | |
| constexpr int32_t | kleidos:: |
| constexpr int32_t | kleidos:: |
| Biased glyph coverage at or above which the pixel is ink: half coverage. | |
| constexpr std::array< uint8_t, 64 > | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Number of columns/rows in the ordered-dither matrix (its period in pixels). | |
| constexpr uint8_t | kleidos:: |
| Mask selecting the low 4 bits of an A4 coverage nibble. | |
| constexpr uint8_t | kleidos:: |
| Bit width of an A4 coverage nibble. | |
| constexpr uint32_t | kleidos:: |
| Rounding bias for the 8-bit alpha blend divide-by-255. | |
| constexpr uint8_t | kleidos:: |
| Full opacity for the 8-bit alpha blend. | |
Measurement parks | |
Two independent parks, because the panel and its light are two measurements. The FSM wakes the display on a state change and on every input, so a park is what keeps a measured state alive past the next keypress; and one shared flag would let a release of either name silently light the other's panel. Neither park lights anything when it is released: the caller applies the state it wants (a | |
| void | kleidos:: |
| Ignore every request to wake the panel. | |
| void | kleidos:: |
| Ignore every request to change the backlight level. | |
| bool | kleidos:: |
| Whether setBacklightPark is holding the backlight level. | |
Enumeration Type Documentation
BusInterface #
Font #
Logical font roles. Backends map these to the clearest device-specific text renderer available. Use these instead of setTextSize() to keep the UI legible across resolutions. The size of each role depends on the panel: kFontLadderPx.
FontLadder #
PanelController #
Function Documentation
aaAtlasStats() #
Count the anti-aliased glyph atlases wired for this board's UI roles.
Walks the five UI font roles (SMALL / BODY / HEADING / LARGE / MONO), resolves each to its baked AaFont atlas for the panel size, and reports how many are present plus the total glyph count across the distinct atlases. A board that loses an atlas from its per-size font ladder shows a lower count, so this is a cheap flash-inclusion regression probe.
- Parameters
-
Name Direction Meaning atlasCount out Receives the number of distinct non-null role atlases. totalGlyphs out Receives the summed glyph count of those atlases.
abortEpaperToneCompose() #
Discard an armed tone-compose pass without a gray render.
Frees the compose buffer and leaves the 1-bit frame untouched so a later waitDisplay renders it normally.
adoptEpaperRetainedFrame() #
Take the frame drawn since initEpaperRetained as what the glass shows.
Mirrors display::device::.
- Return values
-
Value Meaning true Frame adopted. false Panel not ready or not an SSD1681 panel.
backlightParked() #
Whether setBacklightPark is holding the backlight level.
- Return values
-
Value Meaning true setBrightness()is being ignored.false The level follows setBrightness()normally.
beginEpaperToneCompose() #
Begin composing the current frame as 6-tone grayscale (static UI).
Mirrors display::drawString / fillRect calls) records true panel tones — smooth gray anti-aliased text and gray fills — instead of collapsing to 1-bit. Pair with commitEpaperToneCompose at the frame boundary. While armed, waitDisplay / endWrite defer the 1-bit flush. Defined by the e-paper backend only: gate call sites on device::.
- Return values
-
Value Meaning true Tone capture armed; redraw the whole screen, then commit. false Not an SSD1681 panel or allocation failed (fall back to 1-bit).
blendRgb565() #
Alpha-blend foreground over background in RGB565 space.
- Parameters
-
Name Direction Meaning foreground in Source color (RGB565). background in Destination color (RGB565). alpha in Source coverage (0 = background, 255 = foreground).
- Returns
- Blended RGB565 color.
busInterfaceName() #
Get the human-readable name for a bus interface.
- Parameters
-
Name Direction Meaning interface in Bus interface enum value.
- Returns
- NUL-terminated name string.
canReadRect() #
Check whether the active backend supports read-back of pixel data.
- Return values
-
Value Meaning true if a readRect()call would return meaningful data (SPI panel with shadow buffer, or e-paper with frame buffer).false on panels without either (returns zeros from readRect).
centerX() #
Get the screen center X coordinate in pixels (constexpr).
- Returns
- Center X in pixels.
centerY() #
Get the screen center Y coordinate in pixels (constexpr).
- Returns
- Center Y in pixels.
commitEpaperToneCompose() #
Finish a tone-compose pass by driving the retained 6-tone frame.
If the screen drew nothing since beginEpaperToneCompose, the costly gray refresh is skipped and the pass is aborted. Otherwise the composed tones are rendered via the two-pass 6-tone waveform (retained for capture).
- Return values
-
Value Meaning true 6-tone frame rendered. false Nothing was drawn, compose was not armed, or the render failed.
deviceBusInterface() #
Get the bus interface selected by the active variant's display pin assignments.
- Returns
- Bus interface enum value.
deviceBusSpec() #
Assemble the full bus descriptor for the active variant.
- Returns
- BusSpec describing the active variant's SPI bus and backlight wiring.
devicePanelController() #
Get the panel controller selected by the active variant.
- Returns
- Panel controller enum value.
devicePanelSpec() #
Assemble the full panel descriptor from the active variant's config.
- Returns
- PanelSpec describing the active variant's display geometry and options.
deviceSpiHost() #
Get the SPI host for the active variant.
- Returns
- SPI host identifier.
drawCircle() #
Draw a 1-pixel circle of radius r around (x, y).
- Parameters
-
Name Direction Meaning x in Center X. y in Center Y. r in Radius in pixels. c in RGB565 color value.
drawCount() #
Count of the draws the panel has taken since boot, composed into a frame or streamed to the glass.
Only its movement means anything: a caller reads it before and after a stretch of code to learn whether that code drew, which a frame's own bookkeeping cannot tell while the frame is still open. The main loop reads it around the entering state's enter(), to learn whether the glass now holds the new state's first screen.
- Returns
- The count; it wraps.
drawFastHLine() #
Draw a 1-pixel-tall horizontal line.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Y coordinate in pixels. w in Width in pixels. c in RGB565 color value.
drawLine() #
Draw a Bresenham line.
- Parameters
-
Name Direction Meaning x0 in Start X. y0 in Start Y. x1 in End X. y1 in End Y. c in RGB565 color value.
drawPixel() #
Draw a single pixel.
- Parameters
-
Name Direction Meaning x in X coordinate in pixels. y in Y coordinate in pixels. c in RGB565 color value.
drawRect() #
Draw a 1-pixel-wide rectangle outline.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. c in RGB565 color value.
drawRoundRect() #
Draw a rounded rectangle outline.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. r in Corner radius in pixels. c in RGB565 color value.
drawString() [1/2] #
Draw a string with the current text settings.
- Parameters
-
Name Direction Meaning s in NUL-terminated string to draw. x in Top-left X coordinate in pixels (modified by datum). y in Top-left Y coordinate in pixels (modified by datum).
drawString() [2/2] #
Draw a string onto a Surface.
- Parameters
-
Name Direction Meaning surface in, out Target surface to draw onto. value in NUL-terminated string to render. posX in X coordinate in pixels (anchor, modified by style.datum).posY in Y coordinate in pixels (anchor, modified by style.datum).style in Visual attributes (font, color, scale, datum).
drawStringBold() #
Fake-bold: draws the string twice with a 1px horizontal offset so AA glyphs look heavier without needing a separate bold typeface. Use sparingly (selected rows, section headers, headlines).
- Parameters
-
Name Direction Meaning s in NUL-terminated string to draw. x in Top-left X coordinate in pixels (modified by datum). y in Top-left Y coordinate in pixels (modified by datum).
drawStringBuffered() #
Draw text into an off-screen sprite, then push to display in one transfer. Zero flicker: the old content is replaced atomically.
- Parameters
-
Name Direction Meaning s in NUL-terminated string to draw. box in Destination rectangle plus fill/text colors. textSize in Scale factor for the rendered glyphs. datum in Alignment datum (see display_ types.h).
drawStringBufferedFont() #
Same as drawStringBuffered, but selects a logical font role at its native size (no nearest-neighbor scaling). Use this for crisp glyphs instead of textSize=N which scales Font0 blockily.
- Parameters
-
Name Direction Meaning s in NUL-terminated string to draw. box in Destination rectangle plus fill/text colors. font in Font role to render with. datum in Alignment datum (see display_ types.h).
endWrite() #
Close a frame opened by startWrite().
The outermost close triggers the e-paper refresh or the SPI blit when anything was drawn, and on SPI panels ends the frame's boost to the frame clock (markHeavyFrame) once the blit is done.
epaperAlwaysFull() #
- Returns
- True while the e-paper panel forces a full refresh on every flush.
epaperFastPartial() #
Whether the e-paper controller currently holds the fast-animation LUT.
The render orchestrator drives the fast/quality waveform off the panel's real state (not a shadow flag) so a gray render — which drops the fast LUT — cannot leave a navigable 1-bit screen stuck on the slow quality waveform: the next 1-bit tick re-reads false here and re-arms fast partials. Defined by the e-paper backend only: gate call sites on device::.
- Return values
-
Value Meaning true Fast-animation LUT is loaded (partials use the short waveform). false Quality waveform (or not an SSD1681 fast-capable controller).
epaperGrayRetained() #
Whether a 6-tone gray frame is currently retained on the panel.
Retained gray sits on the glass until the next 1-bit flush releases it. The render orchestrator watches the retained → released edge to re-arm a settle so a GrayOnSettle screen returns to gray after a stray 1-bit repaint.
- Return values
-
Value Meaning true A retained tone frame is present (gray is on the glass). false No retained tone frame (1-bit, or the gray was collapsed).
epaperPowerDownWhenIdle() #
Power the e-paper panel's analog rails down once the glass has been still for idleMs.
Fast-mode and gray updates leave the panel's booster and source rails up so the next update starts sooner; a screen at rest would keep them up for as long as it stays. Called every loop tick; the next update powers the rails back up itself. Defined by the e-paper backend only: gate call sites on device::.
- Parameters
-
Name Direction Meaning nowMs in Monotonic time in milliseconds. idleMs in Quiet time before the rails go down.
- Return values
-
Value Meaning true The rails were powered down by this call.
epaperToneComposeActive() #
Whether a 6-tone tone-compose pass is currently armed.
- Return values
-
Value Meaning true Compose is armed (draws are captured as tones). false Not composing.
expandAlpha4() #
Expand a 4-bit (A4) coverage nibble to the full 0..255 alpha range.
Nibble n maps to (n<<4)|n so 0xF becomes 0xFF (fully opaque). This is the inverse of the offline A4 quantization used by the font and brand atlases.
- Parameters
-
Name Direction Meaning nibble in 4-bit coverage value (0..15).
- Returns
- 8-bit alpha (0..255).
fillCircle() #
Fill a disc of radius r around (x, y).
- Parameters
-
Name Direction Meaning x in Center X. y in Center Y. r in Radius in pixels. c in RGB565 color value.
fillRect() #
Fill a rectangular region with a single color.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. c in RGB565 color value.
fillRoundRect() #
Fill a rounded rectangle.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. r in Corner radius in pixels. c in RGB565 color value.
fillScreen() #
Fill the entire screen with a single color.
- Parameters
-
Name Direction Meaning color in RGB565 color value.
fitsControllerGram() #
Whether a panel's declared placement lies inside its controller's memory.
- Parameters
-
Name Direction Meaning panel in Panel descriptor.
- Returns
- True when every shown pixel has a memory address.
foldUtf8Latin1() #
Fold a UTF-8 string to Latin-1 (best-effort), writing up to outputCapacity bytes including the NUL terminator.
Multi-byte UTF-8 sequences that have a single-byte Latin-1 equivalent are folded; everything else is replaced with '?'. The result is always NUL-terminated as long as outputCapacity is at least 1.
- Parameters
-
Name Direction Meaning input in NUL-terminated UTF-8 source. output out Destination buffer. outputCapacity in Capacity of outputin bytes.
- Returns
- Number of bytes written (excluding the terminator).
fontHeight() [1/2] #
Approximate font height for the current font (used for layout).
- Returns
- Pixel height of the current font at the current text size.
fontHeight() [2/2] #
Get the glyph height for a font role.
- Parameters
-
Name Direction Meaning font in Font role to measure. size in Scale factor (default 1.0). bold in True to measure the bold face (matches a bold draw; default false).
- Returns
- Pixel height of the tallest glyph in the font at the given scale.
fontLadderFor() #
The ladder a panel of width x height draws with.
- Parameters
-
Name Direction Meaning width in Panel width in pixels. height in Panel height in pixels. monochrome in True for a 1-bit e-paper panel.
- Returns
- The panel's ladder.
fontRungFor() #
The rung ladder draws role at.
- Parameters
-
Name Direction Meaning ladder in The panel's ladder. role in UI font role.
- Returns
- The face (mono for
Font::MONO, sans otherwise) and its size.
framebufferHasContent() #
Check whether the read-back surface holds a frame the UI actually drew.
canReadRect only reports that a read-back surface exists. On the color backends that surface is allocated and zero-filled at display bring-up, so between bring-up and the first composed frame readRect() returns a fully black image that is indistinguishable from a genuine render. A capture taken in that window (for example by a QA tool that reset the board and sampled ~1 s into boot) therefore reads as a render defect when nothing is wrong. Callers that serve a captured frame to a host should refuse rather than hand out that placeholder.
- Return values
-
Value Meaning true the surface holds drawn content (any shadow mutation has happened), or the backend retains a settled frame at all times. false the color shadow buffer is still the zero-filled bring-up state.
frameSequence() #
Seqlock counter for tear-free read-back of a composed frame.
Even while the backend holds a complete, settled frame; odd while one is being composed. A reader on another core should load this, copy via readRect only when even, then re-load and keep the copy only if the value is unchanged — this keeps mid-compose states (which never reach the panel) out of captures.
It is also how a capture decides there is anything new to read, so it must advance once per settled frame on every backend that holds one. The e-paper backend turns it odd at the first draw of a frame and even again when the refresh that puts it on the glass has finished. A backend with no framebuffer at all returns 0.
- Returns
- The sequence: even while a settled frame is held, odd mid-compose, 0 when the backend has no framebuffer.
getBrightness() #
Get the last brightness setting.
- Returns
- Brightness percent in 0..100 (0 if
setBrightnesswas never called or the backend failed to apply the last value).
glyphAlpha() #
Read one glyph's A4 alpha value at a box-local pixel.
- Parameters
-
Name Direction Meaning font in Font owning the bitmap blob. glyph in Glyph descriptor previously obtained from glyphDsc. col in Column inside the glyph box (0 .. glyph.boxW - 1). row in Row inside the glyph box (0 .. glyph.boxH - 1).
- Returns
- 8-bit alpha (0..255) for the pixel; 0 when out of range.
glyphDsc() #
Get the descriptor for a glyph id.
- Parameters
-
Name Direction Meaning font in Font to query. glyphId in Glyph id (1-based; 0 is the reserved blank). glyph out Receives the descriptor on success.
- Returns
- True when
glyphIdis valid andglyphwas filled.
glyphIdFor() #
Resolve a codepoint to its glyph id within font.
- Parameters
-
Name Direction Meaning font in Font to query. codepoint in Unicode code point.
- Returns
- Glyph id (>= 1) on success, or 0 when the codepoint is absent.
gramSize() #
Frame-memory size of a panel controller.
- Parameters
-
Name Direction Meaning controller in Panel controller enum value.
- Returns
- The controller's GRAM at MADCTL 0; zero for
PanelController::.None
grayUpdateProbe() #
Run one windowed grayscale update pass for wall-clock profiling (QA probe).
Mirrors display::y0, y1], optionally scanning only gateLines gate lines, and reports the activation-to-idle time in outUpdateMs. A measurement seam for the grayscale-partial-refresh investigation, not a rendering path. Defined by the e-paper backend only: gate call sites on device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning msbPlane in Full-frame RED-plane bits (rowBytes*height bytes). lsbPlane in Full-frame B/W-plane bits (rowBytes*height bytes). lut in 153-byte gray-pass waveform LUT. y0 in First native row of the update window (inclusive). y1 in Last native row of the update window (inclusive). gateLines in Gate lines to scan (0 = full panel height). outUpdateMs out Activation-to-idle time of the update in ms.
- Return values
-
Value Meaning true Pass driven and geometry restored. false Panel not ready, bad arguments, or unsupported model.
hasPanelResetLine() #
Whether the board's LCD reset line is the PMIC's or the expander's.
- Returns
- True on the Core2 v1.3 and the CoreS3 SE.
height() #
Get the logical screen height in pixels (constexpr).
- Returns
- Screen height in pixels.
holdBacklightOff() #
Before a deep sleep: drive the backlight pin to its off level and hold it there through the sleep.
A deep sleep isolates every ESP pad it does not hold, so a backlight enable left to the PWM peripheral floats for the whole sleep and the backlight driver may light. For a board whose sleep leaves that driver powered (the Cardputer ADV) or whose pin would float (the T-Deck). From here the pin no longer follows setBrightness(); the next init() releases the hold. No-op without a backlight GPIO (a PMIC-driven backlight, e-paper).
init() #
Initialize the active display backend (SPI panel or e-paper).
Idempotent: callers may invoke it more than once without side effects. The active backend is selected at link time by the variant's display_
initEpaperRetained() #
Bring the e-paper panel up without clearing it.
For a board that powered on only to update the image the glass kept through a power cut: unlike init, the glass is left as it is. Draw the retained image, call adoptEpaperRetainedFrame, then draw the new image and flush. Defined by the e-paper backend only: gate call sites on device::.
- Return values
-
Value Meaning true Panel ready. false The panel did not come up.
intersectRect() #
Intersect rect in place with the rectangle [x, y, w, h].
Pure integer clamp; safe against overflow for on-screen coordinates. After the call rect holds the overlap (possibly empty).
- Parameters
-
Name Direction Meaning rect in, out Rectangle to clip; replaced by the overlap. x in Clip rectangle left edge. y in Clip rectangle top edge. w in Clip rectangle width. h in Clip rectangle height.
- Return values
-
Value Meaning true The overlap is non-empty ( rectnow describes it).false The rectangles do not overlap ( rectis empty).
isAsleep() #
Whether the panel is in the sleep state sleep() put it in.
getBrightness() keeps reporting the last brightness while the panel sleeps, so this is the call that tells a lit panel from a sleeping one. Declared for host builds too: a surface that paints nothing on a sleeping panel is host-tested against a fake.
- Return values
-
Value Meaning true sleep()put the panel to sleep and nothing has woken it.false The panel is awake, or never came up.
isSupported() #
Check whether the given panel/bus combination is supported.
- Parameters
-
Name Direction Meaning panel in Panel descriptor. bus in Bus descriptor.
- Return values
-
Value Meaning true if the combination is supported by the SPI panel driver (valid controller + SPI D/C bus + in-range pins + a panel placement inside the controller's memory). false otherwise — the driver will refuse to begin()with this descriptor.
liveFramebufferReleased() #
- Return values
-
Value Meaning true if releaseLiveFramebuffer()freed the buffer and it has not yet been restored. Always false on PSRAM / e-paper / no-shadow backends.
markHeavyFrame() #
Mark the open frame as a heavy one: a full-frame compose or a popup card.
On SPI panels the rest of the frame — its compose and its blit — runs at the frame clock (kleidos::) inside a kleidos:: that the open frame owns until its outermost endWrite(); the guard only raises the clock, so a crypto boost in force keeps its own. Idempotent within a frame, and a no-op outside an open frame. A full-screen fill (fillScreen) marks its frame by itself; the UI marks the others (ui::). A partial repaint is never marked and stays at the base clock. A no-op on e-paper, where the refresh is bound by the panel, not by the core.
monoBayerInk() #
Ordered-dither decision: does coverage render as ink at (x, y)?
A pure function of coverage and absolute panel position: a mid coverage turns into a deterministic ink/paper stipple whose density tracks the coverage, so a gray tone reads as gray on a 1-bit panel. Zero coverage is always paper; a fully covered pixel (255) is always ink (it exceeds the 254 threshold cap).
- Parameters
-
Name Direction Meaning coverage in Ink coverage (0 = paper .. 255 = solid ink). x in Absolute panel X of the pixel. y in Absolute panel Y of the pixel.
- Return values
-
Value Meaning true The pixel should be drawn as ink. false The pixel should be left as paper (background).
monoGlyphInk() #
Text rule on a 1-bit panel: does a glyph pixel of coverage draw ink?
A threshold on the weight-biased coverage, independent of the pixel's position: an anti-aliased fringe resolves to a clean edge instead of a position-dependent stipple, and a 1 px stem stays continuous. Zero coverage is always paper.
- Parameters
-
Name Direction Meaning coverage in Glyph coverage (0 = paper .. 255 = solid ink).
- Return values
-
Value Meaning true The pixel should be drawn as ink. false The pixel should be left as paper (background).
needsFold() #
Check whether a string needs folding for the active font.
Used by the renderer to skip the fold buffer when the source is already pure Latin-1 and the active font covers it.
- Parameters
-
Name Direction Meaning value in NUL-terminated candidate string. activeFontCoversLatin1 in Whether the active font renders Latin-1.
- Return values
-
Value Meaning true if valuecontains characters that need folding (or any non-ASCII byte).false if valueis pure ASCII, or the active font already covers its bytes.
panelControllerName() #
Get the human-readable name for a panel controller.
- Parameters
-
Name Direction Meaning controller in Panel controller enum value.
- Returns
- NUL-terminated name string (e.g. "ST7789", "ILI9342", "None").
panelIdentity() #
Fill out with how the panel controller was identified.
- Parameters
-
Name Direction Meaning out out Record to populate.
- Return values
-
Value Meaning true A panel is up and outis populated.false The panel never came up; outuntouched.
panelMemoryCellOf() #
Memory cell the driver draws logical pixel (x, y) into.
- Parameters
-
Name Direction Meaning x in Logical X. y in Logical Y. column out Memory column. row out Memory row.
- Return values
-
Value Meaning true The cell lies inside the controller's memory. false It does not (or no panel is up).
panelMemoryInfo() #
Describe the panel controller's memory and how the driver reaches it.
- Parameters
-
Name Direction Meaning out out Record to populate.
- Return values
-
Value Meaning true A panel is up and outis populated.false The panel never came up; outuntouched.
panelParked() #
Whether setPanelPark() is holding the panel asleep.
Declared for host builds too, beside isAsleep.
placement() #
The part of the controller's memory a panel shows.
- Parameters
-
Name Direction Meaning panel in Panel descriptor.
- Returns
- Its native size and offsets, at MADCTL 0.
prepareDisplay() #
Power the display logic rails and leave a PMIC- or expander-driven LCD reset line released.
Must be called once before the SPI panel driver addresses the panel. The reset itself is resetPanel, which the panel driver runs once it has identified the controller. Backlight brightness is handled separately via setBrightness().
- Return values
-
Value Meaning true if the rails came up (and the reset line is released). false if the active variant has no PMIC backlight, or the I2C write to the PMIC or the expander failed.
print() [1/2] #
Print a NUL-terminated string at the cursor.
- Parameters
-
Name Direction Meaning s in NUL-terminated string to print.
print() [2/2] #
Print an integer at the cursor.
- Parameters
-
Name Direction Meaning value in Value to print.
printf() #
printf-style output at the cursor.
- Parameters
-
Name Direction Meaning fmt in printf-style format string.
reacquireBacklight() #
Take the backlight pad back for the display driver.
A debug command that drives the pad as a plain GPIO leaves the PWM channel no longer routed to it, and the driver's own level writes then reach nothing while reporting success. This re-routes the pad and re-applies the level the driver holds.
- Return values
-
Value Meaning true The pad was re-routed (or needs no routing: a PMIC backlight). false There is no backlight on this board.
readEpaperRam() #
Read back an e-paper RAM plane or CPU frame buffer (QA/debug).
Plane selectors match display::device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning plane in Plane selector (0-3). out out Buffer receiving the 1 bpp row-major plane. outSize in Capacity of outin bytes.
- Return values
-
Value Meaning true Plane read/copied. false Unsupported plane/ controller, not ready, or SPI error.
readPanelMemory() #
Read a rectangle of the panel controller's memory.
A genuine bus read of the controller's frame memory (RAMRD on a TFT, the SSD1681's B/W RAM on e-paper), unlike readRect which serves the CPU frame. Each cell also says which logical pixel the driver draws into it and what the CPU frame holds there, so a caller can tell an unwritten cell from a written one.
- Parameters
-
Name Direction Meaning column in First memory column. row in First memory row. columns in Columns to read. rows in Rows to read. out out Receives columns x rows cells, row by row. capacity in Cells outholds.dummyBits in TFT dummy clocks to use, or -1 for the controller's.
- Return values
-
Value Meaning true outholds the cells.false Not readable on this board (panelMemoryInfo says why), a rectangle outside the memory, or a bus failure.
- Note
- Loop task only, like readPanelRegister.
readPanelRegister() #
Read a panel controller register over the display bus.
Issues cmd as a read command and clocks len parameter bytes back from the panel controller (e.g. RDDID 0x04 → 3 bytes, RDDST 0x09 → 4 bytes), framed the way the controller reads that register: the dummy clock RDDID and RDDST take, or an ILI9342 level 2 register's one-parameter-per-XREG-ordinal reads. This is a genuine bus transaction against the controller, distinct from readRect() which serves pixels from the RAM shadow buffer.
- Parameters
-
Name Direction Meaning cmd in Controller read command opcode. out out Buffer receiving lenbytes; must hold at leastlenbytes.len in Number of parameter bytes to read.
- Return values
-
Value Meaning true The read completed and outholds the parameters.false No panel read-back on this board (e-paper backend, or an SPI panel with no MISO and not wired 3-wire), or bad arguments.
- Note
- Must be called only from the sole display-SPI owner task (the Core-1 loop task). On the SPI panel backend this briefly retires the shared write device to run the read on its own CS-owning device; calling it concurrently with a display blit would wedge the panel via CS re-routing.
readRect() #
Read a rectangular region into an RGB565 buffer.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. buf out Buffer receiving width*height RGB565 values. Must be at least w*h*sizeof(uint16_t) bytes.
reinit() #
Re-initialize a controller that lost its supply.
init() cannot do this: it is idempotent and returns immediately once the driver is up, so after a rail cycle it would send the cold-booted controller nothing at all and the glass would stay dead while the caller reported a restore. wakeup() cannot either: it only sends SLPOUT, and a controller that lost VDD needs its whole initialization sequence.
Re-runs the panel's bring-up on the bus and the pins already configured: the panel logic rails where the PMIC owns them, the backlight routing, the reset pulse where there is a reset line, the controller's init sequence, and the brightness last set. The SPI bus and its device are left as they are.
- Return values
-
Value Meaning true The controller was re-initialized. false The driver never came up, so there was nothing to re-run.
releaseLiveFramebuffer() #
Temporarily release the live-render shadow framebuffer to free SRAM.
On a board without PSRAM the SPI-panel backend keeps its RGB565 shadow buffer (64,800 B on a 135x240 or 240x135 panel) in internal RAM; that leaves too little heap for the NimBLE stack or the Wi-Fi access point to start. Call this on the UI/render core immediately before bringing a radio up to hand that memory back; the renderer falls back to direct draw (unbuffered but correct) until restoreLiveFramebuffer() reclaims it. No-op when the shadow buffer lives in PSRAM (it is not stealing internal RAM there), on backends without a shadow buffer, and on e-paper. Called again while the buffer is already released, it restarts the reclaim schedule, so the reclaim after the next radio starts with its per-tick window. Pair with restoreLiveFramebuffer(); query state with liveFramebufferReleased().
renderEpaperGray() #
Render a 2-bit grayscale image on the e-paper (QA/
Mirrors display::device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning msbPlane in Gray-index MSB plane (1 bpp row-major, RED RAM). lsbPlane in Gray-index LSB plane (1 bpp row-major, B/W RAM). lut in 153-byte waveform LUT with per-index drive lengths.
- Return values
-
Value Meaning true Image rendered; the next flush resynchronizes with a full. false Panel not ready or bad arguments.
renderEpaperGrayFrame() #
Render a retained full-frame 6-tone grayscale image (QA/static UI).
Mirrors display::device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning toneFrame in Native row-major tone frame, one byte per pixel (0..5). pixelCount in Length of toneFramein pixels (native panel area).
- Return values
-
Value Meaning true Frame rendered and retained. false Panel not ready or bad arguments.
resetPanel() #
Pulse the LCD reset line the PMIC (Core2 v1.3, AXP192 GPIO4) or the I/O expander (CoreS3 SE, AW9523B P1.1) drives.
The SPI panel driver's reset hook: it runs inside the driver's bring-up, after the ILI9342 variant probe.
- Return values
-
Value Meaning true The pulse was sent. false The board has no such reset line, or an I2C write failed.
restoreLiveFramebuffer() #
Try to reallocate the shadow framebuffer released by releaseLiveFramebuffer().
Call on the UI/render core, outside any frame, once every radio that borrowed the memory is down; the main loop calls it on every tick while liveFramebufferReleased() holds. The buffer comes back as 16-row bands, each its own allocation, so a heap the access point left split into blocks narrower than the frame still takes it. Attempts run on every tick for 750 ms (the heap settles a few ticks after Bluetooth stops), then every 5 s until one succeeds; a frame that would leave less than 16 kB of internal heap free is given back and retried. One log line per outcome, not per attempt. Once it succeeds, buffered/
screenClears() #
How many times the whole glass has been cleared since boot.
Moved by fillScreen() and by a fillRect() that covers the whole panel: a screen's first paint clears the glass, so a count that moved since a header was drawn says that header is no longer on it (the battery gauge's watch, ui/
- Returns
- The count; it wraps, and only its equality with an earlier read means anything.
setBacklightPark() #
Ignore every request to change the backlight level.
While set, setBrightness() does nothing, so the level a measurement set stays until the park is released.
- Parameters
-
Name Direction Meaning parked in True to ignore setBrightness(), false to honor it again.
setBrightness() [1/2] #
Set backlight brightness as a chip-agnostic percent (0..100).
0 powers the backlight off. Each HAL backend maps the percent onto its panel's usable range (PMIC voltage window or PWM duty); see M5PmicBacklight and SpiPanelDriver for the per-chip mapping. Values above 100 are clamped to 100 by the backend. While the panel sleeps the level is only kept: the backlight stays off until wakeup() lights it.
- Parameters
-
Name Direction Meaning b in Brightness percent in 0..100.
setBrightness() [2/2] #
Set the PMIC-controlled backlight to a chip-agnostic brightness percent.
percent in 0..100; 0 powers the backlight rail off. The percent is mapped onto the variant's usable voltage window [DISPLAY_
- Parameters
-
Name Direction Meaning percent in Brightness level, 0..100.
- Return values
-
Value Meaning true if the PMIC register write succeeded. false if the active variant has no PMIC backlight.
setClip() #
Constrain subsequent draws to a rectangle (software clip).
Arms an exact, uniform software clip on the active backend: every primitive drawn afterwards — fills, outlines, lines, circles, anti-aliased shapes and text — is clamped to the intersection of the screen and this rectangle. Content outside is dropped exactly, with no partial coverage. Coordinates are logical (rotation-aware) screen pixels; a non-positive w or h clips everything out. Pair with clearClip(). Every backend has a software clip.
- Parameters
-
Name Direction Meaning x in Clip left edge in pixels. y in Clip top edge in pixels. w in Clip width in pixels. h in Clip height in pixels.
setCursor() #
setEpaperAlwaysFull() #
Select the e-paper user refresh mode ("Full" vs the hybrid default).
Mirrors display::device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning enable in True for always-full ("Full"), false for the hybrid.
- Return values
-
Value Meaning true Mode applied (or already in it). false Panel not ready.
setEpaperBusyPoll() #
Run hook on every poll while the e-paper panel is busy.
Mirrors display::device::.
- Parameters
-
Name Direction Meaning hook in The function to run, or null for none.
setEpaperFastTuning() #
Override the e-paper fast-animation waveform at runtime (QA tuning).
Mirrors display::device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning lut in 153-byte LUT, or nullptr to restore the built-in. sourceVoltage in Three 0x04 bytes (VSH1, VSH2, VSL), or nullptr for the panel's OTP calibration. updateMode in 0x22 byte for fast partials, or -1 for built-in.
- Return values
-
Value Meaning true Overrides stored (and pushed live if fast mode is active). false Panel not ready.
setFastPartial() #
Switch e-paper partial refreshes between the quality and fast waveforms.
Only meaningful on e-paper: fast mode loads a custom short animation LUT and keeps the analog rails on between updates, so region updates complete faster than with the OTP waveform's ghost-compensated one, trading contrast headroom for speed. Callers must keep fast-mode streaks bounded (an animation, a live counter) and disable it afterwards — leaving fast mode consolidates with a full refresh on the next flush. Entering on a sleeping panel wakes it first; leaving on a sleeping panel sends nothing (its deep sleep dropped the fast LUT already). Defined by the e-paper backend only: gate call sites on device:: (the setInvert pattern).
- Parameters
-
Name Direction Meaning enable in True to enter fast-animation mode, false to leave it.
- Return values
-
Value Meaning true Mode switched (controller has a tuned fast LUT). false Panel not ready or controller lacks a fast LUT.
setFont() #
Select a logical font role. Call before drawString/
- Parameters
-
Name Direction Meaning role in Font role to use for subsequent text draws.
setFramePoll() #
Read an input from inside the frames the loop task paints.
A frame is composed and blitted synchronously on the task that draws it, and an input read only by polling is not read meanwhile: a tap that lands and lifts during it was never seen. While hook is set, every draw made inside an open frame (between startWrite and the outermost endWrite) runs it once periodMs has passed since it last ran, the outermost endWrite runs it before its blit whatever the period, and the blit runs it between its chunks under the same period. A frame that draws nothing runs it at most at that commit. It is not run from inside itself (the rule: frame_poll.h).
The hook runs on the drawing task, with the panel's bus held during a blit: it must not draw or use that bus. Defined by the color-TFT backend only: gate call sites on !device::.
- Parameters
-
Name Direction Meaning hook in The function to run, or null for none. periodMs in The least time between two runs inside a frame, ms.
setInvert() #
Swap the ink/paper polarity for the light/dark theme on 1-bit panels.
Only meaningful on e-paper, where it flips every pixel's paper/ink decision so the shared dark palette reads as dark content on paper white (light theme). The next full screen redraw renders the new polarity. Color panels implement this as a no-op. Driven by the persisted ui::ThemeMode.
- Parameters
-
Name Direction Meaning invert in True for the light (paper-background) look.
setPanelPark() #
setRotation() #
Turn the drawing by quarter turns (0 to 3) clockwise.
- Parameters
-
Name Direction Meaning r in Rotation in 0..3 (0, 90, 180, 270 degrees clockwise). Backends apply the variant's DISPLAY_skew and re-aim the panel's MADCTL so the active area stays centered on the physical glass.OFFSET_ ROTATION
setTextColor() [1/2] #
Set text color with a transparent background.
- Parameters
-
Name Direction Meaning fg in Foreground (text) RGB565 color.
setTextColor() [2/2] #
Set text color with an opaque background.
- Parameters
-
Name Direction Meaning fg in Foreground (text) RGB565 color. bg in Background RGB565 color.
setTextDatum() #
Set text alignment datum.
- Parameters
-
Name Direction Meaning d in Datum code (see display_ types.h).
setTextSize() #
Set text scale factor.
- Parameters
-
Name Direction Meaning s in Scale factor (1.0 = native).
setWakeHook() #
Run hook each time wakeup() brings a sleeping panel back, inside that call, before anything draws on the panel.
The main loop's battery sample (hal/wakeup(); nullptr removes it.
- Parameters
-
Name Direction Meaning hook in The function to run, or nullptr.
sleep() #
Put the active display into its low-power sleep state.
On SPI panels this powers the backlight off and sends DISPOFF + SLPIN. On e-paper it flushes a pending frame, powers the analog rails down if they are up and puts the controller into deep sleep; the glass keeps the frame. Idempotent: a sleeping panel takes no command, so a call while asleep sends nothing and costs nothing, and the idle path may call it on every tick.
spiBusStatus() #
Fill out with the active SPI panel's bus status for diagnostics.
- Parameters
-
Name Direction Meaning out out Snapshot to populate (untouched on failure).
- Return values
-
Value Meaning true Active backend is an SPI panel; outis populated.false Active backend has no SPI panel (e.g. e-paper); outuntouched.
startWrite() #
Open a frame: a batched write transaction.
Bracket a sequence of draws with startWrite() / endWrite(). On e-paper the bracket coalesces the slow full-screen refresh into one transfer; on SPI panels the draws compose into the RAM shadow framebuffer and the outermost endWrite() blits them in one transfer, or stream directly while no shadow buffer is available. Brackets nest; the outermost pair is the frame.
streamDamageEnable() #
Enable/
Damage bookkeeping for a live-stream reader on the services core. The seqlock makes pixel reads tear-free but says nothing about WHERE damage landed; a reader that wants to fetch only the changed band enables this, peeks the union bounding box of every mutation since its last clear, and clears it after a successful capture. It bounds what readGlassRect (a debug build's capture read) would read differently: on a color panel every draw into the shadow buffer, on electronic paper the box each refresh changed on the glass, noted only in a debug build, where a capture runs. A backend that reports none leaves its readers to fall back to full frames.
- Parameters
-
Name Direction Meaning on in True to accumulate, false to stop and drop any damage.
streamDamagePeek() #
Read the accumulated damage union.
- Parameters
-
Name Direction Meaning x out Left edge. y out Top edge. w out Width (0 when nothing changed). h out Height.
- Return values
-
Value Meaning true Damage exists; false nothing changed / unsupported.
textWidth() [1/2] #
Get the rendered width of a string.
- Parameters
-
Name Direction Meaning value in NUL-terminated string to measure. font in Font role to use. size in Scale factor (default 1.0). bold in True to measure the bold face (matches a bold draw; default false).
- Returns
- Pixel width of the rendered string (advance, not bounding box).
textWidth() [2/2] #
Pixel width of a string in the current font (advance, not bounding box).
- Parameters
-
Name Direction Meaning s in NUL-terminated string to measure.
- Returns
- Pixel width.
textWidthBold() #
Pixel width of a string in the bold face of the current font.
- Parameters
-
Name Direction Meaning s in NUL-terminated string to measure.
- Returns
- Pixel width (advance, not bounding box).
upperUtf8Latin1() #
Copy a UTF-8 string upper-cased, for the Latin-1 letters the atlas draws.
ASCII a-z and the Latin-1 lowercase letters U+00E0..U+00FE (except U+00F7 DIVISION SIGN) map to their capitals; every other byte or sequence, ß and ÿ among them, is copied unchanged, so the output stays valid UTF-8. The result is NUL-terminated whenever outputCapacity is at least 1, and a sequence that would not fit whole is left out rather than cut.
- Parameters
-
Name Direction Meaning input in NUL-terminated UTF-8 source. output out Destination buffer. outputCapacity in Capacity of outputin bytes.
- Returns
- Number of bytes written (excluding the terminator).
wakeup() #
Wake the active display from its sleep state.
Counterpart of sleep(); brings the panel back to the brightness set by the last setBrightness() call. Idempotent: an awake panel sends nothing. On e-paper a wake is a hardware reset and the init sequence, and the next flush is a full refresh. An e-paper flush, or an entry into the fast waveform (setFastPartial), wakes a sleeping panel by itself. Declared for host builds too: the wake-press gate (hal/) is host-tested against a fake.
width() #
Get the logical screen width in pixels (constexpr).
- Returns
- Screen width in pixels.
writePixels() #
Write a block of RGB565 pixels to a rectangular region.
- Parameters
-
Name Direction Meaning x in Left edge in pixels. y in Top edge in pixels. w in Width in pixels. h in Height in pixels. pixels in Source buffer of width*height RGB565 values.
Variable Documentation
kEllipsisGlyphByte #
Single-byte stand-in for U+2026 HORIZONTAL ELLIPSIS in folded text.
The ellipsis is in every atlas, but it is outside Latin-1, so folding a cut string to Latin-1 cannot spell it, and ".." would be confusable beside an abbreviation that ends in one and two advances wide instead of one. It folds to this sentinel: the AA renderer looks the real glyph up again, and the bitmap backend draws three baseline dots.
kFontLadderPx #
Atlas size per ladder (rows, in FontLadder order) and role (columns, in Font order: SMALL, BODY, HEADING, LARGE, MONO).
- Stick: the action bar sans 10, rows and labels sans 13 (sans 13 shares the sans-12 line box), dialog titles sans 16, heroes sans 24, data mono 14.
- Cardputer: hints and tab labels sans 12, body sans 14, titles sans 15 (drawn bold), heroes from sans 24, data mono 14 (tokens::
kCardputerSheetFont holds the same sizes). - 320 x 240: sans 12 / 16 / 20 / 32, mono 16.
- CoreInk: tab labels sans 11, row and body labels sans 14, header titles sans 17 (bold), the sans 32 hero base, mono 16 for data, drawn from the e-paper family.
kMaskGlyphByte #
Single-byte sentinel the fold emits for U+2022 BULLET (•).
The text renderer iterates folded text byte-wise, so the 3-byte UTF-8 bullet cannot survive to the glyph lookup as its real code point (8226). Instead the fold collapses U+2022 to this one byte (0x95, the CP1252/
kMonoBayer8x8 #
8x8 recursive (Knuth) Bayer ordered-dither thresholds, scaled to 0..254. Indexed by absolute panel (y & 7) * 8 + (x & 7): deterministic from position, so a redraw reproduces the same stipple. The 254 cap keeps a fully-covered pixel (coverage 255) always above threshold, so solid interiors never drop a pixel.
kMonoGlyphInkBias #
"+weight" bias added to a glyph's coverage before the ink decision: e-ink hairlines vanish, so glyphs render slightly bolder (e-ink text is 1-bit, solid and a little heavier). Kept small because the atlas coverage is already stem-darkened when the atlases are generated.