Kleidos API Search

In development. It changes without notice.

Topic

Unlock Entry

How the owner enters the secret, by board: a dialed PIN, a touch keypad or a keyboard.

Each board has one of three entries, chosen when it is built, behind one interface (AuthEntryUI), so nothing else asks which one it is:

  • The dial (PinEntryUI), on the CoreInk and the Sticks. A PIN is entered with one key, in the style the owner chose in settings. The Timing Arc, which is the default, is one hold for each digit: an arc fills from 0 to 9, and letting go takes the digit. The two-step ring is two: the first picks a block of digits, the second one of the block, or back. A change of style is saved only after a practice on a code that is shown, never on the PIN.
  • The touch keypad (TouchAuthEntryUI), on the Core2 v1.3 and the CoreS3 SE. A PIN is typed, or a passphrase from the keypad's letters, and then confirmed.
  • The keyboard (PassphraseEntryUI), on the LILYGO T-Deck and the M5Cardputer ADV. A passphrase is typed, then Enter.

Here too are the lock screen, the countdown of a lockout and the screen of a factory reset. What was entered is wiped when it is checked, when it is cancelled and when the screen is left. Neither dial style hides the PIN from somebody who watches the screen.

See also
Security, Application States, The boards

Files

file src/ui/entry/auth_entry_ui.h
The interface every unlock entry implements: a dialed PIN, a touch keypad or a keyboard.
file src/ui/entry/lock_cause_notice.h
The two lines a PIN surface shows in place of a lockout countdown that does not run, wrapped whole into the room the surface has.
file src/ui/entry/lockout_countdown.h
What a PIN surface shows while the brute-force lockout holds, and when it repaints.
file src/ui/entry/minute_watch.h
When a face that shows hours and minutes reads the clock again.
file src/ui/entry/passphrase_entry_ui.h
Passphrase entry on a physical keyboard: the LILYGO T-Deck and the M5Cardputer ADV.
file src/ui/entry/pin_arc.h
Pure timing-arc math for the PIN-entry UI (no display coupling).
file src/ui/entry/pin_entry_renderer.h
Rendering collaborator for kleidos::PinEntryUI (the dialed PIN: the Timing Arc and the two-step ring).
file src/ui/entry/pin_entry_renderer_arc.cpp
The Sticks' timing arc: the dial frame, its partial and incremental repaints, and the verify and result dials (part of pin_entry_renderer.h).
file src/ui/entry/pin_entry_renderer_digits.cpp
The color three-button stepper: its digit, its key shelf, and the verify ring and result over the digit's band (part of pin_entry_renderer.h).
file src/ui/entry/pin_entry_renderer_epaper.cpp
The CoreInk's ink arc: its full frame, the per-tick dial repaint, and the verify and result dials (part of pin_entry_renderer.h).
file src/ui/entry/pin_entry_renderer_internal.h
What the sources of PinEntryRenderer share: the dial's geometry and inks, and the helpers more than one rendering draws with.
file src/ui/entry/pin_entry_renderer_lock_face.cpp
The lock face, the PIN entry's idle clock screen, and the one e-paper keeps through power-off (part of pin_entry_renderer.h).
file src/ui/entry/pin_entry_renderer_ring.cpp
The two-step ring on both arc boards: its frame, its dial repaint, the newly swept slice, and the rim at rest (part of pin_entry_renderer.h).
file src/ui/entry/pin_entry_ui.h
Entry of a dialed PIN, in the Timing Arc or the two-step ring.
file src/ui/entry/pin_practice.h
The practice code a dial-style change is proven on: drawing it, the mark under each of its digits, and the pass rule.
file src/ui/entry/pin_ring.h
Pure timing and state logic of the two-step ring PIN method.
file src/ui/entry/pin_ring_face.h
Draws the two-step ring: four sectors, their rim labels and the middle.
file src/ui/entry/touch_auth_entry_ui.h
Capacitive-touch unlock on one layered on-screen keyboard.
file src/ui/entry/unlock_feedback.h
file src/ui/entry/verdict_words.h
What the unlock's verdict line says, per purpose of the entry.
file src/ui/entry/wipe_screen.h
The two screens of the factory reset the tenth wrong secret starts: the 3-2-1 countdown and the result, laid out from the panel.

Classes

class kleidos::AuthEntryUI
Abstract base of the unlock entries: the dial, the touch keypad and the keyboard. More about kleidos::AuthEntryUI
struct kleidos::ui::lock_cause_notice::Part
One part of the notice, wrapped to the box width. More about kleidos::ui::lock_cause_notice::Part
struct kleidos::ui::lock_cause_notice::Notice
The notice set for one box. More about kleidos::ui::lock_cause_notice::Notice
struct kleidos::ui::lockout_countdown::LockStatus
One read of the lockout, as a surface's lockout callback reports it. More about kleidos::ui::lockout_countdown::LockStatus
class kleidos::ui::lockout_countdown::Countdown
The value a surface last painted, so it repaints only when it changes. More about kleidos::ui::lockout_countdown::Countdown
class kleidos::ui::minute_watch::MinuteWatch
Says when the face's next clock read is due. More about kleidos::ui::minute_watch::MinuteWatch
class kleidos::PassphraseEntryUI
Keyboard-driven passphrase entry UI; implements AuthEntryUI. More about kleidos::PassphraseEntryUI
struct kleidos::PinEntryRenderProps
Read-only snapshot of the FSM state a full-frame PIN render needs. More about kleidos::PinEntryRenderProps
struct kleidos::PracticeStrip
The practice code over the dial and the mark under each of its digits. More about kleidos::PracticeStrip
class kleidos::PinEntryRenderer
Renderer of the dialed PIN, arc and ring; owns all draw paths and the render cache. More about kleidos::PinEntryRenderer
class kleidos::PinEntryUI
Entry of a dialed PIN, in the Timing Arc or the two-step ring; implements AuthEntryUI. More about kleidos::PinEntryUI
struct kleidos::ui::pin_practice::Code
A code to dial: its digits, 0..9 each. More about kleidos::ui::pin_practice::Code
struct kleidos::ui::pin_ring::Item
One quadrant's meaning: its slot and, for a digit or a block, its value. More about kleidos::ui::pin_ring::Item
struct kleidos::ui::pin_ring::Steps
The two step lengths of one board (ms per quadrant). More about kleidos::ui::pin_ring::Steps
struct kleidos::ui::pin_ring::Release
One release, as the entry applies it. More about kleidos::ui::pin_ring::Release
class kleidos::ui::pin_ring::Dial
Where the two holds of one digit stand: the whole state of the ring between digits, which the entry keeps beside its digit buffer. More about kleidos::ui::pin_ring::Dial
struct kleidos::ui::pin_ring::View
Everything a ring frame shows, derived from the entry's state. More about kleidos::ui::pin_ring::View
struct kleidos::ui::pin_ring_face::Geometry
Where and how the ring is drawn. More about kleidos::ui::pin_ring_face::Geometry
class kleidos::TouchAuthEntryUI
Layered on-screen keyboard unlock UI; implements AuthEntryUI. More about kleidos::TouchAuthEntryUI
struct kleidos::ui::unlock_feedback::WaitCadence
How often a wait ring repaints: the frame interval of its fill and turn-in, and that of its orbit. More about kleidos::ui::unlock_feedback::WaitCadence
struct kleidos::ui::unlock_feedback::ArcSpan
The lit arc of the ring, clockwise from 12 o'clock. More about kleidos::ui::unlock_feedback::ArcSpan
struct kleidos::ui::unlock_feedback::ArcRange
One arc of the ring a frame repaints, clockwise from 12 o'clock. It never runs past 12 o'clock: 0 <= fromDeg < toDeg <= 360. More about kleidos::ui::unlock_feedback::ArcRange
struct kleidos::ui::unlock_feedback::DirtyArcs
What one frame of the wait repaints: the whole ring, or a few arcs of it. More about kleidos::ui::unlock_feedback::DirtyArcs
class kleidos::ui::unlock_feedback::WaitRingClock
The clock of one surface's wait ring, stepped by its pump. More about kleidos::ui::unlock_feedback::WaitRingClock
struct kleidos::ui::unlock_feedback::WaitRingGeo
Where and how large one surface draws its wait ring. More about kleidos::ui::unlock_feedback::WaitRingGeo
struct kleidos::ui::unlock_feedback::VerdictFrame
One frame of the verdict. More about kleidos::ui::unlock_feedback::VerdictFrame
class kleidos::ui::unlock_feedback::VerdictClock
The clock of one verdict, stepped by the main loop. More about kleidos::ui::unlock_feedback::VerdictClock
struct kleidos::ui::VerdictWords
The two lines a verdict can print. More about kleidos::ui::VerdictWords

