keyboard maps in PROGMEM

This commit is contained in:
Stephen Crane 2021-02-20 14:13:15 +00:00
parent aab45329c6
commit 3dad91194e
1 changed files with 3 additions and 3 deletions

6
io.cpp
View File

@ -39,7 +39,7 @@ void io::load() {
} }
// ascii map for scan-codes // ascii map for scan-codes
static const uint8_t scanmap[] = { static const uint8_t scanmap[] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x00 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x00
0xff, 0xff, 0xff, 0xff, 0xff, 0x09, 0x60, 0xff, // 0x08 0xff, 0xff, 0xff, 0xff, 0xff, 0x09, 0x60, 0xff, // 0x08
0xff, 0xff, 0xff, 0xff, 0xff, 0x51, 0x31, 0xff, // 0x10 0xff, 0xff, 0xff, 0xff, 0xff, 0x51, 0x31, 0xff, // 0x10
@ -58,7 +58,7 @@ static const uint8_t scanmap[] = {
0xff, 0x2b, 0x33, 0x2d, 0x2a, 0x39, 0xff, 0xff, // 0x78 0xff, 0x2b, 0x33, 0x2d, 0x2a, 0x39, 0xff, 0xff, // 0x78
}; };
static const uint8_t shiftmap[] = { static const uint8_t shiftmap[] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x00 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x00
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x08 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0x08
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x21, 0xff, // 0x10 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x21, 0xff, // 0x10
@ -92,7 +92,7 @@ void io::up(uint8_t scan) {
_shift = false; _shift = false;
return; return;
} }
enter(_shift? shiftmap[scan]: scanmap[scan]); enter(_shift? pgm_read_byte(shiftmap + scan): pgm_read_byte(scanmap + scan));
} }
void io::draw(char ch, int i, int j) { void io::draw(char ch, int i, int j) {