Numworks Epsilon
1.4.1
Graphing Calculator Operating System
keyboard.cpp
Go to the documentation of this file.
1
#include "
command.h
"
2
#include <
ion.h
>
3
4
namespace
Ion
{
5
namespace
Device {
6
namespace
Bench {
7
namespace
Command
{
8
9
void
Keyboard
(
const
char
* input) {
10
if
(input !=
nullptr
) {
11
reply
(
sSyntaxError
);
12
return
;
13
}
14
char
result[9+
Ion::Keyboard::NumberOfKeys
+1] = {
'K'
,
'E'
,
'Y'
,
'B'
,
'O'
,
'A'
,
'R'
,
'D'
,
'='
};
15
Ion::Keyboard::State
state =
Ion::Keyboard::scan
();
16
for
(
uint8_t
i=0; i<
Ion::Keyboard::NumberOfKeys
; i++) {
17
result[9+i] = state.
keyDown
((
Ion::Keyboard::Key
)i) ?
'1'
:
'0'
;
18
}
19
result[9+
Ion::Keyboard::NumberOfKeys
] = 0;
20
reply
(result);
21
}
22
23
}
24
}
25
}
26
}
command.h
ion.h
Ion::Device::Bench::Command::sSyntaxError
const char *const sSyntaxError
Definition:
command.cpp:11
uint8_t
unsigned char uint8_t
Definition:
stdint.h:4
Ion::Keyboard::Key
Key
Definition:
keyboard.h:12
Ion::Keyboard::NumberOfKeys
constexpr int NumberOfKeys
Definition:
keyboard.h:33
Ion::Display::Device::Command
Command
Definition:
display.h:63
Ion::Keyboard::State::keyDown
bool keyDown(Key k) const
Definition:
keyboard.h:47
Ion::Keyboard::scan
State scan()
Definition:
keyboard.cpp:50
Ion::Device::Bench::Command::reply
void reply(const char *s)
Definition:
command.cpp:15
Ion::Device::Bench::Command::Keyboard
void Keyboard(const char *input)
Definition:
keyboard.cpp:9
Ion
Definition:
backlight.h:6
Ion::Keyboard::State
Definition:
keyboard.h:36
epsilon
ion
src
device
bench
command
keyboard.cpp
Generated by
1.8.14