Enumerations

enum class kleidos::AuthUIState : uint8_t { kleidos::AuthUIState::IDLE, kleidos::AuthUIState::SELECTING, kleidos::AuthUIState::ENTERING, kleidos::AuthUIState::DigitLocked, kleidos::AuthUIState::COMPLETE, kleidos::AuthUIState::ResultFlash, kleidos::AuthUIState::LockedOut }
High-level state shared by both PIN and passphrase entry modes. More about kleidos::AuthUIState
enum class kleidos::AuthEntryPurpose : uint8_t { kleidos::AuthEntryPurpose::Unlock, kleidos::AuthEntryPurpose::Current, kleidos::AuthEntryPurpose::Create, kleidos::AuthEntryPurpose::Repeat, kleidos::AuthEntryPurpose::BackupCreate, kleidos::AuthEntryPurpose::BackupRepeat, kleidos::AuthEntryPurpose::BackupOpen, kleidos::AuthEntryPurpose::Wipe }
What an entered secret is for, so the surface can say so. More about kleidos::AuthEntryPurpose
enum class kleidos::ui::lock_cause_notice::Rung : uint8_t { kleidos::ui::lock_cause_notice::Rung::Heading , kleidos::ui::lock_cause_notice::Rung::Body }
The rung of the ladder a notice starts from (layout). More about kleidos::ui::lock_cause_notice::Rung
enum class kleidos::ui::lockout_countdown::LockCause : uint8_t { kleidos::ui::lockout_countdown::LockCause::Counter , kleidos::ui::lockout_countdown::LockCause::DeviceKeyMissing }
Why a PIN surface is locked out, which decides what it shows. More about kleidos::ui::lockout_countdown::LockCause
enum class kleidos::LockFaceKind : uint8_t { kleidos::LockFaceKind::Clock , kleidos::LockFaceKind::Logo }
What the retained e-paper lock face shows while the board sleeps. More about kleidos::LockFaceKind
enum class kleidos::ui::pin_practice::Mark : uint8_t { kleidos::ui::pin_practice::Mark::None , kleidos::ui::pin_practice::Mark::Current , kleidos::ui::pin_practice::Mark::Done , kleidos::ui::pin_practice::Mark::Wrong }
The mark under one digit of the code. More about kleidos::ui::pin_practice::Mark
enum class kleidos::ui::pin_ring::Stage : uint8_t { kleidos::ui::pin_ring::Stage::Block , kleidos::ui::pin_ring::Stage::Digit }
Which of the two holds of a digit is next. More about kleidos::ui::pin_ring::Stage
enum class kleidos::ui::pin_ring::Slot : uint8_t { kleidos::ui::pin_ring::Slot::Block, kleidos::ui::pin_ring::Slot::Digit, kleidos::ui::pin_ring::Slot::Back, kleidos::ui::pin_ring::Slot::Erase, kleidos::ui::pin_ring::Slot::Nothing }
What one quadrant of a ring stands for. More about kleidos::ui::pin_ring::Slot
enum class kleidos::ui::pin_ring::Outcome : uint8_t { kleidos::ui::pin_ring::Outcome::Nothing, kleidos::ui::pin_ring::Outcome::BlockOpen, kleidos::ui::pin_ring::Outcome::Stored, kleidos::ui::pin_ring::Outcome::Back, kleidos::ui::pin_ring::Outcome::Erased }
What a release did. More about kleidos::ui::pin_ring::Outcome
enum class kleidos::ui::pin_ring::Center : uint8_t { kleidos::ui::pin_ring::Center::Empty, kleidos::ui::pin_ring::Center::Block, kleidos::ui::pin_ring::Center::Digit, kleidos::ui::pin_ring::Center::Back, kleidos::ui::pin_ring::Center::Erase, kleidos::ui::pin_ring::Center::None }
What the middle of the ring shows. More about kleidos::ui::pin_ring::Center

Functions

