In development. It changes without notice.
Topic
Input Sources & the Wake Rule
Buttons, keyboards, trackball and touch behind four interfaces, and the rule that the first input on a dark panel only wakes it.
| Interface | What it gives | Implementations |
|---|---|---|
| ButtonInput | A button's level, its edges, its holds and clicks | GpioButtonInput, TouchZoneButtonInput, GenericKeyboardButtonInput, VirtualButtonInput for tests on a computer |
| KeyboardInput | Characters, and keys in a queue | TDeckKeyboard, CardputerKeyboard |
| TrackballInput | Steps in four directions and a click | TDeckTrackball |
| TouchInput | Taps and the point under the finger | TDeckTouch, and the FT6x36 panels' |
The wake rule. An input that meets a dark panel wakes it and does nothing else; the next one acts. Every source applies it, so a screen cannot forget it. A press made while a screen waits on something else is kept, not lost.
Files | |
| file | src/ |
| Abstract button-input interface for hardware, virtual, or mock buttons. | |
| file | src/ |
| Sample buttons while the loop is blocked, so a press is not lost. | |
| file | src/ |
| Resolves each Cardputer TCA8418 key event into the character it typed. | |
| file | src/ |
| Cardputer ADV keyboard driver exposed as a KeyboardInput. | |
| file | src/ |
| Full-pointer FT6x36 touch HAL policy layer for the M5 Core touch boards. | |
| file | src/ |
| ButtonInput adapter that maps a keyboard key to a one-shot edge. | |
| file | src/ |
| Debounced ButtonInput backed by a raw GPIO pin. | |
| file | src/ |
| Hands queued key edges to one poll at a time, with an idle poll between. | |
| file | src/ |
| Abstract character-level keyboard input contract. | |
| file | src/ |
| Click detection for a power key the firmware reads as a plain GPIO, which ignores the press that switched the board on. | |
| file | src/ |
| One key per poll from the T-Deck's keyboard controller, which hands each press over once (host-tested). | |
| file | src/ |
| T-Deck I2C keyboard driver (ESP32-C3 controller at I2C address 0x55). | |
| file | src/ |
| T-Deck GT911 capacitive touch HAL policy layer. | |
| file | src/ |
| From the T-Deck's GT911 coordinates to the landscape panel's (host-tested). | |
| file | src/ |
| T-Deck trackball HAL wrapper (TrackballInput app-seam adaptation). | |
| file | src/ |
| The one FT6x36 panel its two readers share: its controller, the one sample both judge, and the contact as each judges it by the wake-press rule. | |
| file | src/ |
| Abstract touch-input contract (tap and point detection). | |
| file | src/ |
| The one sample of a touch panel its readers share, and when the panel is read for it. | |
| file | src/ |
| The reads of a touch panel taken while the loop task paints, kept for the next poll. | |
| file | src/ |
| Touch-zone-backed ButtonInput for FT6x36 M5 Core devices. | |
| file | src/ |
| Abstract trackball input contract (directional navigation + click). | |
| file | src/ |
| The wake-press rule for a quadrature trackball: a roll or a click that meets a dark panel only wakes it (host-tested). | |
| file | src/ |
| Programmatically driven ButtonInput for native host tests. | |
| file | src/ |
| An input that meets a dark panel only wakes it (host-tested rule). | |
| file | src/ |
| The live side of the wake-press rule: the panel state every input source reads, and the one wake per pump. | |
Namespaces | |
| namespace | kleidos:: |
| Key codes shared across keyboard implementations. | |
| namespace | kleidos:: |
| The keyboard backlight's level vocabulary, shared by its one setting and the drivers that drive it. | |
| namespace | kleidos:: |
| The unattended brightness sweep's schedule, as pure arithmetic. | |
| namespace | kleidos:: |
| Key codes returned by the T-Deck keyboard controller. | |
Typedefs | |
| using | kleidos:: |
| What runs when an input met the dark panel: wake it and stamp the activity. | |
Functions | |
| void | kleidos:: |
| Run each button's debounce and edge detection without consuming an edge. | |
| constexpr bool | kleidos:: |
| Whether a raw keycap code is a modifier (Fn / Option / Ctrl / Shift / Alt). | |
| constexpr bool | kleidos:: |
| Whether a keycap's code is a raw usage rather than what it types. | |
| constexpr Cell | kleidos:: |
Find the cell whose unshifted keycap code is cap. | |
| constexpr Cell | kleidos:: |
Find the keycap that types the character code unshifted. | |
| constexpr char | kleidos:: |
The character the cell at (row, col) types with mods held. | |
| constexpr Keystroke | kleidos:: |
The keycap and modifiers that type c. | |
| constexpr char | kleidos:: |
Type c the way a press event would, through the board's keymap. | |
| constexpr bool | kleidos:: |
Whether c backs out of a screen on a keyboard board. | |
| constexpr bool | kleidos:: |
Whether timeoutMs is a held window (kHoldTimeoutMs). | |
| constexpr uint32_t | kleidos:: |
The window a driver runs for ms. | |
| constexpr uint8_t | kleidos:: |
The controller duty percent asks for. | |
| constexpr uint8_t | kleidos:: |
| The level the keyboard is driven at for an on/off switch and a level. | |
| constexpr bool | kleidos:: |
| Whether a keypress is recent enough to keep the keyboard lit. | |
| constexpr bool | kleidos:: |
| Whether the keyboard's light should be on this tick. | |
| constexpr Action | kleidos:: |
| Decide what one idle tick does to the backlight. | |
| constexpr uint8_t | kleidos:: |
The level point index measures. | |
| constexpr uint8_t | kleidos:: |
| Blocks the plan's points fall into. | |
| constexpr uint8_t | kleidos:: |
| The point index that measures full scale. | |
| constexpr uint16_t | kleidos:: |
| Lit pulses the schedule holds, the ready lamp excluded. | |
| constexpr uint32_t | kleidos:: |
| Length of the whole schedule, from the arm to Phase::Done. | |
| constexpr uint32_t | kleidos:: |
| Elapsed time the measured schedule starts at: the ready lamp's fall. | |
| constexpr uint8_t | kleidos:: |
| Greatest common divisor, for the stride's coprimality test. | |
| constexpr bool | kleidos:: |
| Whether a plan can run. | |
| constexpr Slot | kleidos:: |
Where the schedule is elapsedMs after it was armed. | |
| constexpr uint32_t | kleidos:: |
| FNV-1a over the schedule's lit-pulse levels, in run order. | |
| template<std:: | |
| PolledKey | kleidos:: |
| Take this poll's key: whatever the controller's read handed over, queued behind the keys still waiting. | |
| constexpr int32_t | kleidos:: |
| Scale one controller coordinate to a panel axis. | |
| constexpr PanelPoint | kleidos:: |
| Map a GT911 coordinate onto the landscape panel. | |
| bool | kleidos:: |
| Whether the panel's controller answers, probing it when it does not. | |
| const char * | kleidos:: |
| The name of the controller found. | |
| const hal:: | kleidos:: |
| The panel's sample for this input pump, read when the pump's read is due. | |
| const hal:: | kleidos:: |
| The panel's sample for a read from inside a frame the loop paints. | |
| const hal:: | kleidos:: |
| The panel's kept sample, for a reader outside the pump. | |
| uint32_t | kleidos:: |
| How many times the panel has been read since boot. | |
| void | kleidos:: |
| Record whether the pointer is swallowing the contact in progress. | |
| bool | kleidos:: |
| Whether the pointer is swallowing the contact in progress. | |
| void | kleidos:: |
| Record whether a zone is swallowing a press. | |
| bool | kleidos:: |
| Whether a zone is swallowing a press. | |
| constexpr bool | kleidos:: |
| Whether an input arriving now meets a dark panel. | |
| const char * | kleidos:: |
| Short lower-case name of a source, as the console prints it. | |
| void | kleidos:: |
| Register what wakes the panel for a swallowed gesture. | |
| bool | kleidos:: |
| Whether an input arriving now meets a dark panel. | |
| bool | kleidos:: |
| Whether the panel itself is dark now, the wake a pump ran aside. | |
| void | kleidos:: |
| Ask for the panel's wake: a gesture began on a dark panel. | |
| void | kleidos:: |
| Start a pump of the inputs: forget the wake the previous pump ran. | |
| void | kleidos:: |
| End a pump of the inputs: run the wake asked for, once. | |
| Stats | kleidos:: |
| What the gate has done since boot. | |
Variables | |
| constexpr uint8_t | kleidos:: |
| Rows of the Cardputer keycap matrix. | |
| constexpr uint8_t | kleidos:: |
| Columns of the Cardputer keycap matrix. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the Fn modifier keycap. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the Option modifier keycap. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the left Ctrl modifier keycap. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the left Shift modifier keycap. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the left Alt modifier keycap. | |
| constexpr uint8_t | kleidos:: |
| Raw code of the Backspace keycap (its HID usage). | |
| constexpr uint8_t | kleidos:: |
| Raw code of the Tab keycap (its HID usage). | |
| constexpr uint8_t | kleidos:: |
| Raw code of the Enter keycap (its HID usage). | |
| constexpr KeyValue | kleidos:: |
| The Cardputer ADV keycap matrix, row 0 = the number row. | |
| constexpr FnKey | kleidos:: |
| The Fn layer, as the Cardputer hardware legends it. | |
| constexpr uint32_t | kleidos:: |
| Debounce period in milliseconds. | |
| constexpr char | kleidos:: |
| No key (sentinel / "no event"). | |
| constexpr char | kleidos:: |
| Newline / Enter. | |
| constexpr char | kleidos:: |
| Backspace. | |
| constexpr char | kleidos:: |
| Forward-delete (Cardputer Fn+Backspace). | |
| constexpr char | kleidos:: |
| Horizontal tab. | |
| constexpr char | kleidos:: |
| Escape. | |
| constexpr char | kleidos:: |
| Up arrow. | |
| constexpr char | kleidos:: |
| Down arrow. | |
| constexpr char | kleidos:: |
| Left arrow. | |
| constexpr char | kleidos:: |
| Right arrow. | |
| constexpr char | kleidos:: |
| Space. | |
| constexpr uint8_t | kleidos:: |
| Darkest level: the backlight stays off, a keypress included. | |
| constexpr bool | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Brightest level the controller can drive. | |
| constexpr uint8_t | kleidos:: |
| Increment of the keyboard-light editor between kMinPercent and kMaxPercent. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Top of the controllers' own duty scale (0 = off). | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Longest ordinary window. Past this, ask for a hold and mean it. | |
| constexpr uint32_t | kleidos:: |
| The window that never closes: the stored level is lit and held until the window is handed back. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Most points a plan may measure. | |
| constexpr uint8_t | kleidos:: |
| Points the default curve measures: 50 levels, floor to full scale. | |
| constexpr uint8_t | kleidos:: |
| Grid the levels sit on, in percent: 2 % gives 2..100 in 50 steps. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint16_t | kleidos:: |
| One measured point, ms. | |
| constexpr uint16_t | kleidos:: |
| The dark reference between two pulses, ms: half a point. | |
| constexpr uint16_t | kleidos:: |
| A marker or a bracket pulse, ms: twice a point. | |
| constexpr uint16_t | kleidos:: |
| constexpr uint16_t | kleidos:: |
| Dark tail after the last pulse, ms. | |
| constexpr uint16_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| What Slot::point carries while a slot measures no point. | |
| constexpr uint32_t | kleidos:: |
| FNV-1a offset basis (RFC-less but universally stated as such). | |
| constexpr uint32_t | kleidos:: |
| FNV-1a 32-bit prime. | |
| constexpr Plan | kleidos:: |
| The plan a keyboard sweep runs when it is given no arguments. | |
| constexpr uint32_t | kleidos:: |
| constexpr char | kleidos:: |
| constexpr char | kleidos:: |
| No key / sentinel value. | |
| constexpr char | kleidos:: |
| Enter key. | |
| constexpr char | kleidos:: |
| Backspace key. | |
| constexpr char | kleidos:: |
| Tab key (currently unused). | |
| constexpr char | kleidos:: |
| Escape (if available on this layout). | |
| constexpr char | kleidos:: |
| Space bar. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
Enumeration Type Documentation
Action #
What an idle tick has to do to the backlight controller.
| Enumerator | |
|---|---|
| None | Leave the controller alone: this tick writes no bus. |
| LightAt | Drive it to dutyForPercent of the stored level. |
| TurnOff | Drive it to 0. |
Phase #
What a slot of the schedule is.
Source #
The kind of input that asked for a wake (diagnostics only).
TouchSleepResult #
Verdict #
Function Documentation
arrivesDark() #
Whether an input arriving now meets a dark panel.
- Return values
-
Value Meaning true The panel is dark, or a wake ran since this pump began. false The panel is lit, dimmed, parked or e-paper: the input acts.
blockCount() #
Blocks the plan's points fall into.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
points/ markEvery, or 0 when the plan marks nothing.
cellOf() #
Find the cell whose unshifted keycap code is cap.
- Parameters
-
Name Direction Meaning cap in Raw keycap code to look for.
- Returns
- Its cell, or an invalid cell when no keycap carries
cap.
cellOfCharacter() #
Find the keycap that types the character code unshifted.
Like cellOf, but it only considers keycaps that carry the character they type, so asking for * cannot answer with the Backspace keycap.
- Parameters
-
Name Direction Meaning code in ASCII code of the character to look for.
- Returns
- Its cell, or an invalid cell when no keycap types
codeunshifted.
clampTimeoutMs() #
The window a driver runs for ms.
- Parameters
-
Name Direction Meaning ms in Window asked for, in ms.
- Returns
- kHoldTimeoutMs unchanged, or
msinside kMinTimeoutMs ..kMaxTimeoutMs.
- Note
- The sentinel is tested FIRST. Written the other way round it is above kMaxTimeoutMs, so a hold would clamp to ten minutes and collapse to the baseline at minute ten — a run that looks right and is not.
controllerName() #
The name of the controller found.
- Returns
- Its chip name, or an empty string before one answers.
controllerReady() #
Whether the panel's controller answers, probing it when it does not.
A controller that is not ready at boot is probed again at most once a second, so the panel comes online later.
- Parameters
-
Name Direction Meaning nowMs in Current millis32()reading.
- Return values
-
Value Meaning true The controller has been found and is ready. false No controller yet.
currentSample() #
The panel's kept sample, for a reader outside the pump.
Reads the panel only when the kept sample is stale (no pump has read it for hal::).
- Parameters
-
Name Direction Meaning nowMs in Current millis32()reading.
- Returns
- The kept sample.
decide() #
Decide what one idle tick does to the backlight.
The whole auto-dim rule, as a pure function the host tests: a keypress within the window lights the keyboard, the window expiring puts it out, and a stored kMinPercent keeps it dark whatever the keys do.
The level is checked FIRST, and that ordering is the behavior rather than a tidy-up: a driver's lit flag is a flag, not a level, so at 0 % the duty it would be lit at is 0 and the controller never reports itself lit. Asking "recent key and not lit?" first would therefore answer yes on every tick of the whole window, once per poll, on the board whose draw this level exists to cut.
- Parameters
-
Name Direction Meaning levelPct in The stored level, 0..100 (kMinPercent = never lit). lit in Whether the controller is driving the backlight now. recentKey in Whether a key was pressed within the idle window.
- Returns
- The one controller write this tick owes, or Action::None.
dutyForPercent() #
The controller duty percent asks for.
- Parameters
-
Name Direction Meaning percent in Level in 0..100; anything above kMaxPercent clamps to it.
- Returns
- Duty on the controller's 0..kMaxDuty scale.
effectivePercent() #
The level the keyboard is driven at for an on/off switch and a level.
- Parameters
-
Name Direction Meaning on in Whether the user turned the keyboard light on. level in The stored level, 0-100 %.
- Returns
levelwhile the light is on, kMinPercent (dark) while it is off.
frameSample() #
The panel's sample for a read from inside a frame the loop paints.
Read by the pump's rule, except that it never probes a missing controller and makes no read while the last one failed (hal::
- Parameters
-
Name Direction Meaning nowMs in Current millis32()reading.
- Returns
- The kept sample: this read, or the last one when none is made.
gcdOf() #
Greatest common divisor, for the stride's coprimality test.
- Parameters
-
Name Direction Meaning a in First value. b in Second value.
- Returns
- The GCD; 0 only when both are 0.
isBack() #
Whether c backs out of a screen on a keyboard board.
Esc is the advertised back key, but the T-Deck keyboard has none, so Backspace and Left (the trackball) back out too.
- Parameters
-
Name Direction Meaning c in A key code from KeyboardInput::.getChar()
- Returns
truefor Esc, Backspace or Left.
isModifier() #
Whether a raw keycap code is a modifier (Fn / Option / Ctrl / Shift / Alt).
- Parameters
-
Name Direction Meaning cap in Raw keycap code from kKeyMap.
- Returns
truefor a modifier keycap.
isRawCodeCap() #
Whether a keycap's code is a raw usage rather than what it types.
kKeyMap holds one mixed namespace: a printable keycap carries the ASCII it types, while Backspace, Tab, Enter and the modifiers carry a raw code. The two overlap — 0x2A, 0x2B and 0x28 are Backspace, Tab and Enter and the ASCII of *, + and ( — so a lookup by character must skip these cells or it lands on the wrong key.
- Parameters
-
Name Direction Meaning cap in Raw keycap code from kKeyMap.
- Returns
truefor a keycap that carries a raw code.
keyIsRecent() #
Whether a keypress is recent enough to keep the keyboard lit.
keySeen is what separates "nobody has pressed anything" from "a key
0 ms ago". Without it the two are the same state: lastKeyMs starts at 0 and nowMs is milliseconds since the last reset, so a few hundred milliseconds into a boot the window reads as open and the keyboard lights itself with nothing touched. A deep-sleep wake is a reset, so it would do so on every wake. It is the trap the clock facade exists to prevent: 0 is never a stamp, only the absence of one.
- Parameters
-
Name Direction Meaning keySeen in Whether a key has been pressed since the last reset. nowMs in millis32()now.lastKeyMs in millis32()when the last key was pressed.timeoutMs in How long a press keeps the keyboard lit.
- Returns
- Whether the keyboard should be lit on this tick.
keystrokeFor() #
The keycap and modifiers that type c.
The inverse of resolveCell, for the serial injection bridge: the console names a final character, this names the keystroke that produces it, and resolveCell types it back. An injected key therefore runs the board's real keymap instead of bypassing it with a pre-baked character.
- Parameters
-
Name Direction Meaning c in The character to type.
- Returns
- The keystroke; its cell is invalid when no keycap types
c.
levelAt() #
Where the schedule is elapsedMs after it was armed.
A function of elapsed time: no accumulator, no step counter. A tick lost to a long frame therefore delays one controller write and can never shift the schedule, which is what makes it safe to drive from a loop that can be late.
- Parameters
-
Name Direction Meaning plan in The sweep (planValid). elapsedMs in Milliseconds since the plan was armed.
- Returns
- The slot in force, or one with Phase::Done past the end.
levelFnv1a() #
FNV-1a over the schedule's lit-pulse levels, in run order.
One number standing for the whole level sequence, so the host can recompute it from its own copy of this arithmetic and refuse to cut the board's power on a mismatch. It is the only check that proves two implementations of the schedule agree for this exact plan, and it runs before anything irreversible.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
- The hash over pulseCount levels (the ready lamp excluded, since it is always full scale and carries no information).
maxPercentPoint() #
The point index that measures full scale.
Full scale is the brightest level and the one the brackets and markers are also lit at, so a reading has to be able to say which real point carries it: with the default stride it is point 19, which abuts a marker. That is why a pulse is identified by its width and never by its amplitude.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
- The index whose level is kMaxPercent, or kNoPoint when the grid does not reach it.
panelDark() #
Whether an input arriving now meets a dark panel.
- Parameters
-
Name Direction Meaning asleep in The panel sleeps ( display::).isAsleep parked in A measurement holds it asleep ( display::).panelParked retainsImage in Its glass keeps the image ( device::).kDisplayIsEpaper
- Return values
-
Value Meaning true Asleep, and nothing on the glass to see: the input only wakes. false Lit, dimmed, parked or e-paper: the input acts.
panelIsDark() #
Whether the panel itself is dark now, the wake a pump ran aside.
What the next pump's inputs will meet, unless something wakes the panel first: arrivesDark without the rest of the tick a wake ran in. The debug console reports it, so a harness deciding whether to send a wake input never reads a panel that has just been woken as dark.
- Return values
-
Value Meaning true Asleep, not parked, not e-paper. false Lit, dimmed, parked or e-paper.
panelPointFromTouch() #
Map a GT911 coordinate onto the landscape panel.
- Parameters
-
Name Meaning rawX Controller X, along the panel's short side. rawY Controller Y, along the panel's long side. xSpan Controller resolution on X. ySpan Controller resolution on Y. width Panel width in landscape. height Panel height in landscape.
- Returns
- The point on the panel.
panelReads() #
How many times the panel has been read since boot.
- Returns
- The count of controller reads.
percentForPoint() #
The level point index measures.
- Parameters
-
Name Direction Meaning plan in The sweep. index in Point index, 0.. plan.points-1.
- Returns
- Level in percent, on the plan's grid, never kMinPercent.
planValid() #
Whether a plan can run.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Return values
-
Value Meaning true Every point is on the grid and reachable, the blocks divide the points, the widths form a strict ladder, and every slot is longer than the settle left out of it. false Anything else: a plan whose last point is above kMaxPercent, a stride that revisits a level and misses another, a width ladder that cannot tell a marker from a merged pair of points, or a slot with no measuring window.
pointerSwallowing() #
Whether the pointer is swallowing the contact in progress.
- Return values
-
Value Meaning true The zones read released until it ends. false No contact, or one that acts.
pollKey() #
Take this poll's key: whatever the controller's read handed over, queued behind the keys still waiting.
- Parameters
-
Name Direction Meaning keys in, out The keyboard's delivery queue (the console's injected keys wait in it too, in the order they came). read in What this poll's read returned: key_for no key, a failed read, or a poll that read nothing.code:: kNone dark in Whether a key arriving now meets a dark panel ( hal::).wake_ press:: arrivesDark
- Returns
- This poll's key, Enter normalized, and
presson every key the queue hands over: the idle poll before it is the release. On a dark panel a key is no press: the queue is emptied andwokeis set.
pulseCount() #
Lit pulses the schedule holds, the ready lamp excluded.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
- Brackets at both ends, one marker per block, and every point.
pumpSample() #
The panel's sample for this input pump, read when the pump's read is due.
- Parameters
-
Name Direction Meaning nowMs in Current millis32()reading.
- Returns
- The kept sample: this pump's read, or the last one when none is due or no controller answers.
requestWake() #
Ask for the panel's wake: a gesture began on a dark panel.
The wake runs at the end of the pump in progress, or of the next one when no pump is in progress.
- Parameters
-
Name Direction Meaning source in The kind of input that met the dark panel.
resolveCell() #
The character the cell at (row, col) types with mods held.
The single resolution rule of this board: one cell, the modifiers held when it was pressed, one character. A modifier cell, an out-of-range cell and the Tab keycap resolve to key_ — nothing in Kleidos consumes Tab, and surfacing it would make Tab navigate as if it were a arrow key.
- Parameters
-
Name Direction Meaning row in Matrix row. col in Matrix column. mods in Modifiers held at the moment of the press.
- Returns
- The character typed, or
key_when the cell types nothing.code:: kNone
resolveInjected() #
Type c the way a press event would, through the board's keymap.
- Parameters
-
Name Direction Meaning c in The character the serial console asked for.
- Returns
- The character the matrix produces for it, or
key_when no keycap typescode:: kNone c(or its keycap types nothing, as Tab does).
sampleLevels() #
Run each button's debounce and edge detection without consuming an edge.
Reads each input's level, which updates its debounced state and latches any press or release edge; the edges stay for the next wasPressed() / wasClicked() / wasReleaseFor() call. Null entries are skipped.
- Parameters
-
Name Direction Meaning inputs in, out The buttons to sample.
scaleToPanel() #
Scale one controller coordinate to a panel axis.
- Parameters
-
Name Meaning raw Controller coordinate. rawSpan Controller resolution on that axis, greater than 1. panelSpan Panel size on the axis it lands on.
- Returns
- The panel coordinate, not yet clamped.
setPointerSwallowing() #
Record whether the pointer is swallowing the contact in progress.
- Parameters
-
Name Direction Meaning swallowing in The pointer's gesture began on a dark panel and has not ended.
setWakeHook() #
Register what wakes the panel for a swallowed gesture.
- Parameters
-
Name Direction Meaning hook in Called once per pump that had a wake asked for; nullptr to wake the panel directly.
setZonesSwallowing() #
Record whether a zone is swallowing a press.
- Parameters
-
Name Direction Meaning swallowing in A zone's press began on a dark panel and has not ended.
sourceName() #
Short lower-case name of a source, as the console prints it.
- Parameters
-
Name Direction Meaning source in The source.
- Returns
- "button", "key", "touch", "ball", "console" or "shake".
stats() #
What the gate has done since boot.
- Returns
- The counters.
t0Ms() #
Elapsed time the measured schedule starts at: the ready lamp's fall.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
plan.readyMs— the instant the host anchors every boundary on.
totalMs() #
Length of the whole schedule, from the arm to Phase::Done.
- Parameters
-
Name Direction Meaning plan in The sweep.
- Returns
- Milliseconds, the ready lamp included.
windowHeld() #
Whether timeoutMs is a held window (kHoldTimeoutMs).
- Parameters
-
Name Direction Meaning timeoutMs in A window in ms.
- Returns
- Whether the window never closes.
windowOpen() #
Whether the keyboard's light should be on this tick.
A keypress inside the window, or a held window, which never closes. The hold enters the auto-dim rule through the one input it already has, so decide needs no case for it, the driver needs no second path to its controller, and handing the window back puts the light out through the production rule rather than through a cleanup step that could be missed.
- Parameters
-
Name Direction Meaning keySeen in Whether a key has been pressed since the last reset. nowMs in millis32()now.lastKeyMs in millis32()when the last key was pressed.timeoutMs in The window, or kHoldTimeoutMs for a held one.
- Returns
- Whether the window is open on this tick.
zonesSwallowing() #
Whether a zone is swallowing a press.
- Return values
-
Value Meaning true A contact the pointer first sees now began dark too. false No zone is swallowing a press.
Variable Documentation
kBacklogMaxAgeMs #
Age past which a kept read is no longer judged, ms: longer than any frame a screen paints, so only reads a loop that stopped polling left behind are dropped (a tap made then belongs to no screen the user could see).
kCarriageReturn #
Enter as some controller firmware sends it, which the keyboard reports as key_.
kContactTailMs #
How long after the last contact the pump keeps reading the panel on every pump, ms: the gap between two taps, or between a flick and the next.
kDebounceMs #
Time a key level change must follow the last accepted change before it counts, in ms.
kDefaultBracket #
Full-scale pulses at each end. Two ends, because the instrument's own oscillator tolerance over a five-minute schedule is wider than one slot: the pair measures the axis rate instead of assuming it.
kDefaultMarkEvery #
Points between two markers: the schedule's blocks. A marker makes an error local — the block it sits in is named and the other blocks stay publishable.
kDefaultOn #
Whether the keyboard lights at all until the user turns it on. Off, because a lit keyboard is the most expensive thing the T-Deck can do.
kDefaultPercent #
The level the light runs at once the user turns it on, until a level of their own is stored. Half scale, because the light costs less at a lower duty; sweep measures the curve.
kDefaultReadyMs #
The ready lamp, ms: twice a marker. It is lit at full scale from the moment the plan is armed, so the console can be asked whether the light really came on before the port is cut, and its FALL is the schedule's t0 — a landmark in the trace rather than an instant on either clock.
kDefaultSettleMs #
Head of every slot left out of its figures, ms. It absorbs the one tick a relight can be deferred by (passing through kMinPercent clears the driver's lit flag, so the next level lands on the following tick), the loop's own cadence, and the instrument's integration window.
kDefaultStride #
Grid steps between two consecutive slots. Coprime with kDefaultPoints, so the walk visits every level exactly once and a one-slot shift scrambles the curve instead of sliding it.
kDefaultTimeoutMs #
How long a keypress keeps the keyboard lit until something sets a window. Named here rather than in the driver, because the console reports it and a caller that takes the window away has to be able to hand this one back.
kFnLayer #
The Fn layer, as the Cardputer hardware legends it.
One table read in both directions: resolveCell types a cell through it and keystrokeFor names the cell a key code needs, so the serial injection bridge cannot disagree with the physical path about what Fn does.
kHoldTimeoutMs #
The window that never closes: the stored level is lit and held until the window is handed back.
UINT32_MAX and not 0, for three reasons in order of force. The project already owns this sentinel — settings::
kMinLevelPercent #
Dimmest level the user can pick while the light is on. Dark is the on/off switch's job, so the level editor starts one step above it.
kMinTimeoutMs #
Shortest window a driver accepts: a few idle polls, below which a keypress could not light the keys long enough for anyone to see it.
kRollQuietMs #
Quiet that ends a roll, ms: longer than the gap between the steps of one flick of the ball, shorter than a pause before a new roll.
kStaleMs #
Age past which a reader outside the pump reads the panel itself, ms: two idle periods, so one late pump does not cause a second read.