summaryrefslogtreecommitdiff
path: root/12key-arduino/ModeNav.h
blob: abf848956a8ae4c19bb60112893976e0394cc1c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
	}
};