summaryrefslogtreecommitdiff
path: root/quantum/keyboard.h
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-12-17 15:06:27 +0100
committerGitHub <noreply@github.com>2022-12-17 14:06:27 +0000
commit85984902cfcfd852daf335f67cb97d6520531def (patch)
tree464ca8c4c1a4bb14e812fcd4b4aad5facd0ee2ea /quantum/keyboard.h
parentdedc54a328ab900f47da8478bd9c6b7d14891e15 (diff)
Introduce IS_EVENT instead of !IS_NOEVENT (#19366)
Diffstat (limited to 'quantum/keyboard.h')
-rw-r--r--quantum/keyboard.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/quantum/keyboard.h b/quantum/keyboard.h
index 86ce65aac1..d0b52dd13a 100644
--- a/quantum/keyboard.h
+++ b/quantum/keyboard.h
@@ -53,6 +53,9 @@ typedef struct {
53static inline bool IS_NOEVENT(keyevent_t event) { 53static inline bool IS_NOEVENT(keyevent_t event) {
54 return event.time == 0 || (event.key.row == KEYLOC_TICK && event.key.col == KEYLOC_TICK); 54 return event.time == 0 || (event.key.row == KEYLOC_TICK && event.key.col == KEYLOC_TICK);
55} 55}
56static inline bool IS_EVENT(keyevent_t event) {
57 return !IS_NOEVENT(event);
58}
56static inline bool IS_KEYEVENT(keyevent_t event) { 59static inline bool IS_KEYEVENT(keyevent_t event) {
57 return event.key.row < MATRIX_ROWS && event.key.col < MATRIX_COLS; 60 return event.key.row < MATRIX_ROWS && event.key.col < MATRIX_COLS;
58} 61}
@@ -63,10 +66,10 @@ static inline bool IS_ENCODEREVENT(keyevent_t event) {
63 return event.key.row == KEYLOC_ENCODER_CW || event.key.row == KEYLOC_ENCODER_CCW; 66 return event.key.row == KEYLOC_ENCODER_CW || event.key.row == KEYLOC_ENCODER_CCW;
64} 67}
65static inline bool IS_PRESSED(keyevent_t event) { 68static inline bool IS_PRESSED(keyevent_t event) {
66 return !IS_NOEVENT(event) && event.pressed; 69 return IS_EVENT(event) && event.pressed;
67} 70}
68static inline bool IS_RELEASED(keyevent_t event) { 71static inline bool IS_RELEASED(keyevent_t event) {
69 return !IS_NOEVENT(event) && !event.pressed; 72 return IS_EVENT(event) && !event.pressed;
70} 73}
71 74
72/* Common keyevent object factory */ 75/* Common keyevent object factory */