diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2023-04-03 10:33:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 18:33:45 +1000 |
commit | fcf8b804ed95a98561bd4c1d6c85604be0f7cc7b (patch) | |
tree | 6b6917d99ced027d614e7b461e1cd1939833a9cd /keyboards/custommk/genesis/rev2 | |
parent | 2d9140af53e4e5bbc5cd50a2b6f3eda20ed8f71e (diff) |
[Core] Refactor `keyevent_t` for 1ms timing resolution (#15847)
Diffstat (limited to 'keyboards/custommk/genesis/rev2')
-rw-r--r-- | keyboards/custommk/genesis/rev2/keymaps/via/keymap.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c b/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c index eb0f7772cf..f6a3c936df 100644 --- a/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c +++ b/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c @@ -95,46 +95,50 @@ void keyboard_post_init_user(void) { keyevent_t encoder_left_ccw = { .key = (keypos_t){.row = 5, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_left_cw = { .key = (keypos_t){.row = 5, .col = 1}, .pressed = false + .type = KEY_EVENT }; keyevent_t encoder_right_ccw = { .key = (keypos_t){.row = 5, .col = 2}, .pressed = false + .type = KEY_EVENT }; keyevent_t encoder_right_cw = { .key = (keypos_t){.row = 5, .col = 3}, .pressed = false + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder_left_ccw)) { encoder_left_ccw.pressed = false; - encoder_left_ccw.time = (timer_read() | 1); + encoder_left_ccw.time = timer_read(); action_exec(encoder_left_ccw); } if (IS_PRESSED(encoder_left_cw)) { encoder_left_cw.pressed = false; - encoder_left_cw.time = (timer_read() | 1); + encoder_left_cw.time = timer_read(); action_exec(encoder_left_cw); } if (IS_PRESSED(encoder_right_ccw)) { encoder_right_ccw.pressed = false; - encoder_right_ccw.time = (timer_read() | 1); + encoder_right_ccw.time = timer_read(); action_exec(encoder_right_ccw); } if (IS_PRESSED(encoder_right_cw)) { encoder_right_cw.pressed = false; - encoder_right_cw.time = (timer_read() | 1); + encoder_right_cw.time = timer_read(); action_exec(encoder_right_cw); } @@ -145,21 +149,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { encoder_left_cw.pressed = true; - encoder_left_cw.time = (timer_read() | 1); + encoder_left_cw.time = timer_read(); action_exec(encoder_left_cw); } else { encoder_left_ccw.pressed = true; - encoder_left_ccw.time = (timer_read() | 1); + encoder_left_ccw.time = timer_read(); action_exec(encoder_left_ccw); } } else { if (clockwise) { encoder_right_cw.pressed = true; - encoder_right_cw.time = (timer_read() | 1); + encoder_right_cw.time = timer_read(); action_exec(encoder_right_cw); } else { encoder_right_ccw.pressed = true; - encoder_right_ccw.time = (timer_read() | 1); + encoder_right_ccw.time = timer_read(); action_exec(encoder_right_ccw); } } |