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 | |
parent | 2d9140af53e4e5bbc5cd50a2b6f3eda20ed8f71e (diff) |
[Core] Refactor `keyevent_t` for 1ms timing resolution (#15847)
Diffstat (limited to 'keyboards/custommk')
-rw-r--r-- | keyboards/custommk/evo70/keymaps/via/keymap.c | 16 | ||||
-rw-r--r-- | keyboards/custommk/genesis/rev2/keymaps/via/keymap.c | 22 |
2 files changed, 22 insertions, 16 deletions
diff --git a/keyboards/custommk/evo70/keymaps/via/keymap.c b/keyboards/custommk/evo70/keymaps/via/keymap.c index 74f68590cf..ba0d231118 100644 --- a/keyboards/custommk/evo70/keymaps/via/keymap.c +++ b/keyboards/custommk/evo70/keymaps/via/keymap.c @@ -57,12 +57,14 @@ void set_custom_encoder_mode_user(bool custom_mode) { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 4, .col = 7}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 4, .col = 10}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; @@ -70,12 +72,12 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (custom_encoder_mode) { if (clockwise) { encoder_cw.pressed = true; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); } else { encoder_ccw.pressed = true; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); } return false; @@ -86,13 +88,13 @@ bool encoder_update_user(uint8_t index, bool clockwise) { void matrix_scan_user(void) { if (IS_PRESSED(encoder_ccw)) { encoder_ccw.pressed = false; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); } if (IS_PRESSED(encoder_cw)) { encoder_cw.pressed = false; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); } -}
\ No newline at end of file +} 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); } } |