Architecture
PyDevices separates reusable product code from application examples:
pydevicesowns portable interfaces, hardware drivers, board wiring, and releases.pydevices-examplesowns examples, application helpers, integration docs, and the PyScript/PWA gallery.
Component diagram
flowchart TB
subgraph product [pydevices product]
BC[board_config.py]
DD[displaydev]
AD[audiodev]
EV[events and keys]
MT[multimer]
ES[eventsys optional]
DR[board configs and drivers]
end
subgraph coordinator [application-owned coordinator]
AR[app_runtime for non-LVGL]
LR[display_driver for LVGL]
end
subgraph showcase [pydevices-examples showcase]
EX[examples]
UT[application utilities]
PW[PyScript gallery and PWA]
end
DR --> BC
BC --> DD
BC --> AD
EV --> ES
MT --> ES
BC --> AR
ES --> AR
BC --> LR
MT --> LR
AR --> EX
LR --> EX
DD --> EX
AD --> EX
EX --> PW
UT --> EX
Responsibilities
| Piece | Role |
|---|---|
board_config.py |
Creates hardware interfaces such as display_drv and
exports neutral input/timing capabilities. It does not create an
application runtime. |
displaydev |
Cross-platform display interfaces and desktop/browser backends. |
audiodev |
Cross-platform audio output/input interfaces and host backends. |
events / keys |
Shared event types, key codes, modifiers, and matching helpers. |
multimer |
Cross-platform Timer, AsyncTimer, ticks,
sleep, and asyncio exposure. |
eventsys |
Optional event traffic controller for applications that want the supplied dispatcher and input adapters. |
app_runtime |
pydevices-examples's non-LVGL opt-in: creates an
eventsys.Runtime from the selected board config and adds
gallery test behavior. |
display_driver |
LVGL-specific coordinator shared by the binding repos; bridges LVGL
to displaydev and multimer without importing
eventsys. |
utils |
Example helpers and third-party GUI integration adapters. |
Non-LVGL boot sequence
- Install the product packages and a board config.
- Import
display_drvfromboard_config. - Import
runtimefrom pydevices-examples'sapp_runtime, or create your owneventsys.Runtime.from_board_config(board_config). - Build the UI, register callbacks, and run the coordinator.
from board_config import display_drv
from app_runtime import runtime
display_drv.fill_rect(0, 0, 10, 10, 0xF800)
display_drv.show()
def on_click(event):
...
runtime.on(runtime.events.MOUSEBUTTONDOWN, on_click)
runtime.run_forever()eventsys is optional product functionality: applications
may supply a different dispatcher or event loop instead.
LVGL boot sequence
LVGL applications import the coordinator supplied with the binding:
from board_config import display_drv
from display_driver import runtime
runtime.run_forever()The LVGL coordinator owns tick/task handling, display presentation,
input-device adapters, and quit lifecycle. It consumes neutral
board-config exports and multimer; it does not depend on
eventsys.