constexpr uint8_tkleidos::passphraseMinFor (AuthEntryPurpose purpose)
The shortest passphrase an entry for purpose accepts.
Noticekleidos::ui::lock_cause_notice::layout (Canvas &canvas, const char *title, const char *detail, int16_t width, int16_t maxH, int16_t gap, Rung firstRung=Rung::Heading)
Set title over detail in a box width wide and maxH tall.
voidkleidos::ui::lock_cause_notice::draw (Canvas &canvas, const Notice &notice, const Rect &box, uint16_t titleColor, uint16_t detailColor)
Draw notice centered in box.
constexpr uint32_tkleidos::ui::lockout_countdown::stepSecFor (bool epaper)
The step a panel counts the lockout down in.
constexpr uint32_tkleidos::ui::lockout_countdown::shownSeconds (uint32_t remainingSec, uint32_t stepSec)
The seconds a surface prints for remainingSec.
constexpr LockStatuskleidos::ui::lockout_countdown::statusOf (uint32_t remainingSec, bool deviceKeyMissing)
What a lockout read means: how long it holds, and whether a missing device key is the cause.
constexpr boolkleidos::ui::lockout_countdown::namesCause (const LockStatus &status)
Whether a surface names the cause of status instead of counting it down.
constexpr uint32_tkleidos::ui::lockout_countdown::shownValue (const LockStatus &status, uint32_t stepSec)
The value a surface prints for status, and its repaint latch records.
constexpr uint32_tkleidos::ui::minute_watch::nextReadInMs (bool trusted, uint8_t seconds)
How long after a reading the clock is read again.
constexpr uint32_tkleidos::ui::pin_arc::clampSweepMs (uint32_t sweepMs)
Clamp a candidate sweep duration to the viable [min, max] window.
constexpr uint8_tkleidos::ui::pin_arc::progressPercent (uint32_t elapsedMs, uint32_t sweepMs)
Arc fill percentage (0..100) for a hold elapsed time, given a sweep.
constexpr uint8_tkleidos::ui::pin_arc::progressPercent (uint32_t elapsedMs)
Arc fill percentage (0..100) for a hold elapsed time (default sweep).
constexpr uint8_tkleidos::ui::pin_arc::dialedDigit (uint32_t elapsedMs, uint32_t sweepMs)
Dialed digit (0..9) for a hold elapsed time, given a sweep.
constexpr uint8_tkleidos::ui::pin_arc::dialedDigit (uint32_t elapsedMs)
Dialed digit (0..9) for a hold elapsed time (default sweep).
constexpr uint8_tkleidos::ui::pin_arc::digitForPercent (uint8_t percent)
Dialed digit (0..9) for a debug-forced fill percentage.
constexpr Codekleidos::ui::pin_practice::makeCode (security::pin_policy::PinMethod method, const std::array< uint32_t, kRandomWords > &rnd)
Draw a practice code for method from rnd.
constexpr Markkleidos::ui::pin_practice::markAt (const Code &code, const uint8_t *entered, uint8_t count, uint8_t index)
The mark under digit index of code, given what was dialed.
constexpr boolkleidos::ui::pin_practice::passes (const Code &code, const char *secret, std::size_t len)
Whether an entered secret dials code.
constexpr Stepskleidos::ui::pin_ring::stepsFor (bool epaper)
How long each quadrant of the ring takes to fill, in each stage, on this kind of panel.
constexpr uint32_tkleidos::ui::pin_ring::stepMs (const Steps &steps, Stage stage)
The step length of stage.
constexpr uint8_tkleidos::ui::pin_ring::position (uint32_t elapsedMs, uint32_t step)
The quadrant under the tip after a hold of elapsedMs.
constexpr uint8_tkleidos::ui::pin_ring::fillPercent (uint32_t elapsedMs, uint32_t step)
The ring's fill after a hold of elapsedMs.
constexpr uint8_tkleidos::ui::pin_ring::quadrantFill (uint8_t pos)
The fill an e-paper frame shows for quadrant pos: whole quadrants, the one under the tip included.
constexpr uint8_tkleidos::ui::pin_ring::epaperFramePosition (uint32_t elapsedMs, uint32_t step)
The quadrant an e-paper frame issued after elapsedMs shows: the quadrant that starts within the next kEpaperLeadMs, so its partial refresh lands as it starts to count.
constexpr Itemkleidos::ui::pin_ring::itemAt (Stage stage, uint8_t block, uint8_t pos, bool erasable)
What quadrant pos stands for in stage.
constexpr uint8_tkleidos::ui::pin_ring::blockOf (uint8_t digit)
The block that holds digit.
constexpr uint8_tkleidos::ui::pin_ring::quadrantOf (uint8_t digit)
The stage-2 quadrant of digit inside its block.
constexpr uint32_tkleidos::ui::pin_ring::aimMs (uint8_t pos, uint32_t step)
The hold that lands in the middle of quadrant pos (what a person aiming at it holds, and what the QA tooling dials).
constexpr Viewkleidos::ui::pin_ring::idleView (const Dial &dial, uint8_t stored, bool epaper)
The view of a ring nobody is holding.
constexpr Viewkleidos::ui::pin_ring::holdView (const Dial &dial, uint8_t stored, uint32_t elapsedMs, const Steps &steps, bool epaper)
The view of a hold elapsedMs in.
constexpr Viewkleidos::ui::pin_ring::flashView (uint8_t digit, uint8_t stored)
The view of the lock flash after a digit was stored: the coarse ring back, full, with the stored digit in the middle for the flash only.
voidkleidos::ui::pin_ring_face::drawRim (Canvas &canvas, const Geometry &geo, const pin_ring::View &view, bool atRest)
Draw the four rim labels, each over a cleared box of its own.
voidkleidos::ui::pin_ring_face::drawBand (Canvas &canvas, const Geometry &geo, const pin_ring::View &view)
Draw the band: the track, the fill to view.percent and the four sector gaps.
voidkleidos::ui::pin_ring_face::drawGapsIn (Canvas &canvas, const Geometry &geo, uint8_t fromPercent, uint8_t toPercent)
Draw again the sector gaps a fill from fromPercent to toPercent painted over.
voidkleidos::ui::pin_ring_face::drawCenter (Canvas &canvas, const Geometry &geo, const pin_ring::View &view)
Draw what the middle of the ring shows.
constexpr uint16_tkleidos::ui::unlock_feedback::completionDeg (uint16_t fromDeg, uint32_t elapsedMs)
The eased completion of an arc lit from fromDeg to the full turn.
constexpr uint8_tkleidos::ui::unlock_feedback::completionPercent (uint8_t fromPercent, uint32_t elapsedMs)
The same eased completion in the dial's percent units.
constexpr ArcSpankleidos::ui::unlock_feedback::waitSpan (uint16_t fromDeg, uint32_t clockMs)
The lit arc of the wait ring at wait-clock clockMs.
constexpr uint32_tkleidos::ui::unlock_feedback::waitFrameMs (uint32_t clockMs, WaitCadence cadence=kRingCadence)
The frame interval at wait-clock clockMs.
constexpr uint32_tkleidos::ui::unlock_feedback::advanceWaitClock (uint32_t clockMs, uint32_t sinceFrameMs, WaitCadence cadence=kRingCadence)
The wait clock after a frame painted sinceFrameMs after the last.
constexpr uint32_tkleidos::ui::unlock_feedback::msUntilWaitFrame (uint32_t clockMs, uint32_t sinceFrameMs, WaitCadence cadence=kRingCadence)
Milliseconds until the next frame of the wait is due.
constexpr boolkleidos::ui::unlock_feedback::litAt (ArcSpan span, uint16_t deg)
Whether span lights degree deg of the ring.
constexpr DirtyArcskleidos::ui::unlock_feedback::waitDirtyArcs (ArcSpan before, ArcSpan after)
The arcs a frame repaints to turn the ring from before into after.
constexpr int32_tkleidos::ui::unlock_feedback::sinScaled (int32_t deg)
Sine of deg degrees scaled by kTrigScale, integer-only.
voidkleidos::ui::unlock_feedback::drawWaitRing (Canvas &canvas, const WaitRingGeo &geo, ArcSpan span)
Draw the wait ring: the full track, the lit span over it, the outlines.
constexpr Rectkleidos::ui::unlock_feedback::waitArcWindow (const WaitRingGeo &geo, ArcRange arc)
The screen box that holds every pixel of the ring an arc can change.
voidkleidos::ui::unlock_feedback::paintWaitFrame (Canvas &canvas, const WaitRingGeo &geo, uint16_t bg, ArcSpan span, const DirtyArcs &dirty, const KleidosMarkGeo *mark=nullptr)
Paint one frame of the wait: the whole ring, or only what changed.
constexpr uint8_tkleidos::ui::unlock_feedback::verdictIndex (uint32_t tauMs)
The table entry due tauMs into the verdict.
constexpr int16_tkleidos::ui::unlock_feedback::keyholeDeciDegAt (bool success, uint8_t index)
The keyhole's angle at table entry index.
constexpr int16_tkleidos::ui::unlock_feedback::keyholeDeciDeg (bool success, uint32_t tauMs)
The keyhole's angle tauMs into the verdict.
constexpr MarkTonekleidos::ui::unlock_feedback::verdictToneAt (bool success, uint8_t index)
The mark's tone at table entry index.
constexpr MarkTonekleidos::ui::unlock_feedback::verdictTone (bool success, uint32_t tauMs)
The mark's tone tauMs into the verdict.
constexpr boolkleidos::ui::unlock_feedback::verdictDone (uint32_t tauMs)
Whether the verdict is over and the outcome propagates.
constexpr KleidosMarkGeokleidos::ui::unlock_feedback::markInRing (const WaitRingGeo &ring)
The mark that lives in a wait ring: the ring is the logo's ring.
voidkleidos::ui::unlock_feedback::drawStatusRing (Canvas &canvas, const WaitRingGeo &geo, MarkTone tone)
The ring a wait ring becomes at the verdict: the whole band in one hue.
voidkleidos::ui::unlock_feedback::paintVerdictFrame (Canvas &canvas, const WaitRingGeo &ring, uint16_t bg, const VerdictFrame &frame)
Paint one verdict frame of the mark that lives in ring.
voidkleidos::ui::unlock_feedback::drawVerdictLine (Canvas &canvas, const Rect &row, MarkTone tone, const char *text, hal::display::Font font, uint16_t bg, bool leftAlign=false)
Draw a status line: the verdict's glyph, then its words.
constexpr VerdictWordskleidos::ui::verdictWords (AuthEntryPurpose purpose, security::pin_policy::SecretKind kind)
The verdict's words for an entry of purpose.
notice_stack::Stackkleidos::ui::wipe_screen::layoutCountdown (Canvas &canvas, const LayoutContext &layout, uint8_t digit)
The countdown's column on the panel layout describes.
notice_stack::Stackkleidos::ui::wipe_screen::layoutResult (Canvas &canvas, const LayoutContext &layout, bool wiped)
The result screen's column on the panel layout describes.
voidkleidos::ui::wipe_screen::drawCountdown (Canvas &canvas, const LayoutContext &layout, uint8_t digit)
Paint one frame of the countdown: the warning fill and its column.
voidkleidos::ui::wipe_screen::drawResult (Canvas &canvas, const LayoutContext &layout, bool wiped)
Paint the result screen: what the erase did, and that the device restarts.

Variables

