diff options
| author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
| commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
| tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /quantum/keyboard.h | |
| parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
Format code according to conventions (#16322)
Diffstat (limited to 'quantum/keyboard.h')
| -rw-r--r-- | quantum/keyboard.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/quantum/keyboard.h b/quantum/keyboard.h index 9b0fb3cef8..e122b38264 100644 --- a/quantum/keyboard.h +++ b/quantum/keyboard.h | |||
| @@ -44,13 +44,21 @@ typedef struct { | |||
| 44 | * 1) (time == 0) to handle (keyevent_t){} as empty event | 44 | * 1) (time == 0) to handle (keyevent_t){} as empty event |
| 45 | * 2) Matrix(255, 255) to make TICK event available | 45 | * 2) Matrix(255, 255) to make TICK event available |
| 46 | */ | 46 | */ |
| 47 | static inline bool IS_NOEVENT(keyevent_t event) { return event.time == 0 || (event.key.row == 255 && event.key.col == 255); } | 47 | static inline bool IS_NOEVENT(keyevent_t event) { |
| 48 | static inline bool IS_PRESSED(keyevent_t event) { return (!IS_NOEVENT(event) && event.pressed); } | 48 | return event.time == 0 || (event.key.row == 255 && event.key.col == 255); |
| 49 | static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) && !event.pressed); } | 49 | } |
| 50 | static inline bool IS_PRESSED(keyevent_t event) { | ||
| 51 | return (!IS_NOEVENT(event) && event.pressed); | ||
| 52 | } | ||
| 53 | static inline bool IS_RELEASED(keyevent_t event) { | ||
| 54 | return (!IS_NOEVENT(event) && !event.pressed); | ||
| 55 | } | ||
| 50 | 56 | ||
| 51 | /* Tick event */ | 57 | /* Tick event */ |
| 52 | #define TICK \ | 58 | #define TICK \ |
| 53 | (keyevent_t) { .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) } | 59 | (keyevent_t) { \ |
| 60 | .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) \ | ||
| 61 | } | ||
| 54 | 62 | ||
| 55 | /* it runs once at early stage of startup before keyboard_init. */ | 63 | /* it runs once at early stage of startup before keyboard_init. */ |
| 56 | void keyboard_setup(void); | 64 | void keyboard_setup(void); |
| @@ -68,18 +76,18 @@ void keyboard_pre_init_user(void); | |||
| 68 | void keyboard_post_init_kb(void); | 76 | void keyboard_post_init_kb(void); |
| 69 | void keyboard_post_init_user(void); | 77 | void keyboard_post_init_user(void); |
| 70 | 78 | ||
| 71 | void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol | 79 | void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol |
| 72 | void housekeeping_task_kb(void); // To be overridden by keyboard-level code | 80 | void housekeeping_task_kb(void); // To be overridden by keyboard-level code |
| 73 | void housekeeping_task_user(void); // To be overridden by user/keymap-level code | 81 | void housekeeping_task_user(void); // To be overridden by user/keymap-level code |
| 74 | 82 | ||
| 75 | uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity | 83 | uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity |
| 76 | uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity | 84 | uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity |
| 77 | 85 | ||
| 78 | uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity | 86 | uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity |
| 79 | uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity | 87 | uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity |
| 80 | 88 | ||
| 81 | uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity | 89 | uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity |
| 82 | uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity | 90 | uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity |
| 83 | 91 | ||
| 84 | uint32_t get_matrix_scan_rate(void); | 92 | uint32_t get_matrix_scan_rate(void); |
| 85 | 93 | ||
