Kleidos API Search

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.

See also
Hardware Abstraction Layer, Buttons & Gestures, Keyboard Drivers, Touch Controller Drivers, Trackball Driver

Files

file src/hal/input/button_input.h
Abstract button-input interface for hardware, virtual, or mock buttons.
file src/hal/input/button_sampler.h
Sample buttons while the loop is blocked, so a press is not lost.
file src/hal/input/cardputer_key_decoder.h
Resolves each Cardputer TCA8418 key event into the character it typed.
file src/hal/input/cardputer_keyboard.h
Cardputer ADV keyboard driver exposed as a KeyboardInput.
file src/hal/input/ft6x36_touch_input.h
Full-pointer FT6x36 touch HAL policy layer for the M5 Core touch boards.
file src/hal/input/generic_keyboard_button_input.h
ButtonInput adapter that maps a keyboard key to a one-shot edge.
file src/hal/input/gpio_button_input.h
Debounced ButtonInput backed by a raw GPIO pin.
file src/hal/input/key_delivery_queue.h
Hands queued key edges to one poll at a time, with an idle poll between.
file src/hal/input/keyboard_input.h
Abstract character-level keyboard input contract.
file src/hal/input/power_key_click.h
Click detection for a power key the firmware reads as a plain GPIO, which ignores the press that switched the board on.
file src/hal/input/tdeck_key_poll.h
One key per poll from the T-Deck's keyboard controller, which hands each press over once (host-tested).
file src/hal/input/tdeck_keyboard.h
T-Deck I2C keyboard driver (ESP32-C3 controller at I2C address 0x55).
file src/hal/input/tdeck_touch.h
T-Deck GT911 capacitive touch HAL policy layer.
file src/hal/input/tdeck_touch_map.h
From the T-Deck's GT911 coordinates to the landscape panel's (host-tested).
file src/hal/input/tdeck_trackball.h
T-Deck trackball HAL wrapper (TrackballInput app-seam adaptation).
file src/hal/input/touch_contact.h
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/hal/input/touch_input.h
Abstract touch-input contract (tap and point detection).
file src/hal/input/touch_panel_sample.h
The one sample of a touch panel its readers share, and when the panel is read for it.
file src/hal/input/touch_read_backlog.h
The reads of a touch panel taken while the loop task paints, kept for the next poll.
file src/hal/input/touch_zone_buttons.h
Touch-zone-backed ButtonInput for FT6x36 M5 Core devices.
file src/hal/input/trackball_input.h
Abstract trackball input contract (directional navigation + click).
file src/hal/input/trackball_wake_gate.h
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/hal/input/virtual_button_input.h
Programmatically driven ButtonInput for native host tests.
file src/hal/input/wake_press.h
An input that meets a dark panel only wakes it (host-tested rule).
file src/hal/input/wake_press_gate.h
The live side of the wake-press rule: the panel state every input source reads, and the one wake per pump.

Namespaces

namespace kleidos::hal::key_code
Key codes shared across keyboard implementations.
namespace kleidos::hal::kb_backlight
The keyboard backlight's level vocabulary, shared by its one setting and the drivers that drive it.
namespace kleidos::hal::kb_backlight::sweep
The unattended brightness sweep's schedule, as pure arithmetic.
namespace kleidos::hal::TDeckKey
Key codes returned by the T-Deck keyboard controller.

Classes

