aboutsummaryrefslogtreecommitdiff
path: root/common/keyboard.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/keyboard.h')
-rw-r--r--common/keyboard.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/common/keyboard.h b/common/keyboard.h
index 907ee1f97..4518cdddc 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -26,19 +26,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
26extern "C" { 26extern "C" {
27#endif 27#endif
28 28
29// TODO: union {raw = row:col}
30typedef struct { 29typedef struct {
31 uint8_t row;
32 uint8_t col; 30 uint8_t col;
31 uint8_t row;
33} keypos_t; 32} keypos_t;
34 33
34typedef union {
35 uint16_t raw;
36 keypos_t pos;
37} key_t;
38
35typedef struct { 39typedef struct {
36 keypos_t key; 40 key_t key;
37 bool pressed; 41 bool pressed;
38 uint16_t time; 42 uint16_t time;
39} keyevent_t; 43} keyevent_t;
40 44
41#define KEYEQ(keya, keyb) (keya.row == keyb.row && keya.col == keyb.col) 45#define KEYEQ(keya, keyb) (keya.raw == keyb.raw)
42#define IS_NOEVENT(event) (event.time == 0) 46#define IS_NOEVENT(event) (event.time == 0)
43#define NOEVENT (keyevent_t) { \ 47#define NOEVENT (keyevent_t) { \
44 .key = (keypos_t){ .row = 255, .col = 255 }, \ 48 .key = (keypos_t){ .row = 255, .col = 255 }, \