constexpr std::size_tkleidos::ui::lock_cause_notice::kMaxRows
Rows one part of the notice (the title or the detail) may take.
constexpr uint32_tkleidos::ui::lockout_countdown::kColorStepSec
Seconds one repaint of the countdown covers on a color panel.
constexpr uint32_tkleidos::ui::lockout_countdown::kEpaperStepSec
Seconds one repaint of the countdown covers on the e-paper panel.
constexpr uint32_tkleidos::ui::minute_watch::kSecondMs
One second, ms.
constexpr uint8_tkleidos::ui::minute_watch::kLastSecond
The last second of a minute.
constexpr uint32_tkleidos::ui::minute_watch::kRollPollMs
constexpr uint32_tkleidos::ui::minute_watch::kUntrustedPollMs
Period between two reads of a clock that is not trusted, ms.
constexpr uint32_tkleidos::ui::pin_arc::kArcDurationMs
Default hold duration of one full arc sweep (0→9, 0→100%), in ms.
constexpr uint32_tkleidos::ui::pin_arc::kDefaultSweepMs
Default sweep duration (alias of kArcDurationMs) for the setting.
constexpr uint32_tkleidos::ui::pin_arc::kMinSweepMs
Viable minimum sweep duration (ms): below this the dial is uncontrollable (digits flick past faster than a person can release). The configurable sweep setting is clamped to this floor at load and edit time.
constexpr uint32_tkleidos::ui::pin_arc::kMaxSweepMs
Maximum configurable sweep duration (ms): a deliberately slow, easy-to-aim dial. Bounds the upper end of the stepper.
constexpr uint32_tkleidos::ui::pin_arc::kSweepStepMs
Step granularity (ms) the sweep-duration stepper advances by.
constexpr uint32_tkleidos::ui::pin_arc::kDigitRange
Number of dialable digits per sweep (0..9).
constexpr uint8_tkleidos::ui::pin_arc::kFullPercent
Full arc fill percentage.
constexpr uint8_tkleidos::ui::pin_practice::kCodeLength
Digits in a practice code.
constexpr uint8_tkleidos::ui::pin_practice::kRandomWords
Random words makeCode consumes.
constexpr uint8_tkleidos::ui::pin_ring::kQuadrants
Quadrants on each ring (four 90-degree sectors).
constexpr uint8_tkleidos::ui::pin_ring::kPastRing
Position of a hold that ran past the last quadrant.
constexpr uint8_tkleidos::ui::pin_ring::kBlocks
Number of blocks stage 1 offers (1-2-3, 4-5-6, 7-8-9, the 0 block).
constexpr uint8_tkleidos::ui::pin_ring::kZeroBlock
Index of the block that holds the 0, back and erase.
constexpr uint8_tkleidos::ui::pin_ring::kDigitsPerBlock
Digits in each of the first three blocks.
constexpr uint8_tkleidos::ui::pin_ring::kFullPercent
Full ring fill percentage.
constexpr uint8_tkleidos::ui::pin_ring::kHoldsPerDigit
Holds every digit takes, whatever the digit.
constexpr uint8_tkleidos::ui::pin_ring::kNoLive
A view with no live quadrant (idle, or past the ring).
constexpr Stepskleidos::ui::pin_ring::kStickSteps
The Sticks' steps: stage 1 keeps the arc's 300 ms, stage 2 one notch slower.
constexpr Stepskleidos::ui::pin_ring::kEpaperSteps
The CoreInk's steps: each holds one fast partial issued ahead.
constexpr uint32_tkleidos::ui::pin_ring::kEpaperLeadMs
How long ahead of a quadrant the e-paper issues the frame that shows it (ms): one fast partial refresh, so the frame lands as the quadrant starts to count.
constexpr int16_tkleidos::ui::pin_ring_face::kRimGap
Gap between the band and the inner corner of a rim label (px).
constexpr int16_tkleidos::ui::pin_ring_face::kSectorGapPx
Width of the gap that splits two sectors (px).
constexpr uint32_tkleidos::ui::unlock_feedback::kResultDwellMs
constexpr uint32_tkleidos::ui::unlock_feedback::kFillMs
constexpr uint32_tkleidos::ui::unlock_feedback::kSpinPeriodMs
constexpr uint16_tkleidos::ui::unlock_feedback::kFullTurnDeg
A full turn of the ring (degrees).
constexpr uint16_tkleidos::ui::unlock_feedback::kSpinSegmentDeg
constexpr uint32_tkleidos::ui::unlock_feedback::kTurnInMs
constexpr uint32_tkleidos::ui::unlock_feedback::kOrbitStartMs
Wait-clock reading at which the orbit begins.
constexpr uint32_tkleidos::ui::unlock_feedback::kFastFrameMs
constexpr uint32_tkleidos::ui::unlock_feedback::kSpinFrameMs
constexpr WaitCadencekleidos::ui::unlock_feedback::kRingCadence
constexpr uint16_tkleidos::ui::unlock_feedback::kDirtyPadDeg
constexpr uint8_tkleidos::ui::unlock_feedback::kMaxDirtyArcs
Arcs a frame repaints at most: two edges move, and each may straddle 12 o'clock.
constexpr uint16_tkleidos::ui::unlock_feedback::kWholeRingDirtyDeg
constexpr int32_tkleidos::ui::unlock_feedback::kTrigScale
The value of sin(90 deg) in ui::unlock_feedback::sinScaled units.
constexpr int16_tkleidos::ui::unlock_feedback::kWaitWindowMarginPx
constexpr uint32_tkleidos::ui::unlock_feedback::kVerdictMs
constexpr uint32_tkleidos::ui::unlock_feedback::kVerdictFrameMs
One table entry per frame (ms): the wait's fast cadence.
constexpr uint32_tkleidos::ui::unlock_feedback::kKeyTintOkMs
When a right secret's stem meets the body outline and the mark turns green (ms).
constexpr uint32_tkleidos::ui::unlock_feedback::kKeyJamMs
When a wrong secret's turn stalls and the mark turns red (ms).
constexpr uint8_tkleidos::ui::unlock_feedback::kVerdictSteps
Frames of the verdict, the last one at kVerdictMs.
constexpr std::array< int16_t, kVerdictSteps+1 >kleidos::ui::unlock_feedback::kKeyTurnOkDeciDeg
constexpr std::array< int16_t, kVerdictSteps+1 >kleidos::ui::unlock_feedback::kKeyTurnWrongDeciDeg

Back to the top

Enumeration Type Documentation

AuthEntryPurpose #

enum class kleidos::AuthEntryPurpose : uint8_t

What an entered secret is for, so the surface can say so.

Enumerator
Unlock 

Open the vault ("Enter PIN").

Current 

Prove the current secret before changing it.

Create 

Set a new secret (creating the vault or changing it).

Repeat 

Type the new secret again to confirm it.

BackupCreate 

Set the passphrase that protects an encrypted backup.

BackupRepeat 

Type the backup passphrase again to confirm it.

BackupOpen 

Give the passphrase an encrypted backup was made with.

Wipe 

Prove the current secret to empty the vault under it.

AuthUIState #

enum class kleidos::AuthUIState : uint8_t

High-level state shared by both PIN and passphrase entry modes.

Enumerator
IDLE 

Waiting for user input.

SELECTING 

PIN arc: button held, arc filling.

ENTERING 

Passphrase: typing characters.

DigitLocked 

PIN arc: digit confirmed.

COMPLETE 

Input complete, verifying.

ResultFlash 

Showing success or failure.

LockedOut 

Brute-force lockout active.

Center #

enum class kleidos::ui::pin_ring::Center : uint8_t

What the middle of the ring shows.

Enumerator
Empty 

Nothing (idle; no digit is ever shown outside its own hold and flash).

Block 

Stage 1 held: the live block's digits.

Digit 

Stage 2 held on a digit, or the lock flash: that digit.

Back 

Stage 2 held on back.

Erase 

Stage 2 held on erase.

None 

Stage 1 held past the ring: a release picks nothing.

LockCause #

enum class kleidos::ui::lockout_countdown::LockCause : uint8_t

Why a PIN surface is locked out, which decides what it shows.

Enumerator
Counter 

The attempt counter's lock: the surface counts its seconds down.

DeviceKeyMissing 

The build binds the vault to a device key this chip does not hold.

LockFaceKind #

enum class kleidos::LockFaceKind : uint8_t

What the retained e-paper lock face shows while the board sleeps.

Enumerator
Clock 

The wall clock, kept current by the minute tick.

Logo 

The Kleidos mark, when the owner hid the clock.

Mark #

enum class kleidos::ui::pin_practice::Mark : uint8_t

The mark under one digit of the code.

Enumerator
None 

Not reached yet.

Current 

The digit being dialed now (an underline).

Done 

Dialed and matching (a check).

Wrong 

Dialed and not matching (a cross).

Outcome #

enum class kleidos::ui::pin_ring::Outcome : uint8_t

What a release did.

Enumerator
Nothing 

Stage 1 past the ring: nothing changed.

BlockOpen 

Stage 1: a block was chosen; stage 2 is next.

Stored 

Stage 2: a digit was stored; stage 1 is next.

Back 

Stage 2: back to stage 1, nothing stored.

Erased 

Stage 2: the last stored digit was removed; stage 1 is next.

Rung #

enum class kleidos::ui::lock_cause_notice::Rung : uint8_t

The rung of the ladder a notice starts from (layout).

Enumerator
Heading 

Heading title over a body detail, then smaller (a cause, a lockout).

