diff options
author | sanine <sanine.not@pm.me> | 2023-10-19 20:12:24 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-10-19 20:12:24 -0500 |
commit | a91ba5a9d7ced85277ad60f1dbf381192f5c5ed8 (patch) | |
tree | 7223cb8bf4440edf84a2c6e54e7f480dcb1be52e /12key-arduino/ModeNav.h | |
parent | e55263a0a250dea2bf567df8dcbad8ca3580b10c (diff) |
updatemain
Diffstat (limited to '12key-arduino/ModeNav.h')
-rw-r--r-- | 12key-arduino/ModeNav.h | 28 |
1 files changed, 28 insertions, 0 deletions
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 <Keyboard.h> +#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; + } +}; |