From fcf8b804ed95a98561bd4c1d6c85604be0f7cc7b Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Mon, 3 Apr 2023 10:33:45 +0200 Subject: [Core] Refactor `keyevent_t` for 1ms timing resolution (#15847) --- .../dailycraft/wings42/rev2/keymaps/via/keymap.c | 56 ++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'keyboards/dailycraft/wings42/rev2') diff --git a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c index 97f94366a8..5655d2ca48 100644 --- a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c +++ b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c @@ -82,91 +82,99 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 4, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 4, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 4, .col = 2}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 4, .col = 3}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder3_ccw = { .key = (keypos_t){.row = 9, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder3_cw = { .key = (keypos_t){.row = 9, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder4_ccw = { .key = (keypos_t){.row = 9, .col = 3}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder4_cw = { .key = (keypos_t){.row = 9, .col = 2}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder1_ccw)) { encoder1_ccw.pressed = false; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } if (IS_PRESSED(encoder1_cw)) { encoder1_cw.pressed = false; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } if (IS_PRESSED(encoder2_ccw)) { encoder2_ccw.pressed = false; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } if (IS_PRESSED(encoder2_cw)) { encoder2_cw.pressed = false; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } if (IS_PRESSED(encoder3_ccw)) { encoder3_ccw.pressed = false; - encoder3_ccw.time = (timer_read() | 1); + encoder3_ccw.time = timer_read(); action_exec(encoder3_ccw); } if (IS_PRESSED(encoder3_cw)) { encoder3_cw.pressed = false; - encoder3_cw.time = (timer_read() | 1); + encoder3_cw.time = timer_read(); action_exec(encoder3_cw); } if (IS_PRESSED(encoder4_ccw)) { encoder4_ccw.pressed = false; - encoder4_ccw.time = (timer_read() | 1); + encoder4_ccw.time = timer_read(); action_exec(encoder4_ccw); } if (IS_PRESSED(encoder4_cw)) { encoder4_cw.pressed = false; - encoder4_cw.time = (timer_read() | 1); + encoder4_cw.time = timer_read(); action_exec(encoder4_cw); } } @@ -175,41 +183,41 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { encoder1_cw.pressed = true; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } else { encoder1_ccw.pressed = true; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } } else if (index == 1) { if (clockwise) { encoder2_cw.pressed = true; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } else { encoder2_ccw.pressed = true; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } } else if (index == 2) { if (clockwise) { encoder3_cw.pressed = true; - encoder3_cw.time = (timer_read() | 1); + encoder3_cw.time = timer_read(); action_exec(encoder3_cw); } else { encoder3_ccw.pressed = true; - encoder3_ccw.time = (timer_read() | 1); + encoder3_ccw.time = timer_read(); action_exec(encoder3_ccw); } } else if (index == 3) { if (clockwise) { encoder4_cw.pressed = true; - encoder4_cw.time = (timer_read() | 1); + encoder4_cw.time = timer_read(); action_exec(encoder4_cw); } else { encoder4_ccw.pressed = true; - encoder4_ccw.time = (timer_read() | 1); + encoder4_ccw.time = timer_read(); action_exec(encoder4_ccw); } } -- cgit v1.2.3