75b3a2c490
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.
47 lines
1.2 KiB
Lua
47 lines
1.2 KiB
Lua
---@meta
|
|
|
|
-- Generated from native/src/bindings/features/buttons.cpp. Do not edit.
|
|
|
|
---@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 tree.moveFocus already takes.
|
|
|
|
---@class ButtonsLib
|
|
buttons = {}
|
|
|
|
---Returns the roles this device reports, so an app can label only the actions it has.
|
|
---@return Button[]
|
|
function buttons.getAll() end
|
|
|
|
---Whether any button is held.
|
|
---@return boolean
|
|
function buttons.isAnyPressed() end
|
|
|
|
---Whether a button is held.
|
|
---@param button Button
|
|
---@return boolean
|
|
function buttons.isPressed(button) end
|
|
|
|
---Whether a button went down since the last poll.
|
|
---@param button Button
|
|
---@return boolean
|
|
function buttons.wasPressed(button) end
|
|
|
|
---Whether a button came up since the last poll.
|
|
---@param button Button
|
|
---@return boolean
|
|
function buttons.wasReleased(button) end
|
|
|
|
---Fired when a button goes down.
|
|
---@param button Button
|
|
function on_button_down(button) end
|
|
|
|
---Fired when a button comes up.
|
|
---@param button Button
|
|
function on_button_up(button) end
|
|
|
|
---Tap alias, fired on release like a click, after on_button_up.
|
|
---@param button Button
|
|
function on_button(button) end
|