From a91ba5a9d7ced85277ad60f1dbf381192f5c5ed8 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 19 Oct 2023 20:12:24 -0500 Subject: update --- 12key-arduino/ModeNav.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 12key-arduino/ModeNav.h (limited to '12key-arduino/ModeNav.h') diff --git a/12key-arduino/ModeNav.h b/12key-arduino/ModeNav.h new file mode 100644 index 0000000..abf8489 --- /dev/null +++ b/12key-arduino/ModeNav.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include "Mode.h" + + +class ModeNav : public Mode { + public: + void reset() {} + + Mode * update(unsigned int keys) { + if (keys & KEY_STAR) return Mode::modes[0]; + + /* arrow keys */ + if (keys & KEY_2) Keyboard.write(KEY_UP_ARROW); + if (keys & KEY_4) Keyboard.write(KEY_LEFT_ARROW); + if (keys & KEY_5) Keyboard.write(KEY_DOWN_ARROW); + if (keys & KEY_6) Keyboard.write(KEY_RIGHT_ARROW); + + if (keys & KEY_7) Keyboard.write(KEY_ESC); + if (keys & KEY_8) Keyboard.write(KEY_TAB); + if (keys & KEY_9) Keyboard.write(KEY_RETURN); + + if (keys & KEY_0) Keyboard.write(KEY_BACKSPACE); + + return NULL; + } +}; -- cgit v1.2.1