KeyboardAdapter
-
class KeyboardAdapter : public InputInterface
- #include <KeyboardAdapter.h>
Input interface to keyboard. Uses default buttons layout:
Arrows
forLEFT/RIGHT/UP/DOWN
;Enter
forENTER
;Escape
forBACK
;Delete
forCLEAR
;Backspace
forBACKSPACE
;
Keyboard can send multiple-bytes commands. Implementation should convert it to one byte command.
Implementation details.
Mapping:
First 128 of ASCII
-> as is\r
->ENTER
\n
->ENTER
\r\n
->ENTER
ESC
->BACK
ESC [ A
(up arrow) ->UP
ESC [ B
(down arrow) ->DOWN
ESC [ C
(right arrow) ->RIGHT
ESC [ D
(left arrow) ->LEFT
ESC [ 3 ~
(Delete button) ->CLEAR
Public Functions
-
inline KeyboardAdapter(LcdMenu *menu, Stream *stream)
Private Types
Private Functions
Private Members
-
CodeSet codeSet = CodeSet::C0
Internal state of current code set. As stream receives bytes asynchronously, multiple bytes command can arrive in several calls. Need to store current state between calls.
-
unsigned long lastCharTimestamp
Milliseconds timestamp of last received character. Used for detecting ESC with no chars next or single
\r
without\n
.