Body 

Body title over a small detail, then small over small (a count under it).

Slot #

enum class kleidos::ui::pin_ring::Slot : uint8_t

What one quadrant of a ring stands for.

Enumerator
Block 

Stage 1: a block (its index is the quadrant).

Digit 

Stage 2: a digit.

Back 

Stage 2: return to stage 1, nothing stored.

Erase 

Stage 2, 0 block: remove the last stored digit.

Nothing 

Stage 1 past the ring: the release does nothing.

Stage #

enum class kleidos::ui::pin_ring::Stage : uint8_t

Which of the two holds of a digit is next.

Enumerator
Block 

Stage 1: the hold picks a block.

Digit 

Stage 2: the hold picks a digit of the chosen block, back or erase.

Back to the top

Function Documentation

advanceWaitClock() #

uint32_t kleidos::ui::unlock_feedback::advanceWaitClock(uint32_t clockMs, uint32_t sinceFrameMs, WaitCadence cadence = kRingCadence)
constexpr

The wait clock after a frame painted sinceFrameMs after the last.

Advanced by the real time since the last frame, capped at one frame interval: a stall (a mount, a storage flush, a flash write freezing the UI core) shows as a short slow-down of the ring and never as a jump. The phase carries no information, so it may lag real time.

Parameters
NameDirectionMeaning
clockMsinThe wait clock at the last frame.
sinceFrameMsinTime since the last frame.
cadenceinThe ring's cadence.
Returns
The wait clock for the new frame.

aimMs() #

uint32_t kleidos::ui::pin_ring::aimMs(uint8_t pos, uint32_t step)
constexpr

The hold that lands in the middle of quadrant pos (what a person aiming at it holds, and what the QA tooling dials).

Parameters
NameDirectionMeaning
posinQuadrant 0..3.
stepinMilliseconds per quadrant.
Returns
Milliseconds to hold.

blockOf() #

uint8_t kleidos::ui::pin_ring::blockOf(uint8_t digit)
constexpr

The block that holds digit.

Parameters
NameDirectionMeaning
digitin0..9.
Returns
0..2 for 1..9, kZeroBlock for 0.

clampSweepMs() #

uint32_t kleidos::ui::pin_arc::clampSweepMs(uint32_t sweepMs)
constexpr

Clamp a candidate sweep duration to the viable [min, max] window.

Parameters
NameDirectionMeaning
sweepMsinCandidate sweep duration in milliseconds.
Returns
The clamped, controllable sweep duration.

completionDeg() #

uint16_t kleidos::ui::unlock_feedback::completionDeg(uint16_t fromDeg, uint32_t elapsedMs)
constexpr

The eased completion of an arc lit from fromDeg to the full turn.

Ease-out quad over kFillMs (an entrance: it arrives and settles). The fill says "input complete", not how long anything takes, so the linear rule for progress does not apply to it.

Parameters
NameDirectionMeaning
fromDeginWhere the arc stood when the fill began, [0, 360].
elapsedMsinTime since the fill began.
Returns
The lit sweep in degrees, fromDeg at 0 and 360 from kFillMs.

completionPercent() #

uint8_t kleidos::ui::unlock_feedback::completionPercent(uint8_t fromPercent, uint32_t elapsedMs)
constexpr

The same eased completion in the dial's percent units.

What the Sticks' lock flash paints after the last digit's release.

Parameters
NameDirectionMeaning
fromPercentinWhere the dial stood at the release, [0, 100].
elapsedMsinTime since the release.
Returns
The fill percent, fromPercent at 0 and 100 from kFillMs.

dialedDigit() [1/2] #

uint8_t kleidos::ui::pin_arc::dialedDigit(uint32_t elapsedMs)
constexpr

Dialed digit (0..9) for a hold elapsed time (default sweep).

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the button has been held.
Returns
Digit, wrapping every kArcDurationMs.

dialedDigit() [2/2] #

uint8_t kleidos::ui::pin_arc::dialedDigit(uint32_t elapsedMs, uint32_t sweepMs)
constexpr

Dialed digit (0..9) for a hold elapsed time, given a sweep.

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the button has been held.
sweepMsinFull-sweep duration; clamped to the viable window.
Returns
Digit, wrapping every sweepMs.

digitForPercent() #

uint8_t kleidos::ui::pin_arc::digitForPercent(uint8_t percent)
constexpr

Dialed digit (0..9) for a debug-forced fill percentage.

Parameters
NameDirectionMeaning
percentinForced fill 0..100.
Returns
Digit corresponding to that fill, clamped to 0..9.

draw() #

void kleidos::ui::lock_cause_notice::draw(Canvas & canvas, const Notice & notice, const Rect & box, uint16_t titleColor, uint16_t detailColor)

Draw notice centered in box.

Each row is centered on the box; the block is centered vertically, and one taller than the box starts at its top.