class kleidos::ButtonInput
Abstract polled button source (one logical button). More about kleidos::ButtonInput
struct kleidos::hal::cardputer::KeyValue
One keycap: what it types alone and what it types with Shift. More about kleidos::hal::cardputer::KeyValue
struct kleidos::hal::cardputer::FnKey
One keycap of the Fn layer and the navigation key Fn turns it into. More about kleidos::hal::cardputer::FnKey
struct kleidos::hal::cardputer::Modifiers
The modifiers held while a key was pressed. More about kleidos::hal::cardputer::Modifiers
struct kleidos::hal::cardputer::Cell
A cell of the keycap matrix; invalid when it names no cell. More about kleidos::hal::cardputer::Cell
struct kleidos::hal::cardputer::Keystroke
The cell and modifiers that type one character. More about kleidos::hal::cardputer::Keystroke
struct kleidos::hal::cardputer::KeyDecode
What one raw event byte did. More about kleidos::hal::cardputer::KeyDecode
class kleidos::hal::cardputer::KeyDecoder
Latched keycap matrix that resolves one TCA8418 event at a time. More about kleidos::hal::cardputer::KeyDecoder
class kleidos::CardputerKeyboard
KeyboardInput backed by the Cardputer ADV TCA8418 controller. More about kleidos::CardputerKeyboard
class kleidos::Ft6x36TouchInput
FT6x36 capacitive-touch policy layer over the panel's shared sample. More about kleidos::Ft6x36TouchInput
class kleidos::hal::GenericKeyboardButtonInput
Adapter that fires wasPressed() whenever the bound KeyboardInput emits the configured trigger character. Press/release model is edge-only — the keyboard driver doesn't expose a "still held" flag, so isPressed() returns true for a short synthetic window after the edge. More about kleidos::hal::GenericKeyboardButtonInput
class kleidos::GpioButtonInput
Debounced ButtonInput backed by a raw GPIO pin. More about kleidos::GpioButtonInput
class kleidos::hal::KeyDeliveryQueue< Capacity >
FIFO of pending key edges, delivered one per poll. More about kleidos::hal::KeyDeliveryQueue< Capacity >
struct kleidos::hal::kb_backlight::State
What a keyboard's light is doing, for diagnostics. More about kleidos::hal::kb_backlight::State
struct kleidos::hal::kb_backlight::sweep::Plan
One scripted sweep. More about kleidos::hal::kb_backlight::sweep::Plan
struct kleidos::hal::kb_backlight::sweep::Slot
Where the schedule is at one instant. More about kleidos::hal::kb_backlight::sweep::Slot
class kleidos::KeyboardInput
Abstract keyboard input — character-level access. More about kleidos::KeyboardInput
class kleidos::hal::power_key::ClickDetector
Debounced click detection for a power key read as a GPIO level. More about kleidos::hal::power_key::ClickDetector
struct kleidos::hal::tdeck::PolledKey
What one poll of the keyboard delivers. More about kleidos::hal::tdeck::PolledKey
class kleidos::TDeckKeyboard
T-Deck keyboard driver — I2C communication with ESP32-C3 slave. More about kleidos::TDeckKeyboard
class kleidos::KeyboardButtonInput
ButtonInput adapter that maps a specific keyboard key to a ButtonInput. More about kleidos::KeyboardButtonInput
class kleidos::TDeckTouch
T-Deck capacitive touch policy layer over the GT911 raw driver. More about kleidos::TDeckTouch
struct kleidos::hal::tdeck::PanelPoint
Where a touch lands on the panel, always inside it. More about kleidos::hal::tdeck::PanelPoint
class kleidos::TDeckTrackball
T-Deck trackball HAL wrapper. More about kleidos::TDeckTrackball
struct kleidos::TouchPoint
Single touch point with screen coordinates. More about kleidos::TouchPoint
class kleidos::TouchInput
Abstract touch input — tap and point detection. More about kleidos::TouchInput
struct kleidos::hal::touch_panel::Sample
One read of the panel, in the controller's own coordinates. More about kleidos::hal::touch_panel::Sample
class kleidos::hal::touch_panel::SampleKeeper
Keeps the panel's last sample and says when the panel is read again. More about kleidos::hal::touch_panel::SampleKeeper
struct kleidos::hal::touch_panel::ExactRuns< Read >
What makes reads one run, and which runs may be joined: the default, exact reads and no joining. More about kleidos::hal::touch_panel::ExactRuns< Read >
struct kleidos::hal::touch_panel::ReadRun< Read >
Reads of one contact, kept as the first and the last. More about kleidos::hal::touch_panel::ReadRun< Read >
class kleidos::hal::touch_panel::ReadBacklog< Read, Capacity, Policy >
The reads taken since the last poll, oldest first. More about kleidos::hal::touch_panel::ReadBacklog< Read, Capacity, Policy >
class kleidos::TouchZoneButtonInput
ButtonInput implementation driven by a FT6x36 bottom-screen touch zone. More about kleidos::TouchZoneButtonInput
struct kleidos::TrackballEvent
Trackball navigation event — returned by poll(). More about kleidos::TrackballEvent
struct kleidos::TrackballLevel
One reading of the ball as the wake gate judged it — returned by TrackballInput::serviceWakeGate. More about kleidos::TrackballLevel
class kleidos::TrackballInput
Abstract trackball input — directional navigation + click. More about kleidos::TrackballInput
struct kleidos::hal::trackball::Judgment
What one reading of the ball came to. More about kleidos::hal::trackball::Judgment
class kleidos::hal::trackball::WakeGate
Judges each reading of a trackball and keeps what passes for the next take. More about kleidos::hal::trackball::WakeGate
class kleidos::VirtualButtonInput
ButtonInput whose state is driven by setState() instead of hardware. More about kleidos::VirtualButtonInput
class kleidos::hal::wake_press::Gesture
Follows one input source's gestures and swallows the ones that begin dark. More about kleidos::hal::wake_press::Gesture
struct kleidos::hal::wake_press::Stats
What the gate has done since boot (the debug console reports it). More about kleidos::hal::wake_press::Stats

Typedefs

usingkleidos::hal::wake_press::WakeHook
What runs when an input met the dark panel: wake it and stamp the activity.

Enumerations

enum class kleidos::hal::kb_backlight::Action : uint8_t { kleidos::hal::kb_backlight::Action::None , kleidos::hal::kb_backlight::Action::LightAt , kleidos::hal::kb_backlight::Action::TurnOff }
What an idle tick has to do to the backlight controller. More about kleidos::hal::kb_backlight::Action
enum class kleidos::hal::kb_backlight::sweep::Phase : uint8_t { kleidos::hal::kb_backlight::sweep::Phase::Ready, kleidos::hal::kb_backlight::sweep::Phase::Bracket, kleidos::hal::kb_backlight::sweep::Phase::Marker, kleidos::hal::kb_backlight::sweep::Phase::Point, kleidos::hal::kb_backlight::sweep::Phase::Reference, kleidos::hal::kb_backlight::sweep::Phase::Tail, kleidos::hal::kb_backlight::sweep::Phase::Done }
What a slot of the schedule is. More about kleidos::hal::kb_backlight::sweep::Phase
enum class kleidos::TouchSleepResult : uint8_t { kleidos::TouchSleepResult::Unsupported , kleidos::TouchSleepResult::Asleep , kleidos::TouchSleepResult::NoAnswer }
What a touch controller's own Sleep command did. More about kleidos::TouchSleepResult
enum class kleidos::hal::wake_press::Verdict : uint8_t { kleidos::hal::wake_press::Verdict::Pass , kleidos::hal::wake_press::Verdict::Wake , kleidos::hal::wake_press::Verdict::Swallow }
What one sample of an input source does. More about kleidos::hal::wake_press::Verdict
enum class kleidos::hal::wake_press::Source : uint8_t { kleidos::hal::wake_press::Source::Button, kleidos::hal::wake_press::Source::Key, kleidos::hal::wake_press::Source::Touch, kleidos::hal::wake_press::Source::Ball, kleidos::hal::wake_press::Source::Console, kleidos::hal::wake_press::Source::Shake }
The kind of input that asked for a wake (diagnostics only). More about kleidos::hal::wake_press::Source

