displaydev.wasmdisplay

Direct MicroPython WebAssembly RGB565 display and browser input backend.

class displaydev.wasmdisplay.WasmDevices(canvas_id)[source]

Bases: object

Translate neutral bridge records into the project-wide events contract.

class displaydev.wasmdisplay.WasmDisplay(width=320, height=240, canvas_id='display_canvas', *, quiet=False)[source]

Bases: DesktopDisplay, FBDisplay

A Python-owned RGB565 framebuffer scanned live by the browser.

Apps draw into _framebuffer through the inherited FBDisplay primitives. _displayed starts out as _framebuffer (the same object) – the browser’s requestAnimationFrame loop reads straight off WASM linear memory at the registered pointer every frame regardless of whether Python ever calls show, so a single shared buffer is already correct and show() needs to do nothing.

A second, real _displayed buffer is only allocated the first time an app actually engages the classic hardware vertical-scroll registers (vscrdef/vscsad/vscroll – emulating a real SPI panel’s scan address, the way PSDisplay does with drawImage). LVGL apps never touch that API; they scroll entirely at the widget level, so they stay single-buffered and never pay for a full-frame copy on every flush. _composite is where that promotion happens, and where the row- shifted copy runs once it has.

needs_refresh

True — appdev.App drives periodic show(), so draws that never call show() explicitly (e.g. a scroll timer) still reach the composited front buffer once double- buffered.

Type:

bool

init()[source]

Initializes the display instance. Called by __init__ and rotation setter.

show(_timer=None)[source]

Show the display. Base class method does nothing. May be overridden by subclasses.