summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhid/genmap.py2
-rw-r--r--hid/src/keymap.h2
-rw-r--r--hid/src/main.cpp3
3 files changed, 3 insertions, 4 deletions
diff --git a/hid/genmap.py b/hid/genmap.py
index 2e3183a8..cb8f3ce5 100755
--- a/hid/genmap.py
+++ b/hid/genmap.py
@@ -29,7 +29,7 @@ def main() -> None:
hid_header_file.write("INLINE KeyboardKeycode keymap(uint8_t code) {\n\tswitch(code) {\n")
for (code, hid_key, _) in sorted(keymap, key=operator.itemgetter(1)):
hid_header_file.write("\t\tcase %d: return %s;\n" % (code, hid_key))
- hid_header_file.write("\t\tdefault: return 0;\n\t}\n}\n")
+ hid_header_file.write("\t\tdefault: return KEY_ERROR_UNDEFINED;\n\t}\n}\n")
if __name__ == "__main__":
diff --git a/hid/src/keymap.h b/hid/src/keymap.h
index 675d0b2f..7e5f24b7 100644
--- a/hid/src/keymap.h
+++ b/hid/src/keymap.h
@@ -89,6 +89,6 @@ INLINE KeyboardKeycode keymap(uint8_t code) {
case 24: return KEY_X;
case 25: return KEY_Y;
case 26: return KEY_Z;
- default: return 0;
+ default: return KEY_ERROR_UNDEFINED;
}
}
diff --git a/hid/src/main.cpp b/hid/src/main.cpp
index ba26be5c..98faff25 100644
--- a/hid/src/main.cpp
+++ b/hid/src/main.cpp
@@ -20,8 +20,7 @@ INLINE void cmdResetHid() {
INLINE void cmdKeyEvent() {
uint8_t state = CMD_SERIAL.read();
KeyboardKeycode code = keymap((uint8_t)CMD_SERIAL.read());
- CMD_SERIAL.read(); // unused now
- if (code) {
+ if (code != KEY_ERROR_UNDEFINED) {
if (state) {
Keyboard.press(code);
} else {