Functions

voidkleidos::hal::input::sampleLevels (std::span< ButtonInput *const > inputs)
Run each button's debounce and edge detection without consuming an edge.
constexpr boolkleidos::hal::cardputer::isModifier (uint8_t cap)
Whether a raw keycap code is a modifier (Fn / Option / Ctrl / Shift / Alt).
constexpr boolkleidos::hal::cardputer::isRawCodeCap (uint8_t cap)
Whether a keycap's code is a raw usage rather than what it types.
constexpr Cellkleidos::hal::cardputer::cellOf (uint8_t cap)
Find the cell whose unshifted keycap code is cap.
constexpr Cellkleidos::hal::cardputer::cellOfCharacter (uint8_t code)
Find the keycap that types the character code unshifted.
constexpr charkleidos::hal::cardputer::resolveCell (uint8_t row, uint8_t col, Modifiers mods)
The character the cell at (row, col) types with mods held.
constexpr Keystrokekleidos::hal::cardputer::keystrokeFor (char c)
The keycap and modifiers that type c.
constexpr charkleidos::hal::cardputer::resolveInjected (char c)
Type c the way a press event would, through the board's keymap.
constexpr boolkleidos::hal::key_code::isBack (char c)
Whether c backs out of a screen on a keyboard board.
constexpr boolkleidos::hal::kb_backlight::windowHeld (uint32_t timeoutMs)
Whether timeoutMs is a held window (kHoldTimeoutMs).
constexpr uint32_tkleidos::hal::kb_backlight::clampTimeoutMs (uint32_t ms)
The window a driver runs for ms.
constexpr uint8_tkleidos::hal::kb_backlight::dutyForPercent (uint8_t percent)
The controller duty percent asks for.
constexpr uint8_tkleidos::hal::kb_backlight::effectivePercent (bool on, uint8_t level)
The level the keyboard is driven at for an on/off switch and a level.
constexpr boolkleidos::hal::kb_backlight::keyIsRecent (bool keySeen, uint32_t nowMs, uint32_t lastKeyMs, uint32_t timeoutMs)
Whether a keypress is recent enough to keep the keyboard lit.
constexpr boolkleidos::hal::kb_backlight::windowOpen (bool keySeen, uint32_t nowMs, uint32_t lastKeyMs, uint32_t timeoutMs)
Whether the keyboard's light should be on this tick.
constexpr Actionkleidos::hal::kb_backlight::decide (uint8_t levelPct, bool lit, bool recentKey)
Decide what one idle tick does to the backlight.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::percentForPoint (const Plan &plan, uint8_t index)
The level point index measures.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::blockCount (const Plan &plan)
Blocks the plan's points fall into.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::maxPercentPoint (const Plan &plan)
The point index that measures full scale.
constexpr uint16_tkleidos::hal::kb_backlight::sweep::pulseCount (const Plan &plan)
Lit pulses the schedule holds, the ready lamp excluded.
constexpr uint32_tkleidos::hal::kb_backlight::sweep::totalMs (const Plan &plan)
Length of the whole schedule, from the arm to Phase::Done.
constexpr uint32_tkleidos::hal::kb_backlight::sweep::t0Ms (const Plan &plan)
Elapsed time the measured schedule starts at: the ready lamp's fall.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::gcdOf (uint8_t a, uint8_t b)
Greatest common divisor, for the stride's coprimality test.
constexpr boolkleidos::hal::kb_backlight::sweep::planValid (const Plan &plan)
Whether a plan can run.
constexpr Slotkleidos::hal::kb_backlight::sweep::levelAt (const Plan &plan, uint32_t elapsedMs)
Where the schedule is elapsedMs after it was armed.
constexpr uint32_tkleidos::hal::kb_backlight::sweep::levelFnv1a (const Plan &plan)
FNV-1a over the schedule's lit-pulse levels, in run order.
template<std::size_t Capacity>
PolledKeykleidos::hal::tdeck::pollKey (KeyDeliveryQueue< Capacity > &keys, char read, bool dark=false)
Take this poll's key: whatever the controller's read handed over, queued behind the keys still waiting.
constexpr int32_tkleidos::hal::tdeck::scaleToPanel (int16_t raw, uint16_t rawSpan, int16_t panelSpan)
Scale one controller coordinate to a panel axis.
constexpr PanelPointkleidos::hal::tdeck::panelPointFromTouch (int16_t rawX, int16_t rawY, uint16_t xSpan, uint16_t ySpan, int16_t width, int16_t height)
Map a GT911 coordinate onto the landscape panel.
boolkleidos::hal::touch_contact::controllerReady (uint32_t nowMs)
Whether the panel's controller answers, probing it when it does not.
const char *kleidos::hal::touch_contact::controllerName ()
The name of the controller found.
const hal::touch_panel::Sample &kleidos::hal::touch_contact::pumpSample (uint32_t nowMs)
The panel's sample for this input pump, read when the pump's read is due.
const hal::touch_panel::Sample &kleidos::hal::touch_contact::frameSample (uint32_t nowMs)
The panel's sample for a read from inside a frame the loop paints.
const hal::touch_panel::Sample &kleidos::hal::touch_contact::currentSample (uint32_t nowMs)
The panel's kept sample, for a reader outside the pump.
uint32_tkleidos::hal::touch_contact::panelReads ()
How many times the panel has been read since boot.
voidkleidos::hal::touch_contact::setPointerSwallowing (bool swallowing)
Record whether the pointer is swallowing the contact in progress.
boolkleidos::hal::touch_contact::pointerSwallowing ()
Whether the pointer is swallowing the contact in progress.
voidkleidos::hal::touch_contact::setZonesSwallowing (bool swallowing)
Record whether a zone is swallowing a press.
boolkleidos::hal::touch_contact::zonesSwallowing ()
Whether a zone is swallowing a press.
constexpr boolkleidos::hal::wake_press::panelDark (bool asleep, bool parked, bool retainsImage)
Whether an input arriving now meets a dark panel.
const char *kleidos::hal::wake_press::sourceName (Source source)
Short lower-case name of a source, as the console prints it.
voidkleidos::hal::wake_press::setWakeHook (WakeHook hook)
Register what wakes the panel for a swallowed gesture.
boolkleidos::hal::wake_press::arrivesDark ()
Whether an input arriving now meets a dark panel.
boolkleidos::hal::wake_press::panelIsDark ()
Whether the panel itself is dark now, the wake a pump ran aside.
voidkleidos::hal::wake_press::requestWake (Source source)
Ask for the panel's wake: a gesture began on a dark panel.
voidkleidos::hal::wake_press::beginPump ()
Start a pump of the inputs: forget the wake the previous pump ran.
voidkleidos::hal::wake_press::endPump ()
End a pump of the inputs: run the wake asked for, once.
Statskleidos::hal::wake_press::stats ()
What the gate has done since boot.