Parameters
NameDirectionMeaning
canvasin, outSurface to draw on (inside the caller's frame).
noticeinThe notice layout set for box.
boxinThe box it was set for.
titleColorinRGB565 color of the title rows.
detailColorinRGB565 color of the detail rows.

drawBand() #

void kleidos::ui::pin_ring_face::drawBand(Canvas & canvas, const Geometry & geo, const pin_ring::View & view)

Draw the band: the track, the fill to view.percent and the four sector gaps.

Draws over whatever is there; clear the dial disc first for a repaint.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface in an open frame.
geoinRing geometry.
viewinWhat the ring shows.

drawCenter() #

void kleidos::ui::pin_ring_face::drawCenter(Canvas & canvas, const Geometry & geo, const pin_ring::View & view)

Draw what the middle of the ring shows.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface in an open frame (middle cleared).
geoinRing geometry.
viewinWhat the ring shows.

drawCountdown() #

void kleidos::ui::wipe_screen::drawCountdown(Canvas & canvas, const LayoutContext & layout, uint8_t digit)

Paint one frame of the countdown: the warning fill and its column.

Parameters
NameDirectionMeaning
canvasin, outSurface to draw on (inside the caller's frame).
layoutinThe panel.
digitinCountdown digit shown (3, 2 or 1).

drawGapsIn() #

void kleidos::ui::pin_ring_face::drawGapsIn(Canvas & canvas, const Geometry & geo, uint8_t fromPercent, uint8_t toPercent)

Draw again the sector gaps a fill from fromPercent to toPercent painted over.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface in an open frame.
geoinRing geometry.
fromPercentinFill before the slice.
toPercentinFill after it.

drawResult() #

void kleidos::ui::wipe_screen::drawResult(Canvas & canvas, const LayoutContext & layout, bool wiped)

Paint the result screen: what the erase did, and that the device restarts.

Parameters
NameDirectionMeaning
canvasin, outSurface to draw on (inside the caller's frame).
layoutinThe panel.
wipedinWhether the erase reported the vault gone.

drawRim() #

void kleidos::ui::pin_ring_face::drawRim(Canvas & canvas, const Geometry & geo, const pin_ring::View & view, bool atRest)

Draw the four rim labels, each over a cleared box of its own.

The boxes never reach the band (their inner corners sit kRimGap outside it), so the labels repaint without touching the ring.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface in an open frame.
geoinRing geometry.
viewinWhat the ring shows.
atRestinTrue draws no label live (the entry is complete).

drawStatusRing() #

void kleidos::ui::unlock_feedback::drawStatusRing(Canvas & canvas, const WaitRingGeo & geo, MarkTone tone)

The ring a wait ring becomes at the verdict: the whole band in one hue.

The same annulus and outlines as drawWaitRing, so the ring does not move by a pixel when the wait ends: the idle tone's primary (the lit arc's own ink), then the success or failure hue.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface.
geoinThe ring.
toneinIts tone.

drawVerdictLine() #

void kleidos::ui::unlock_feedback::drawVerdictLine(Canvas & canvas, const Rect & row, MarkTone tone, const char * text, hal::display::Font font, uint16_t bg, bool leftAlign = false)

Draw a status line: the verdict's glyph, then its words.

Clears row to bg, then draws the check (success) or the cross (failure) in the status hue in a square one line tall and the words in the primary text ink, bold, centered in row as one group (or from its left edge). An idle tone draws the words alone. Failure is never told by color alone: the glyph's shape and the words carry it.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface.
rowinThe line's box.
toneinThe verdict's tone.
textinThe words.
fontinFont role.
bginThe color under the line.
leftAligninStart at row's left edge instead of centering.

drawWaitRing() #

void kleidos::ui::unlock_feedback::drawWaitRing(Canvas & canvas, const WaitRingGeo & geo, ArcSpan span)

Draw the wait ring: the full track, the lit span over it, the outlines.

The dial's own inks: the track in bg.accent and the span in brand.primary (6.94:1 against the track, 11.66:1 against bg.base, both past the 3:1 non-text bar), the outlines in the track's tone (kSubtle on the crisp path). One antialiased band pass on a color panel. The caller clears what lies under the ring and brackets the frame.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface.
geoinCenter, radii and outline stroke.
spaninThe lit arc.

epaperFramePosition() #

uint8_t kleidos::ui::pin_ring::epaperFramePosition(uint32_t elapsedMs, uint32_t step)
constexpr

The quadrant an e-paper frame issued after elapsedMs shows: the quadrant that starts within the next kEpaperLeadMs, so its partial refresh lands as it starts to count.

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the key has been held.
stepinMilliseconds per quadrant.
Returns
0..3, or kPastRing.

fillPercent() #

uint8_t kleidos::ui::pin_ring::fillPercent(uint32_t elapsedMs, uint32_t step)
constexpr

The ring's fill after a hold of elapsedMs.

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the key has been held.
stepinMilliseconds per quadrant (0 reads as 1).
Returns
0..100, full from the end of the fourth quadrant on (nothing wraps).

flashView() #

View kleidos::ui::pin_ring::flashView(uint8_t digit, uint8_t stored)
constexpr

The view of the lock flash after a digit was stored: the coarse ring back, full, with the stored digit in the middle for the flash only.

Parameters
NameDirectionMeaning
digitinThe digit just stored.
storedinDigits stored, that one included.
Returns
The flash view.

holdView() #

View kleidos::ui::pin_ring::holdView(const Dial & dial, uint8_t stored, uint32_t elapsedMs, const Steps & steps, bool epaper)
constexpr

The view of a hold elapsedMs in.

The middle names what a release now would pick: the live block, the digit, back or erase, or nothing past the coarse ring. The e-paper inks whole quadrants and shows the quadrant its frame is issued for, ahead of the tip (epaperFramePosition), and its first quadrant is the idle frame itself; the color boards sweep the fill continuously.

Parameters
NameDirectionMeaning
dialinThe ring's state.
storedinDigits stored so far.
elapsedMsinMilliseconds the key has been held.
stepsinThe board's steps.
epaperinTrue on the e-paper board.
Returns
The held view.

idleView() #

View kleidos::ui::pin_ring::idleView(const Dial & dial, uint8_t stored, bool epaper)
constexpr

The view of a ring nobody is holding.

The color boards show the ring empty. The e-paper marks the first quadrant already, where a release before the first step lands, so the press itself needs no frame (one partial per step, issued ahead).

Parameters
NameDirectionMeaning
dialinThe ring's state.
storedinDigits stored so far.
epaperinTrue on the e-paper board.
Returns
The idle view.

itemAt() #

Item kleidos::ui::pin_ring::itemAt(Stage stage, uint8_t block, uint8_t pos, bool erasable)
constexpr

What quadrant pos stands for in stage.

Stage 1: the block, or nothing past the ring. Stage 2: the block's digits and back; the 0 block reads 0, back, erase, back; past the ring is back. Erase reads as back while erasable is false (no digit stored).

Parameters
NameDirectionMeaning
stageinThe stage.
blockinThe block stage 2 opened (ignored in stage 1).
posinQuadrant 0..3, or kPastRing.
erasableinWhether a stored digit exists to erase.
Returns
The quadrant's meaning.

keyholeDeciDeg() #

int16_t kleidos::ui::unlock_feedback::keyholeDeciDeg(bool success, uint32_t tauMs)
constexpr

The keyhole's angle tauMs into the verdict.

Parameters
NameDirectionMeaning
successinWhether the secret was right.
tauMsinTime since the verdict began.
Returns
The angle, tenths of a degree.

keyholeDeciDegAt() #

int16_t kleidos::ui::unlock_feedback::keyholeDeciDegAt(bool success, uint8_t index)
constexpr

The keyhole's angle at table entry index.

Parameters
NameDirectionMeaning
successinWhether the secret was right.
indexinThe entry (clamped to kVerdictSteps).
Returns
The angle, tenths of a degree.

layout() #

Notice kleidos::ui::lock_cause_notice::layout(Canvas & canvas, const char * title, const char * detail, int16_t width, int16_t maxH, int16_t gap, Rung firstRung = Rung::Heading)

Set title over detail in a box width wide and maxH tall.

Takes the first setting of the ladder (heading / body, body / body, body / small, small / small) in which no word is wider than the box, every word of both parts lands on a row, and the block is no taller than maxH; when none is, the last setting, with fits false. A part is never ellipsized; in that last setting a word wider than width is split across rows and a part longer than kMaxRows rows drops the words past them.

Parameters
NameDirectionMeaning
canvasinSurface used only to measure text.
titleinNUL-terminated UTF-8 cause (nullptr sets no title).
detailinNUL-terminated UTF-8 detail (nullptr sets no detail).
widthinWidth of the box, in pixels.
maxHinHeight of the box, in pixels.
gapinSpace between the title and the detail, in pixels.
firstRunginThe setting the ladder starts from: Rung::Body skips the heading and the body / body settings, for a block that reads under another (the attempt count under a lockout).
Returns
The notice to draw.

layoutCountdown() #

notice_stack::Stack kleidos::ui::wipe_screen::layoutCountdown(Canvas & canvas, const LayoutContext & layout, uint8_t digit)

The countdown's column on the panel layout describes.

Parameters
NameDirectionMeaning
canvasinSurface used only to measure text.
layoutinThe panel.
digitinCountdown digit shown (3, 2 or 1).
Returns
Where the rows of the title, the reason and the digit land.

layoutResult() #

notice_stack::Stack kleidos::ui::wipe_screen::layoutResult(Canvas & canvas, const LayoutContext & layout, bool wiped)

The result screen's column on the panel layout describes.

Parameters
NameDirectionMeaning
canvasinSurface used only to measure text.
layoutinThe panel.
wipedinWhether the erase reported the vault gone; false names a failure instead, because records are still on flash.
Returns
Where the rows of the outcome and the restart line land.

litAt() #

bool kleidos::ui::unlock_feedback::litAt(ArcSpan span, uint16_t deg)
constexpr

Whether span lights degree deg of the ring.

Parameters
NameDirectionMeaning
spaninThe lit arc.
deginA degree clockwise from 12 o'clock, [0, 360).
Returns
true when the degree lies on the lit arc.

makeCode() #

Code kleidos::ui::pin_practice::makeCode(security::pin_policy::PinMethod method, const std::array< uint32_t, kRandomWords > & rnd)
constexpr

Draw a practice code for method from rnd.

Two holds: one 0 and one digit from each of 1-3, 4-6 and 7-9, shuffled. One hold: one 0, one digit from 7-9 and two digits from 1-9, shuffled. Every choice takes one word modulo its range, so the draw is uniform enough for a code that guards nothing.

Parameters
NameDirectionMeaning
methodinThe method being practiced.
rndinkRandomWords random words.
Returns
The code.

markAt() #

Mark kleidos::ui::pin_practice::markAt(const Code & code, const uint8_t * entered, uint8_t count, uint8_t index)
constexpr

The mark under digit index of code, given what was dialed.

Parameters
NameDirectionMeaning
codeinThe code shown.
enteredinThe digits dialed so far (only the first count read).
countinHow many digits were dialed.
indexinThe code position, 0..3.
Returns
Its mark.

markInRing() #

KleidosMarkGeo kleidos::ui::unlock_feedback::markInRing(const WaitRingGeo & ring)
constexpr

The mark that lives in a wait ring: the ring is the logo's ring.

Parameters
NameDirectionMeaning
ringinThe wait ring.
Returns
The mark, its ring's mid radius inside the ring band.

msUntilWaitFrame() #

uint32_t kleidos::ui::unlock_feedback::msUntilWaitFrame(uint32_t clockMs, uint32_t sinceFrameMs, WaitCadence cadence = kRingCadence)
constexpr

Milliseconds until the next frame of the wait is due.

Parameters
NameDirectionMeaning
clockMsinThe wait clock at the last frame.
sinceFrameMsinTime since the last frame.
cadenceinThe ring's cadence.
Returns
0 when a frame is due now, else the time left.

namesCause() #

bool kleidos::ui::lockout_countdown::namesCause(const LockStatus & status)
constexpr

Whether a surface names the cause of status instead of counting it down.

Parameters
NameDirectionMeaning
statusinThe lockout read.
Return values
ValueMeaning
trueA lock holds for a missing device key.
falseNo lock holds, or the counter's lock counts down.

nextReadInMs() #

uint32_t kleidos::ui::minute_watch::nextReadInMs(bool trusted, uint8_t seconds)
constexpr

How long after a reading the clock is read again.

Parameters
NameDirectionMeaning
trustedinThe reading met the trust the face asks for.
secondsinSeconds past the minute of the reading (0..59).
Returns
Milliseconds until the next read.

paintVerdictFrame() #

void kleidos::ui::unlock_feedback::paintVerdictFrame(Canvas & canvas, const WaitRingGeo & ring, uint16_t bg, const VerdictFrame & frame)

Paint one verdict frame of the mark that lives in ring.

A whole frame clears the ring's disc to bg and draws the status ring and the mark's body with the keyhole at the frame's angle: a partial repaint at the base clock (the frame clock is for full-frame composes and popup cards only), measured at about 55 ms on the StickS3 and 39 to 85 ms on the StickC Plus2, the cost of two such frames per verdict. A keyhole frame clips to keyholeRepaintBox, clears it and draws the body and the keyhole again there, so it costs that box alone. The caller brackets the frame.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface.
ringinThe ring the mark lives in.
bginThe color under the ring.
frameinThe frame (VerdictClock::step).

paintWaitFrame() #

void kleidos::ui::unlock_feedback::paintWaitFrame(Canvas & canvas, const WaitRingGeo & geo, uint16_t bg, ArcSpan span, const DirtyArcs & dirty, const KleidosMarkGeo * mark = nullptr)

Paint one frame of the wait: the whole ring, or only what changed.

A whole frame clears the ring's disc to bg and draws the ring at span. Otherwise the same clear and ring are drawn once per arc of dirty with the canvas clipped to that arc's waitArcWindow, so the frame costs what it changes and every pixel it touches comes out as a whole repaint draws it. The caller brackets the frame.

Parameters
NameDirectionMeaning
canvasin, outDrawing surface.
geoinThe ring.
bginThe color under the ring.
spaninThe lit arc of the frame.
dirtyinWhat the frame repaints (WaitRingClock::step).
markinThe Kleidos mark's body and upright keyhole to draw inside the ring after it, or nullptr for an empty ring. A whole frame draws it; a window draws it only where the window reaches its body.

passes() #

bool kleidos::ui::pin_practice::passes(const Code & code, const char * secret, std::size_t len)
constexpr

Whether an entered secret dials code.

Parameters
NameDirectionMeaning
codeinThe code shown.
secretinThe entered digits as ASCII.
leninTheir count.
Returns
True on an exact match.

passphraseMinFor() #

uint8_t kleidos::passphraseMinFor(AuthEntryPurpose purpose)
constexpr

The shortest passphrase an entry for purpose accepts.

Parameters
NameDirectionMeaning
purposeinWhat the passphrase is for.
Returns
The backup floor for the backup purposes, the set floor for a new vault secret, else the floor of a secret being tested.

position() #

uint8_t kleidos::ui::pin_ring::position(uint32_t elapsedMs, uint32_t step)
constexpr

The quadrant under the tip after a hold of elapsedMs.

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the key has been held.
stepinMilliseconds per quadrant (0 reads as 1).
Returns
0..3, or kPastRing once the hold ran past the fourth quadrant.

progressPercent() [1/2] #

uint8_t kleidos::ui::pin_arc::progressPercent(uint32_t elapsedMs)
constexpr

Arc fill percentage (0..100) for a hold elapsed time (default sweep).

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the button has been held.
Returns
Fill percentage, wrapping every kArcDurationMs.

progressPercent() [2/2] #

uint8_t kleidos::ui::pin_arc::progressPercent(uint32_t elapsedMs, uint32_t sweepMs)
constexpr

Arc fill percentage (0..100) for a hold elapsed time, given a sweep.

Parameters
NameDirectionMeaning
elapsedMsinMilliseconds the button has been held.
sweepMsinFull-sweep duration; clamped to the viable window.
Returns
Fill percentage, wrapping every sweepMs.

quadrantFill() #

uint8_t kleidos::ui::pin_ring::quadrantFill(uint8_t pos)
constexpr

The fill an e-paper frame shows for quadrant pos: whole quadrants, the one under the tip included.

Parameters
NameDirectionMeaning
posinQuadrant 0..3, or kPastRing.
Returns
25, 50, 75 or 100.

quadrantOf() #

uint8_t kleidos::ui::pin_ring::quadrantOf(uint8_t digit)
constexpr

The stage-2 quadrant of digit inside its block.

Parameters
NameDirectionMeaning
digitin0..9.
Returns
0..2.

shownSeconds() #

uint32_t kleidos::ui::lockout_countdown::shownSeconds(uint32_t remainingSec, uint32_t stepSec)
constexpr

The seconds a surface prints for remainingSec.

Rounded up to a multiple of stepSec, so the value shown is never less than the time the lock still holds; 0 stays 0. Saturates at UINT32_MAX.

Parameters
NameDirectionMeaning
remainingSecinSeconds the lockout still holds.
stepSecinStep of the panel (stepSecFor); 0 or 1 shows the seconds as they are.
Returns
The seconds to print.

shownValue() #

uint32_t kleidos::ui::lockout_countdown::shownValue(const LockStatus & status, uint32_t stepSec)
constexpr

The value a surface prints for status, and its repaint latch records.

The seconds as shownSeconds rounds them; 0 for a lock that names its cause, which counts nothing down, so its notice paints once however the seconds read.

Parameters
NameDirectionMeaning
statusinThe lockout read.
stepSecinStep of the panel (stepSecFor).
Returns
The value to print, or 0 for a named cause.

sinScaled() #

int32_t kleidos::ui::unlock_feedback::sinScaled(int32_t deg)
constexpr

Sine of deg degrees scaled by kTrigScale, integer-only.

Bhaskara I's approximation, 4x(180-x) / (40500 - x(180-x)) on each half turn, within 0.2 % of full scale: enough to bound a repaint window, which carries a margin of its own.

Parameters
NameDirectionMeaning
deginAngle in degrees (any integer).
Returns
sin(deg) * kTrigScale.

statusOf() #

LockStatus kleidos::ui::lockout_countdown::statusOf(uint32_t remainingSec, bool deviceKeyMissing)
constexpr

What a lockout read means: how long it holds, and whether a missing device key is the cause.

A lock read on a chip whose device key is missing is that key's lock: the counter it would come from cannot be authenticated without the key, so the read failed closed. With the key present the lock is the counter's.

Parameters
NameDirectionMeaning
remainingSecinSeconds the lock holds (the guard's read).
deviceKeyMissinginWhether the build binds the vault to a device key this chip does not hold.
Returns
The status the surfaces show; not locked when remainingSec is 0.

stepMs() #

uint32_t kleidos::ui::pin_ring::stepMs(const Steps & steps, Stage stage)
constexpr

The step length of stage.

Parameters
NameDirectionMeaning
stepsinThe board's steps.
stageinThe stage being held.
Returns
Milliseconds per quadrant (never 0).

stepSecFor() #

uint32_t kleidos::ui::lockout_countdown::stepSecFor(bool epaper)
constexpr

The step a panel counts the lockout down in.

Parameters
NameDirectionMeaning
epaperinWhether the panel is e-paper.
Returns
kEpaperStepSec on e-paper, kColorStepSec otherwise.

stepsFor() #

Steps kleidos::ui::pin_ring::stepsFor(bool epaper)
constexpr

How long each quadrant of the ring takes to fill, in each stage, on this kind of panel.

Parameters
NameDirectionMeaning
epaperinTrue on the e-paper board.
Returns
Its two step lengths.

verdictDone() #

bool kleidos::ui::unlock_feedback::verdictDone(uint32_t tauMs)
constexpr

Whether the verdict is over and the outcome propagates.

Parameters
NameDirectionMeaning
tauMsinTime since the verdict began.
Returns
true from kVerdictMs on.

verdictIndex() #

uint8_t kleidos::ui::unlock_feedback::verdictIndex(uint32_t tauMs)
constexpr

The table entry due tauMs into the verdict.

Parameters
NameDirectionMeaning
tauMsinTime since the verdict began.
Returns
tau / 20, at most kVerdictSteps.

verdictTone() #

MarkTone kleidos::ui::unlock_feedback::verdictTone(bool success, uint32_t tauMs)
constexpr

The mark's tone tauMs into the verdict.

Parameters
NameDirectionMeaning
successinWhether the secret was right.
tauMsinTime since the verdict began.
Returns
The tone.

verdictToneAt() #

MarkTone kleidos::ui::unlock_feedback::verdictToneAt(bool success, uint8_t index)
constexpr

The mark's tone at table entry index.

Parameters
NameDirectionMeaning
successinWhether the secret was right.
indexinThe entry.
Returns
Idle before the tint (300 ms right, 160 ms wrong), the outcome's tone from it.

verdictWords() #

VerdictWords kleidos::ui::verdictWords(AuthEntryPurpose purpose, security::pin_policy::SecretKind kind)
constexpr

The verdict's words for an entry of purpose.

Parameters
NameDirectionMeaning
purposeinWhat the secret is for.
kindinThe kind of secret the entry takes (names a wrong one).
Returns
The success and failure lines.

waitArcWindow() #

Rect kleidos::ui::unlock_feedback::waitArcWindow(const WaitRingGeo & geo, ArcRange arc)
constexpr

The screen box that holds every pixel of the ring an arc can change.

The box of the annular sector between arc's ends, from inside the inner outline to outside the outer one, with kWaitWindowMarginPx to spare. A sector's extremes lie at its two ends or where it crosses an axis, so those points bound it.

Parameters
NameDirectionMeaning
geoinThe ring.
arcinThe arc, as waitDirtyArcs gives it.
Returns
The box, in screen pixels.

waitDirtyArcs() #

DirtyArcs kleidos::ui::unlock_feedback::waitDirtyArcs(ArcSpan before, ArcSpan after)
constexpr

The arcs a frame repaints to turn the ring from before into after.

Every degree whose lit state differs between the two spans, widened by kDirtyPadDeg on each side so an edge's feather is inside. A pixel outside every arc is drawn the same in both frames, so repainting the arcs alone gives the frame a whole repaint would. Past kMaxDirtyArcs arcs or kWholeRingDirtyDeg degrees the answer is the whole ring.

Parameters
NameDirectionMeaning
beforeinThe span the ring shows now.
afterinThe span the frame paints.
Returns
The arcs to repaint (none when nothing changed).

waitFrameMs() #

uint32_t kleidos::ui::unlock_feedback::waitFrameMs(uint32_t clockMs, WaitCadence cadence = kRingCadence)
constexpr

The frame interval at wait-clock clockMs.

Parameters
NameDirectionMeaning
clockMsinThe wait clock.
cadenceinThe ring's cadence.
Returns
The cadence's fast interval through the fill and the turn-in, its orbit interval after.

waitSpan() #

ArcSpan kleidos::ui::unlock_feedback::waitSpan(uint16_t fromDeg, uint32_t clockMs)
constexpr

The lit arc of the wait ring at wait-clock clockMs.

Three phases, none of which jumps at its hand-off:

  • fill, [0, kFillMs): the arc grows from fromDeg to the full ring;
  • turn-in, [kFillMs, kOrbitStartMs): the front edge turns at one turn per kSpinPeriodMs and the back edge at twice that, so the ring shortens from 360 deg to kSpinSegmentDeg as it starts to turn;
  • orbit, from kOrbitStartMs: the segment turns at one turn per kSpinPeriodMs until the verdict.

At kFillMs both formulas give the full ring from 12 o'clock, and at kOrbitStartMs both give the segment from 6 o'clock.

Parameters
NameDirectionMeaning
fromDeginWhere the fill starts, [0, 360] (0 for an empty ring).
clockMsinThe wait clock (see WaitRingClock).
Returns
The lit arc.

Back to the top

Variable Documentation

kDirtyPadDeg #

uint16_t kleidos::ui::unlock_feedback::kDirtyPadDeg
inlineconstexpr

Degrees a repaint reaches past each degree whose lit state changed. An edge's antialiased feather is about one pixel, under 2 deg on the smallest ring band; the rest covers the whole-degree angle a pixel is judged by.

kFastFrameMs #

uint32_t kleidos::ui::unlock_feedback::kFastFrameMs
inlineconstexpr

Frame interval of the fill and the turn-in (ms): the back edge moves at 600 deg/s there, and 20 ms holds it to the orbit's 12 deg step.

kFillMs #

uint32_t kleidos::ui::unlock_feedback::kFillMs
inlineconstexpr

Length of the fill that completes the ring at submission (ms): motion.fade, which on the Sticks is also exactly the lock flash, so the fill adds no time.

kKeyTurnOkDeciDeg #

std::array<int16_t, kVerdictSteps + 1> kleidos::ui::unlock_feedback::kKeyTurnOkDeciDeg
inlineconstexpr

The keyhole's angle on a right secret, tenths of a degree clockwise on the screen, one entry per kVerdictFrameMs, 900 sin(pi smootherstep(t / 600)), out to 90 deg at 300 ms and home at 600 (the teaser's turn, compressed from 880 ms).

kKeyTurnWrongDeciDeg #

std::array<int16_t, kVerdictSteps + 1> kleidos::ui::unlock_feedback::kKeyTurnWrongDeciDeg
inlineconstexpr

The keyhole's angle on a wrong secret: the same curve to 160 ms (33.6 deg, the stall), then the rattle about rest, -15 deg at 240 ms (ease-out from the stall), +9 at 320, -5 at 380, +2 at 440 and 0 at 500 (smoothstep between the extremes), still to 600.

kResultDwellMs #

uint32_t kleidos::ui::unlock_feedback::kResultDwellMs
inlineconstexpr

The beat before the outcome propagates (ms): the verdict's length, which lets the keyhole's turn and the words be read before the screen moves on.

kRingCadence #

WaitCadence kleidos::ui::unlock_feedback::kRingCadence
inlineconstexpr

The cadence of the dial rings (the Sticks' dial, the three-key stepper, the touch keypad): 12 deg per frame.

kRollPollMs #

uint32_t kleidos::ui::minute_watch::kRollPollMs
inlineconstexpr

Period between two reads during the last second of a minute, ms: the longest a new minute waits to be painted.

kSpinFrameMs #

uint32_t kleidos::ui::unlock_feedback::kSpinFrameMs
inlineconstexpr

Frame interval of the orbit (ms): 12 deg per frame at one turn per kSpinPeriodMs, within 15 arcmin on every ring any board draws.

kSpinPeriodMs #

uint32_t kleidos::ui::unlock_feedback::kSpinPeriodMs
inlineconstexpr

One turn of the orbiting segment (ms): motion.spin. The slowest period that still reads as a loading circle, and the fastest at which one 40 ms frame keeps the largest ring's step (the touch ring) within 15 arcmin.

kSpinSegmentDeg #

uint16_t kleidos::ui::unlock_feedback::kSpinSegmentDeg
inlineconstexpr

Length of the orbiting segment (degrees): a quarter of the track, the same share the indeterminate progress card's segment takes of its bar.

kTurnInMs #

uint32_t kleidos::ui::unlock_feedback::kTurnInMs
inlineconstexpr

Length of the turn-in (ms). The arc's front edge turns at the orbit's speed and its back edge at twice that, so the full ring shortens into the segment while it starts to turn; the back edge gains the 270 deg it has to close in this long.

kVerdictMs #

uint32_t kleidos::ui::unlock_feedback::kVerdictMs
inlineconstexpr

The verdict's length (ms): the keyhole turns, then the outcome propagates. No final hold: the same 600 ms as the result disc it replaced, read from the real clock, so a right and a wrong secret take the same time.

kWaitWindowMarginPx #

int16_t kleidos::ui::unlock_feedback::kWaitWindowMarginPx
inlineconstexpr

Pixels a repaint window reaches past the ring band on each side: the outlines' antialiased feather and the rounding of the bound.

kWholeRingDirtyDeg #

uint16_t kleidos::ui::unlock_feedback::kWholeRingDirtyDeg
inlineconstexpr

Repainted degrees past which a frame repaints the whole ring instead: the windows would cover most of it anyway.

Back to the top