|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <IKeypad.h>
Public Types | |
| using | LongPressCallback = void(*)(Key key) |
| using | PanicChordCallback = void(*)() |
Public Member Functions | |
| virtual | ~IKeypad ()=default |
| virtual void | poll ()=0 |
| virtual bool | isKeyPressed (Key key) const =0 |
| virtual Key | getNextKey ()=0 |
| virtual bool | hasKey () const =0 |
| virtual bool | anyKeyDown () const =0 |
| virtual void | setCallback (KeyCallback callback)=0 |
| virtual void | setLongPressEnabled (bool enabled, uint32_t thresholdMs=800)=0 |
| virtual void | setLongPressCallback (LongPressCallback callback)=0 |
| virtual void | setPanicChordCallback (PanicChordCallback callback)=0 |
| virtual void | setDeferShortPress (uint32_t source, bool enabled) |
| virtual void | setKeyRepeat (uint16_t initial_ms, uint16_t period_ms) |
| virtual void | prepareForSleep ()=0 |
| virtual void | recoverFromSleep ()=0 |
| virtual void | clearBuffer ()=0 |
| Public Member Functions inherited from cdc::core::IService | |
| virtual | ~IService ()=default |
| virtual bool | init ()=0 |
| virtual bool | start ()=0 |
| virtual void | stop ()=0 |
| virtual ServiceState | getState () const =0 |
| virtual const char * | getName () const =0 |
Static Public Attributes | |
| static constexpr uint32_t | DEFER_SRC_VIEW = 1u << 0 |
| active view (e.g. canvas long-press) | |
| static constexpr uint32_t | DEFER_SRC_EVENT = 1u << 1 |
| plugin KEY_LONG_PRESS subscription | |
| using cdc::hal::IKeypad::LongPressCallback = void(*)(Key key) |
| using cdc::hal::IKeypad::PanicChordCallback = void(*)() |
|
virtualdefault |
|
pure virtual |
Check if any key is currently pressed
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Clear key buffer (consume all pending keys)
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Get next key from buffer (consumes the key)
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Check if there are keys in the buffer
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Check if a specific key is currently pressed
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Poll for key state changes Should be called periodically from main loop
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Prepare keypad for sleep mode Disables ISR and interrupt to prevent spurious wakeups
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Recover keypad after sleep wakeup Waits for keys to be released, clears buffer, re-enables ISR
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Set callback for key events
| callback | Function to call on key press/release |
Implemented in cdc::hal::TCA9535Keypad.
|
inlinevirtual |
Defer the short-press event until key release and suppress it when a long-press already fired. When no source requests it (default) the short press is emitted on key-down. Each source is tracked independently and OR-combined, so a view and an event subscription cannot clobber each other.
| source | One of the DEFER_SRC_* bits identifying the requester. |
| enabled | Whether that source requests deferred short-press. |
Reimplemented in cdc::hal::TCA9535Keypad.
|
inlinevirtual |
Re-emit a held key on a repeat schedule, for every view. While a single key is held, the key is re-buffered every period_ms after an initial delay. Mutually exclusive with long-press: a non-zero period suppresses the long-press for held keys. Pass 0/0 to disable (default).
| initial_ms | Delay before the first repeat. |
| period_ms | Interval between subsequent repeats; 0 disables. |
Reimplemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Enable/disable long-press detection
| enabled | Enable long-press |
| thresholdMs | Time in ms to trigger long-press |
Implemented in cdc::hal::TCA9535Keypad.
|
pure virtual |
Implemented in cdc::hal::TCA9535Keypad.
|
staticconstexpr |
|
staticconstexpr |
active view (e.g. canvas long-press)
Independent requesters of deferred short-press mode (OR-combined).
Definition at line 90 of file IKeypad.h.
Referenced by cdc::ui::CanvasView::onExit().