Variables

constexpr uint8_tkleidos::hal::cardputer::kRows
Rows of the Cardputer keycap matrix.
constexpr uint8_tkleidos::hal::cardputer::kColumns
Columns of the Cardputer keycap matrix.
constexpr uint8_tkleidos::hal::cardputer::kKeyFn
Raw code of the Fn modifier keycap.
constexpr uint8_tkleidos::hal::cardputer::kKeyOption
Raw code of the Option modifier keycap.
constexpr uint8_tkleidos::hal::cardputer::kKeyLeftCtrl
Raw code of the left Ctrl modifier keycap.
constexpr uint8_tkleidos::hal::cardputer::kKeyLeftShift
Raw code of the left Shift modifier keycap.
constexpr uint8_tkleidos::hal::cardputer::kKeyLeftAlt
Raw code of the left Alt modifier keycap.
constexpr uint8_tkleidos::hal::cardputer::kKeyBackspace
Raw code of the Backspace keycap (its HID usage).
constexpr uint8_tkleidos::hal::cardputer::kKeyTab
Raw code of the Tab keycap (its HID usage).
constexpr uint8_tkleidos::hal::cardputer::kKeyEnter
Raw code of the Enter keycap (its HID usage).
constexpr KeyValuekleidos::hal::cardputer::kKeyMap [kRows][kColumns]
The Cardputer ADV keycap matrix, row 0 = the number row.
constexpr FnKeykleidos::hal::cardputer::kFnLayer []
The Fn layer, as the Cardputer hardware legends it.
constexpr uint32_tkleidos::hal::gpio_button_input_detail::kDebounceMs
Debounce period in milliseconds.
constexpr charkleidos::hal::key_code::kNone
No key (sentinel / "no event").
constexpr charkleidos::hal::key_code::kEnter
Newline / Enter.
constexpr charkleidos::hal::key_code::kBackspace
Backspace.
constexpr charkleidos::hal::key_code::kDelete
Forward-delete (Cardputer Fn+Backspace).
constexpr charkleidos::hal::key_code::kTab
Horizontal tab.
constexpr charkleidos::hal::key_code::kEscape
Escape.
constexpr charkleidos::hal::key_code::kUp
Up arrow.
constexpr charkleidos::hal::key_code::kDown
Down arrow.
constexpr charkleidos::hal::key_code::kLeft
Left arrow.
constexpr charkleidos::hal::key_code::kRight
Right arrow.
constexpr charkleidos::hal::key_code::kSpace
Space.
constexpr uint8_tkleidos::hal::kb_backlight::kMinPercent
Darkest level: the backlight stays off, a keypress included.
constexpr boolkleidos::hal::kb_backlight::kDefaultOn
constexpr uint8_tkleidos::hal::kb_backlight::kMaxPercent
Brightest level the controller can drive.
constexpr uint8_tkleidos::hal::kb_backlight::kStepPercent
Increment of the keyboard-light editor between kMinPercent and kMaxPercent.
constexpr uint8_tkleidos::hal::kb_backlight::kDefaultPercent
constexpr uint8_tkleidos::hal::kb_backlight::kMaxDuty
Top of the controllers' own duty scale (0 = off).
constexpr uint32_tkleidos::hal::kb_backlight::kDefaultTimeoutMs
constexpr uint32_tkleidos::hal::kb_backlight::kMinTimeoutMs
constexpr uint32_tkleidos::hal::kb_backlight::kMaxTimeoutMs
Longest ordinary window. Past this, ask for a hold and mean it.
constexpr uint32_tkleidos::hal::kb_backlight::kHoldTimeoutMs
The window that never closes: the stored level is lit and held until the window is handed back.
constexpr uint8_tkleidos::hal::kb_backlight::kMinLevelPercent
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kMaxPoints
Most points a plan may measure.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kDefaultPoints
Points the default curve measures: 50 levels, floor to full scale.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kDefaultStepPct
Grid the levels sit on, in percent: 2 % gives 2..100 in 50 steps.
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kDefaultStride
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kDefaultMarkEvery
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kDefaultBracket
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultPointMs
One measured point, ms.
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultRefMs
The dark reference between two pulses, ms: half a point.
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultMarkerMs
A marker or a bracket pulse, ms: twice a point.
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultReadyMs
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultTailMs
Dark tail after the last pulse, ms.
constexpr uint16_tkleidos::hal::kb_backlight::sweep::kDefaultSettleMs
constexpr uint8_tkleidos::hal::kb_backlight::sweep::kNoPoint
What Slot::point carries while a slot measures no point.
constexpr uint32_tkleidos::hal::kb_backlight::sweep::kFnvOffsetBasis
FNV-1a offset basis (RFC-less but universally stated as such).
constexpr uint32_tkleidos::hal::kb_backlight::sweep::kFnvPrime
FNV-1a 32-bit prime.
constexpr Plankleidos::hal::kb_backlight::sweep::kDefaultPlan
The plan a keyboard sweep runs when it is given no arguments.
constexpr uint32_tkleidos::hal::power_key::kDebounceMs
constexpr charkleidos::hal::tdeck::kCarriageReturn
constexpr charkleidos::hal::TDeckKey::NONE
No key / sentinel value.
constexpr charkleidos::hal::TDeckKey::ENTER
Enter key.
constexpr charkleidos::hal::TDeckKey::BACKSPACE
Backspace key.
constexpr charkleidos::hal::TDeckKey::TAB
Tab key (currently unused).
constexpr charkleidos::hal::TDeckKey::ESCAPE
Escape (if available on this layout).
constexpr charkleidos::hal::TDeckKey::SPACE
Space bar.
constexpr uint32_tkleidos::hal::touch_panel::kContactTailMs
constexpr uint32_tkleidos::hal::touch_panel::kStaleMs
constexpr uint32_tkleidos::hal::touch_panel::kBacklogMaxAgeMs
constexpr uint32_tkleidos::hal::trackball::kRollQuietMs

