summaryrefslogtreecommitdiff
path: root/12key-arduino/ModeNav.h
diff options
context:
space:
mode:
Diffstat (limited to '12key-arduino/ModeNav.h')
-rw-r--r--12key-arduino/ModeNav.h28
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;
+ }
+};