summaryrefslogtreecommitdiff
path: root/common/keyboard.h
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-02-13 13:31:01 +0900
committertmk <nobody@nowhere>2013-02-13 13:31:01 +0900
commit7a31451a077a55e1ad97cf8b31a111c7cd311a4d (patch)
tree335730a0308cdb2e2ec094fe08ac63ee29ce4f80 /common/keyboard.h
parent7054203e16af627a921b503a9508ce789913471d (diff)
parentc4421f585b085d3eef5e468ff1defcbc3b4ec8d3 (diff)
Merge branch 'actionfix'
Diffstat (limited to 'common/keyboard.h')
-rw-r--r--common/keyboard.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/common/keyboard.h b/common/keyboard.h
index e1cab31194..78cb24034f 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -30,12 +30,6 @@ extern "C" {
typedef struct {
uint8_t col;
uint8_t row;
-} keypos_t;
-
-// TODO: need raw? keypos_t -> key_t?
-typedef union {
- uint16_t raw;
- keypos_t pos;
} key_t;
/* key event */
@@ -46,20 +40,20 @@ typedef struct {
} keyevent_t;
/* equivalent test of key_t */
-#define KEYEQ(keya, keyb) ((keya).raw == (keyb).raw)
+#define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col)
/* (time == 0) means no event and assumes matrix has no 255 line. */
-#define IS_NOEVENT(event) ((event).time == 0 || ((event).key.pos.row == 255 && (event).key.pos.col == 255))
+#define IS_NOEVENT(event) ((event).time == 0 || ((event).key.row == 255 && (event).key.col == 255))
#define NOEVENT (keyevent_t){ \
- .key.pos = (keypos_t){ .row = 255, .col = 255 }, \
+ .key = (key_t){ .row = 255, .col = 255 }, \
.pressed = false, \
.time = 0 \
}
/* tick event */
#define TICK (keyevent_t){ \
- .key.pos = (keypos_t){ .row = 255, .col = 255 }, \
+ .key = (key_t){ .row = 255, .col = 255 }, \
.pressed = false, \
.time = (timer_read() | 1) \
}