Back to the top

Enumeration Type Documentation

Action #

enum class kleidos::hal::kb_backlight::Action : uint8_t

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 #

enum class kleidos::hal::kb_backlight::sweep::Phase : uint8_t

What a slot of the schedule is.

Enumerator
Ready 

The ready lamp: full scale, and its fall is t0.

Bracket 

A full-scale pulse at one end, for the axis rate.

Marker 

A full-scale pulse opening a block.

Point 

A measured level.

Reference 

The dark level between two pulses.

Tail 

The dark tail.

Done 

The schedule is over.

Source #

enum class kleidos::hal::wake_press::Source : uint8_t

The kind of input that asked for a wake (diagnostics only).

Enumerator
Button 

A GPIO button, a touch zone used as a button, a key adapter.

Key 

A keyboard key.

Touch 

A touch-panel contact.

Ball 

A trackball roll or click.

Console 

A console injection with no input source below it.

Shake 

A shake of the board on the unlock screen (the IMU).

TouchSleepResult #

enum class kleidos::TouchSleepResult : uint8_t

What a touch controller's own Sleep command did.

Enumerator
Unsupported 

This controller takes no Sleep command this layer can send.

Asleep 

The controller accepted the command.

NoAnswer 

No address answered; the line is released, not left driven.

Verdict #

enum class kleidos::hal::wake_press::Verdict : uint8_t

What one sample of an input source does.

Enumerator
Pass 

The sample reaches the screens as it is.

Wake 

A gesture began on a dark panel: wake the panel, act on nothing.

Swallow 

Part of a gesture that woke the panel: act on nothing.

Back to the top

Function Documentation

arrivesDark() #

bool kleidos::hal::wake_press::arrivesDark()
nodiscard

Whether an input arriving now meets a dark panel.

Return values
ValueMeaning
trueThe panel is dark, or a wake ran since this pump began.
falseThe panel is lit, dimmed, parked or e-paper: the input acts.

blockCount() #

uint8_t kleidos::hal::kb_backlight::sweep::blockCount(const Plan & plan)
constexpr

Blocks the plan's points fall into.

Parameters
NameDirectionMeaning
planinThe sweep.
Returns
points / markEvery, or 0 when the plan marks nothing.

cellOf() #

Cell kleidos::hal::cardputer::cellOf(uint8_t cap)
constexpr

Find the cell whose unshifted keycap code is cap.

Parameters
NameDirectionMeaning
capinRaw keycap code to look for.
Returns
Its cell, or an invalid cell when no keycap carries cap.

cellOfCharacter() #

Cell kleidos::hal::cardputer::cellOfCharacter(uint8_t code)
constexpr

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
NameDirectionMeaning
codeinASCII code of the character to look for.
Returns
Its cell, or an invalid cell when no keycap types code unshifted.

