refactor(api)!: one namespace per feature, screen split out
Namespaces were shared across features: `settings` was written by core, the
panel and touch, and `input` by touch and buttons. That made "does this
firmware implement the whole feature?" a question no pointer could answer.
Each namespace now belongs to exactly one feature or to core, so a feature is
a provider pointer and the compiler validates completeness:
gui, node -> screen, tree, under the screen feature
settings -> screen (rotation, theme), sys (timezone),
touch (calibration)
input -> touch, buttons
Runtime::open() no longer requires a GuiProvider; a firmware without one runs
with no screen/tree globals and reports sys.hasFeature("screen") false.
Rotation is one value again: GuiProvider::setRotation applies and persists, so
an app rotating the panel transiently puts the old value back itself.
This commit is contained in:
@@ -5,33 +5,33 @@
|
||||
---@alias Button "up"|"down"|"left"|"right"|"confirm"|"back"
|
||||
|
||||
-- Roles, not physical buttons: a device maps whatever hardware it has onto them, and
|
||||
-- up/down/left/right are the directions node.moveFocus already takes.
|
||||
-- up/down/left/right are the directions tree.moveFocus already takes.
|
||||
|
||||
---@class InputLib
|
||||
input = input or {}
|
||||
---@class ButtonsLib
|
||||
buttons = {}
|
||||
|
||||
---Returns the roles this device reports, so an app can label only the actions it has.
|
||||
---@return Button[]
|
||||
function input.getButtons() end
|
||||
function buttons.getAll() end
|
||||
|
||||
---Whether any button is held.
|
||||
---@return boolean
|
||||
function input.isAnyPressed() end
|
||||
function buttons.isAnyPressed() end
|
||||
|
||||
---Whether a button is held.
|
||||
---@param button Button
|
||||
---@return boolean
|
||||
function input.isPressed(button) end
|
||||
function buttons.isPressed(button) end
|
||||
|
||||
---Whether a button went down since the last poll.
|
||||
---@param button Button
|
||||
---@return boolean
|
||||
function input.wasPressed(button) end
|
||||
function buttons.wasPressed(button) end
|
||||
|
||||
---Whether a button came up since the last poll.
|
||||
---@param button Button
|
||||
---@return boolean
|
||||
function input.wasReleased(button) end
|
||||
function buttons.wasReleased(button) end
|
||||
|
||||
---Fired when a button goes down.
|
||||
---@param button Button
|
||||
|
||||
Reference in New Issue
Block a user