clampTimeoutMs() #

uint32_t kleidos::hal::kb_backlight::clampTimeoutMs(uint32_t ms)
constexpr

The window a driver runs for ms.

Parameters
NameDirectionMeaning
msinWindow asked for, in ms.
Returns
kHoldTimeoutMs unchanged, or ms inside 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() #

const char * kleidos::hal::touch_contact::controllerName()
nodiscard

The name of the controller found.

Returns
Its chip name, or an empty string before one answers.

controllerReady() #

bool kleidos::hal::touch_contact::controllerReady(uint32_t nowMs)
nodiscard

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
NameDirectionMeaning
nowMsinCurrent millis32() reading.
Return values
ValueMeaning
trueThe controller has been found and is ready.
falseNo controller yet.

currentSample() #

const hal::touch_panel::Sample & kleidos::hal::touch_contact::currentSample(uint32_t nowMs)

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::touch_panel::kStaleMs).

Parameters
NameDirectionMeaning
nowMsinCurrent millis32() reading.
Returns
The kept sample.

decide() #

Action kleidos::hal::kb_backlight::decide(uint8_t levelPct, bool lit, bool recentKey)
constexpr

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
NameDirectionMeaning
levelPctinThe stored level, 0..100 (kMinPercent = never lit).
litinWhether the controller is driving the backlight now.
recentKeyinWhether a key was pressed within the idle window.
Returns
The one controller write this tick owes, or Action::None.

dutyForPercent() #

uint8_t kleidos::hal::kb_backlight::dutyForPercent(uint8_t percent)
constexpr

The controller duty percent asks for.

Parameters
NameDirectionMeaning
percentinLevel in 0..100; anything above kMaxPercent clamps to it.
Returns
Duty on the controller's 0..kMaxDuty scale.

effectivePercent() #

uint8_t kleidos::hal::kb_backlight::effectivePercent(bool on, uint8_t level)
constexpr

The level the keyboard is driven at for an on/off switch and a level.

Parameters
NameDirectionMeaning
oninWhether the user turned the keyboard light on.
levelinThe stored level, 0-100 %.
Returns
level while the light is on, kMinPercent (dark) while it is off.

frameSample() #

const hal::touch_panel::Sample & kleidos::hal::touch_contact::frameSample(uint32_t nowMs)

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::touch_panel::SampleKeeper::frameDue): a hung controller's timeout is paid once per tick, by the pump, not at every read of a frame.

Parameters
NameDirectionMeaning
nowMsinCurrent millis32() reading.
Returns
The kept sample: this read, or the last one when none is made.

gcdOf() #

uint8_t kleidos::hal::kb_backlight::sweep::gcdOf(uint8_t a, uint8_t b)
constexpr

Greatest common divisor, for the stride's coprimality test.

Parameters
NameDirectionMeaning
ainFirst value.
binSecond value.
Returns
The GCD; 0 only when both are 0.

isBack() #

bool kleidos::hal::key_code::isBack(char c)
constexpr

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
NameDirectionMeaning
cinA key code from KeyboardInput::getChar().
Returns
true for Esc, Backspace or Left.

isModifier() #

bool kleidos::hal::cardputer::isModifier(uint8_t cap)
constexpr

Whether a raw keycap code is a modifier (Fn / Option / Ctrl / Shift / Alt).

Parameters
NameDirectionMeaning
capinRaw keycap code from kKeyMap.
Returns
true for a modifier keycap.

isRawCodeCap() #

bool kleidos::hal::cardputer::isRawCodeCap(uint8_t cap)
constexpr

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
NameDirectionMeaning
capinRaw keycap code from kKeyMap.
Returns
true for a keycap that carries a raw code.

keyIsRecent() #

bool kleidos::hal::kb_backlight::keyIsRecent(bool keySeen, uint32_t nowMs, uint32_t lastKeyMs, uint32_t timeoutMs)
constexpr

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
NameDirectionMeaning
keySeeninWhether a key has been pressed since the last reset.
nowMsinmillis32() now.
lastKeyMsinmillis32() when the last key was pressed.
timeoutMsinHow long a press keeps the keyboard lit.
Returns
Whether the keyboard should be lit on this tick.

keystrokeFor() #

Keystroke kleidos::hal::cardputer::keystrokeFor(char c)
constexpr

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
NameDirectionMeaning
cinThe character to type.
Returns
The keystroke; its cell is invalid when no keycap types c.

levelAt() #

Slot kleidos::hal::kb_backlight::sweep::levelAt(const Plan & plan, uint32_t elapsedMs)
constexpr

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
NameDirectionMeaning
planinThe sweep (planValid).
elapsedMsinMilliseconds since the plan was armed.
Returns
The slot in force, or one with Phase::Done past the end.

levelFnv1a() #

uint32_t kleidos::hal::kb_backlight::sweep::levelFnv1a(const Plan & plan)
constexpr

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
NameDirectionMeaning
planinThe sweep.
Returns
The hash over pulseCount levels (the ready lamp excluded, since it is always full scale and carries no information).

maxPercentPoint() #

uint8_t kleidos::hal::kb_backlight::sweep::maxPercentPoint(const Plan & plan)
constexpr

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
NameDirectionMeaning
planinThe sweep.
Returns
The index whose level is kMaxPercent, or kNoPoint when the grid does not reach it.

panelDark() #

bool kleidos::hal::wake_press::panelDark(bool asleep, bool parked, bool retainsImage)
nodiscardconstexpr

Whether an input arriving now meets a dark panel.

Parameters
NameDirectionMeaning
asleepinThe panel sleeps (display::isAsleep).
parkedinA measurement holds it asleep (display::panelParked).
retainsImageinIts glass keeps the image (device::kDisplayIsEpaper).
Return values
ValueMeaning
trueAsleep, and nothing on the glass to see: the input only wakes.
falseLit, dimmed, parked or e-paper: the input acts.

panelIsDark() #

bool kleidos::hal::wake_press::panelIsDark()
nodiscard

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
ValueMeaning
trueAsleep, not parked, not e-paper.
falseLit, dimmed, parked or e-paper.

panelPointFromTouch() #

PanelPoint kleidos::hal::tdeck::panelPointFromTouch(int16_t rawX, int16_t rawY, uint16_t xSpan, uint16_t ySpan, int16_t width, int16_t height)
nodiscardconstexpr

Map a GT911 coordinate onto the landscape panel.

Parameters
NameMeaning
rawXController X, along the panel's short side.
rawYController Y, along the panel's long side.
xSpanController resolution on X.
ySpanController resolution on Y.
widthPanel width in landscape.
heightPanel height in landscape.
Returns
The point on the panel.

panelReads() #

uint32_t kleidos::hal::touch_contact::panelReads()
nodiscard

How many times the panel has been read since boot.

Returns
The count of controller reads.

percentForPoint() #

uint8_t kleidos::hal::kb_backlight::sweep::percentForPoint(const Plan & plan, uint8_t index)
constexpr

The level point index measures.

Parameters
NameDirectionMeaning
planinThe sweep.
indexinPoint index, 0..plan.points-1.
Returns
Level in percent, on the plan's grid, never kMinPercent.

planValid() #

bool kleidos::hal::kb_backlight::sweep::planValid(const Plan & plan)
constexpr

Whether a plan can run.

Parameters
NameDirectionMeaning
planinThe sweep.
Return values
ValueMeaning
trueEvery 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.
falseAnything 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() #

bool kleidos::hal::touch_contact::pointerSwallowing()
nodiscard

Whether the pointer is swallowing the contact in progress.

Return values
ValueMeaning
trueThe zones read released until it ends.
falseNo contact, or one that acts.

pollKey() #

template<std::size_t Capacity>
PolledKey kleidos::hal::tdeck::pollKey(KeyDeliveryQueue< Capacity > & keys, char read, bool dark = false)

Take this poll's key: whatever the controller's read handed over, queued behind the keys still waiting.

Parameters
NameDirectionMeaning
keysin, outThe keyboard's delivery queue (the console's injected keys wait in it too, in the order they came).
readinWhat this poll's read returned: key_code::kNone for no key, a failed read, or a poll that read nothing.
darkinWhether a key arriving now meets a dark panel (hal::wake_press::arrivesDark).
Returns
This poll's key, Enter normalized, and press on 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 and woke is set.

pulseCount() #

uint16_t kleidos::hal::kb_backlight::sweep::pulseCount(const Plan & plan)
constexpr

Lit pulses the schedule holds, the ready lamp excluded.

Parameters
NameDirectionMeaning
planinThe sweep.
Returns
Brackets at both ends, one marker per block, and every point.

pumpSample() #

const hal::touch_panel::Sample & kleidos::hal::touch_contact::pumpSample(uint32_t nowMs)

The panel's sample for this input pump, read when the pump's read is due.

Parameters
NameDirectionMeaning
nowMsinCurrent millis32() reading.
Returns
The kept sample: this pump's read, or the last one when none is due or no controller answers.

requestWake() #

void kleidos::hal::wake_press::requestWake(Source source)

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
NameDirectionMeaning
sourceinThe kind of input that met the dark panel.

resolveCell() #

char kleidos::hal::cardputer::resolveCell(uint8_t row, uint8_t col, Modifiers mods)
constexpr

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_code::kNone — nothing in Kleidos consumes Tab, and surfacing it would make Tab navigate as if it were a arrow key.

Parameters
NameDirectionMeaning
rowinMatrix row.
colinMatrix column.
modsinModifiers held at the moment of the press.
Returns
The character typed, or key_code::kNone when the cell types nothing.

resolveInjected() #

char kleidos::hal::cardputer::resolveInjected(char c)
constexpr

Type c the way a press event would, through the board's keymap.

Parameters
NameDirectionMeaning
cinThe character the serial console asked for.
Returns
The character the matrix produces for it, or key_code::kNone when no keycap types c (or its keycap types nothing, as Tab does).

sampleLevels() #

void kleidos::hal::input::sampleLevels(std::span< ButtonInput *const > inputs)

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
NameDirectionMeaning
inputsin, outThe buttons to sample.

scaleToPanel() #

int32_t kleidos::hal::tdeck::scaleToPanel(int16_t raw, uint16_t rawSpan, int16_t panelSpan)
nodiscardconstexpr

Scale one controller coordinate to a panel axis.

Parameters
NameMeaning
rawController coordinate.
rawSpanController resolution on that axis, greater than 1.
panelSpanPanel size on the axis it lands on.
Returns
The panel coordinate, not yet clamped.

setPointerSwallowing() #

void kleidos::hal::touch_contact::setPointerSwallowing(bool swallowing)

Record whether the pointer is swallowing the contact in progress.

Parameters
NameDirectionMeaning
swallowinginThe pointer's gesture began on a dark panel and has not ended.

setWakeHook() #

void kleidos::hal::wake_press::setWakeHook(WakeHook hook)

Register what wakes the panel for a swallowed gesture.

Parameters
NameDirectionMeaning
hookinCalled once per pump that had a wake asked for; nullptr to wake the panel directly.

setZonesSwallowing() #

void kleidos::hal::touch_contact::setZonesSwallowing(bool swallowing)

Record whether a zone is swallowing a press.

Parameters
NameDirectionMeaning
swallowinginA zone's press began on a dark panel and has not ended.

sourceName() #

const char * kleidos::hal::wake_press::sourceName(Source source)

Short lower-case name of a source, as the console prints it.

Parameters
NameDirectionMeaning
sourceinThe source.
Returns
"button", "key", "touch", "ball", "console" or "shake".

stats() #

Stats kleidos::hal::wake_press::stats()
nodiscard

What the gate has done since boot.

Returns
The counters.

t0Ms() #

uint32_t kleidos::hal::kb_backlight::sweep::t0Ms(const Plan & plan)
constexpr

Elapsed time the measured schedule starts at: the ready lamp's fall.

Parameters
NameDirectionMeaning
planinThe sweep.
Returns
plan.readyMs — the instant the host anchors every boundary on.

totalMs() #

uint32_t kleidos::hal::kb_backlight::sweep::totalMs(const Plan & plan)
constexpr

Length of the whole schedule, from the arm to Phase::Done.

Parameters
NameDirectionMeaning
planinThe sweep.
Returns
Milliseconds, the ready lamp included.

windowHeld() #

bool kleidos::hal::kb_backlight::windowHeld(uint32_t timeoutMs)
constexpr

Whether timeoutMs is a held window (kHoldTimeoutMs).

Parameters
NameDirectionMeaning
timeoutMsinA window in ms.
Returns
Whether the window never closes.

windowOpen() #

bool kleidos::hal::kb_backlight::windowOpen(bool keySeen, uint32_t nowMs, uint32_t lastKeyMs, uint32_t timeoutMs)
constexpr

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
NameDirectionMeaning
keySeeninWhether a key has been pressed since the last reset.
nowMsinmillis32() now.
lastKeyMsinmillis32() when the last key was pressed.
timeoutMsinThe window, or kHoldTimeoutMs for a held one.
Returns
Whether the window is open on this tick.

zonesSwallowing() #

bool kleidos::hal::touch_contact::zonesSwallowing()
nodiscard

Whether a zone is swallowing a press.

Return values
ValueMeaning
trueA contact the pointer first sees now began dark too.
falseNo zone is swallowing a press.

Back to the top

Variable Documentation

kBacklogMaxAgeMs #

uint32_t kleidos::hal::touch_panel::kBacklogMaxAgeMs
inlineconstexpr

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 #

char kleidos::hal::tdeck::kCarriageReturn
inlineconstexpr

Enter as some controller firmware sends it, which the keyboard reports as key_code::kEnter.

kContactTailMs #

uint32_t kleidos::hal::touch_panel::kContactTailMs
inlineconstexpr

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 #

uint32_t kleidos::hal::power_key::kDebounceMs
inlineconstexpr

Time a key level change must follow the last accepted change before it counts, in ms.

kDefaultBracket #

uint8_t kleidos::hal::kb_backlight::sweep::kDefaultBracket
inlineconstexpr

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 #

uint8_t kleidos::hal::kb_backlight::sweep::kDefaultMarkEvery
inlineconstexpr

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 #

bool kleidos::hal::kb_backlight::kDefaultOn
constexpr

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 #

uint8_t kleidos::hal::kb_backlight::kDefaultPercent
constexpr

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 #

uint16_t kleidos::hal::kb_backlight::sweep::kDefaultReadyMs
inlineconstexpr

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 #

uint16_t kleidos::hal::kb_backlight::sweep::kDefaultSettleMs
inlineconstexpr

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 #

uint8_t kleidos::hal::kb_backlight::sweep::kDefaultStride
inlineconstexpr

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 #

uint32_t kleidos::hal::kb_backlight::kDefaultTimeoutMs
constexpr

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 #

FnKey kleidos::hal::cardputer::kFnLayer[]
inlineconstexpr

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 #

uint32_t kleidos::hal::kb_backlight::kHoldTimeoutMs
constexpr

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::kTimerNeverMs is UINT32_MAX for "this timer never fires" — and reserving 0 as "no deadline" is what the clock facade exists to prevent; hal sits below states so it declares its own constant with the same value rather than reaching up for that one. 0's plain reading, "a zero-length window", is the opposite of a hold, and this driver already showed the confusion: its header documented 0 as "always on" while its code made 0 mean "the auto-dim touches nothing", which on an untouched keyboard is always off. And with the sentinel out at the top, a small or zero timeout clamps up to kMinTimeoutMs, so the window can never be the knob that kills the light — the level (kMinPercent) stays the only one. One effect, one knob.

kMinLevelPercent #

uint8_t kleidos::hal::kb_backlight::kMinLevelPercent
constexpr

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 #

uint32_t kleidos::hal::kb_backlight::kMinTimeoutMs
constexpr

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 #

uint32_t kleidos::hal::trackball::kRollQuietMs
constexpr

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 #

uint32_t kleidos::hal::touch_panel::kStaleMs
inlineconstexpr

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.

Back to the top