diff options
Diffstat (limited to 'keyboards')
41 files changed, 252 insertions, 180 deletions
diff --git a/keyboards/atlantis/encoder_actions.c b/keyboards/atlantis/encoder_actions.c index 5bfba6d99f..126b665a8e 100644 --- a/keyboards/atlantis/encoder_actions.c +++ b/keyboards/atlantis/encoder_actions.c @@ -28,7 +28,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -40,7 +41,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); 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); } } diff --git a/keyboards/dailycraft/owl8/keymaps/via/keymap.c b/keyboards/dailycraft/owl8/keymaps/via/keymap.c index 6e3f6ea90b..667392b946 100644 --- a/keyboards/dailycraft/owl8/keymaps/via/keymap.c +++ b/keyboards/dailycraft/owl8/keymaps/via/keymap.c @@ -52,46 +52,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 0, .col = 12}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 0, .col = 13}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 0, .col = 14}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 0, .col = 15}, - .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); } } @@ -100,21 +104,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ 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); } } diff --git a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c index 602d3fb10d..30d8ad188e 100644 --- a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c +++ b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c @@ -44,46 +44,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 0, .col = 4}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 0, .col = 5}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 0, .col = 6}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 0, .col = 7}, - .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); } } @@ -92,21 +96,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ 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); } } 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); } } diff --git a/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c index 42b2204cf1..81f7b8665f 100644 --- a/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c +++ b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c @@ -111,7 +111,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { key.row = 1; key.col = 0; } - action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); - action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + action_exec(MAKE_KEYEVENT(key.row, key.col, true)); + action_exec(MAKE_KEYEVENT(key.row, key.col, false)); return true; } diff --git a/keyboards/gl516/n51gl/keymaps/via/keymap.c b/keyboards/gl516/n51gl/keymaps/via/keymap.c index a44392124c..cf1aa7d595 100644 --- a/keyboards/gl516/n51gl/keymaps/via/keymap.c +++ b/keyboards/gl516/n51gl/keymaps/via/keymap.c @@ -96,7 +96,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { key.row = 1; key.col = 0; } - action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); - action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + action_exec(MAKE_KEYEVENT(key.row, key.col, true)); + action_exec(MAKE_KEYEVENT(key.row, key.col, false)); return true; } diff --git a/keyboards/jones/v1/keymaps/via/keymap.c b/keyboards/jones/v1/keymaps/via/keymap.c index 3304b13700..3b41c40174 100644 --- a/keyboards/jones/v1/keymaps/via/keymap.c +++ b/keyboards/jones/v1/keymaps/via/keymap.c @@ -178,7 +178,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -190,7 +191,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/kabedon/kabedon98e/kabedon98e.c b/keyboards/kabedon/kabedon98e/kabedon98e.c index 7ca156eab9..6984790006 100644 --- a/keyboards/kabedon/kabedon98e/kabedon98e.c +++ b/keyboards/kabedon/kabedon98e/kabedon98e.c @@ -25,7 +25,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -37,7 +38,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/keebio/encoder_actions.c b/keyboards/keebio/encoder_actions.c index ead941469a..b02881de5f 100644 --- a/keyboards/keebio/encoder_actions.c +++ b/keyboards/keebio/encoder_actions.c @@ -28,7 +28,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -40,7 +41,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/meletrix/zoom65/zoom65.c b/keyboards/meletrix/zoom65/zoom65.c index ff27a4442f..7e8c6511bb 100644 --- a/keyboards/meletrix/zoom65/zoom65.c +++ b/keyboards/meletrix/zoom65/zoom65.c @@ -30,7 +30,9 @@ void encoder_action_unregister(void) keyevent_t encoder_event = (keyevent_t){ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = 0; action_exec(encoder_event); } @@ -41,7 +43,9 @@ void encoder_action_register(uint8_t index, bool clockwise) keyevent_t encoder_event = (keyevent_t){ .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } diff --git a/keyboards/meletrix/zoom65_lite/keymaps/via/keymap.c b/keyboards/meletrix/zoom65_lite/keymaps/via/keymap.c index 23729b4349..4adfaba69d 100644 --- a/keyboards/meletrix/zoom65_lite/keymaps/via/keymap.c +++ b/keyboards/meletrix/zoom65_lite/keymaps/via/keymap.c @@ -29,7 +29,9 @@ void encoder_action_unregister(void) keyevent_t encoder_event = (keyevent_t){ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = 0; action_exec(encoder_event); } @@ -40,7 +42,9 @@ void encoder_action_register(uint8_t index, bool clockwise) keyevent_t encoder_event = (keyevent_t){ .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } diff --git a/keyboards/ml/gas75/keymaps/via/keymap.c b/keyboards/ml/gas75/keymaps/via/keymap.c index b5e3055427..615e36557a 100644 --- a/keyboards/ml/gas75/keymaps/via/keymap.c +++ b/keyboards/ml/gas75/keymaps/via/keymap.c @@ -169,7 +169,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -181,7 +182,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/monarch/keymaps/via/keymap.c b/keyboards/monarch/keymaps/via/keymap.c index b1b86aa015..9fded17e9e 100644 --- a/keyboards/monarch/keymaps/via/keymap.c +++ b/keyboards/monarch/keymaps/via/keymap.c @@ -54,24 +54,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 5, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 5, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; 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); } } @@ -79,11 +81,11 @@ void matrix_scan_user(void) { bool encoder_update_user(uint8_t index, bool clockwise) { 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 true; diff --git a/keyboards/mwstudio/alicekk/keymaps/via/keymap.c b/keyboards/mwstudio/alicekk/keymaps/via/keymap.c index 6c21e053fa..92e893d5c5 100644 --- a/keyboards/mwstudio/alicekk/keymaps/via/keymap.c +++ b/keyboards/mwstudio/alicekk/keymaps/via/keymap.c @@ -63,7 +63,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -75,7 +76,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c b/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c index 7b7e1877f5..633629abc7 100644 --- a/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c +++ b/keyboards/mwstudio/mw75r2/keymaps/via/keymap.c @@ -115,7 +115,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -127,7 +128,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/nightly_boards/adellein/encoder_action.c b/keyboards/nightly_boards/adellein/encoder_action.c index 6b553d3969..522fb58d5a 100644 --- a/keyboards/nightly_boards/adellein/encoder_action.c +++ b/keyboards/nightly_boards/adellein/encoder_action.c @@ -26,7 +26,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -38,7 +39,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/nightly_boards/n40_o/encoder_action.c b/keyboards/nightly_boards/n40_o/encoder_action.c index 6b553d3969..522fb58d5a 100644 --- a/keyboards/nightly_boards/n40_o/encoder_action.c +++ b/keyboards/nightly_boards/n40_o/encoder_action.c @@ -26,7 +26,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -38,7 +39,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/nightly_boards/n60_s/encoder_action.c b/keyboards/nightly_boards/n60_s/encoder_action.c index 6b553d3969..522fb58d5a 100644 --- a/keyboards/nightly_boards/n60_s/encoder_action.c +++ b/keyboards/nightly_boards/n60_s/encoder_action.c @@ -26,7 +26,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -38,7 +39,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/nightly_boards/octopad/encoder_action.c b/keyboards/nightly_boards/octopad/encoder_action.c index 6b553d3969..522fb58d5a 100644 --- a/keyboards/nightly_boards/octopad/encoder_action.c +++ b/keyboards/nightly_boards/octopad/encoder_action.c @@ -26,7 +26,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -38,7 +39,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/nullbitsco/tidbit/tidbit.c b/keyboards/nullbitsco/tidbit/tidbit.c index 356c580342..d07ba12651 100644 --- a/keyboards/nullbitsco/tidbit/tidbit.c +++ b/keyboards/nullbitsco/tidbit/tidbit.c @@ -85,15 +85,11 @@ bool oled_task_kb(void) { #endif static void process_encoder_matrix(encodermap_t pos) { - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, true)); #if TAP_CODE_DELAY > 0 wait_ms(TAP_CODE_DELAY); #endif - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, false)); } bool encoder_update_kb(uint8_t index, bool clockwise) { diff --git a/keyboards/rate/pistachio_mp/keymaps/via/keymap.c b/keyboards/rate/pistachio_mp/keymaps/via/keymap.c index 293da4f569..bee139ac93 100644 --- a/keyboards/rate/pistachio_mp/keymaps/via/keymap.c +++ b/keyboards/rate/pistachio_mp/keymaps/via/keymap.c @@ -87,7 +87,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state >> 1 ? ENC_CW : ENC_CCW, .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state = 0; action_exec(encoder_event); @@ -99,7 +100,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? ENC_CW : ENC_CCW, .pressed = true, - .time = (timer_read() | 1) + .time = timer_read() + .type = KEY_EVENT }; encoder_state = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/rate/pistachio_pro/keymaps/via/keymap.c b/keyboards/rate/pistachio_pro/keymaps/via/keymap.c index 3e390d442f..b5b8e3c440 100644 --- a/keyboards/rate/pistachio_pro/keymaps/via/keymap.c +++ b/keyboards/rate/pistachio_pro/keymaps/via/keymap.c @@ -135,7 +135,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state >> 1 ? ENC_CW : ENC_CCW, .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state = 0; action_exec(encoder_event); @@ -146,7 +147,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? ENC_CW : ENC_CCW, .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/rgbkb/mun/rev1/rev1.c b/keyboards/rgbkb/mun/rev1/rev1.c index c7604510da..564ce4dfb9 100644 --- a/keyboards/rgbkb/mun/rev1/rev1.c +++ b/keyboards/rgbkb/mun/rev1/rev1.c @@ -37,15 +37,11 @@ const encodermap_t touch_encoder_map[NUMBER_OF_TOUCH_ENCODERS][TOUCH_ENCODER_OPT }; static void process_encoder_matrix(encodermap_t pos) { - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, true)); #if TAP_CODE_DELAY > 0 wait_ms(TAP_CODE_DELAY); #endif - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, false)); } bool encoder_update_kb(uint8_t index, bool clockwise) { diff --git a/keyboards/rgbkb/sol3/rev1/rev1.c b/keyboards/rgbkb/sol3/rev1/rev1.c index de5836e061..ff330a83d6 100644 --- a/keyboards/rgbkb/sol3/rev1/rev1.c +++ b/keyboards/rgbkb/sol3/rev1/rev1.c @@ -57,10 +57,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } case 1: { // Handle RGB Encoder switch press - action_exec((keyevent_t){ - .key = (keypos_t){.row = isLeftHand ? 4 : 10, .col = 6}, - .pressed = active, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(isLeftHand ? 4 : 10, 6, active)); break; } } @@ -68,15 +65,11 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } static void process_encoder_matrix(encodermap_t pos) { - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, true)); #if TAP_CODE_DELAY > 0 wait_ms(TAP_CODE_DELAY); #endif - action_exec((keyevent_t){ - .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */ - }); + action_exec(MAKE_KEYEVENT(pos.r, pos.c, false)); } bool encoder_update_kb(uint8_t index, bool clockwise) { diff --git a/keyboards/rmi_kb/chevron/keymaps/via/keymap.c b/keyboards/rmi_kb/chevron/keymaps/via/keymap.c index 190a39e257..4dd5f34817 100644 --- a/keyboards/rmi_kb/chevron/keymaps/via/keymap.c +++ b/keyboards/rmi_kb/chevron/keymaps/via/keymap.c @@ -48,24 +48,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 4, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 4, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; 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); } } @@ -73,12 +75,12 @@ void matrix_scan_user(void) { bool encoder_update_user(uint8_t index, bool clockwise) { if (clockwise) { encoder_cw.pressed = true; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); wait_ms(20); } else { encoder_ccw.pressed = true; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); wait_ms(20); } diff --git a/keyboards/rmi_kb/herringbone/pro/keymaps/via/keymap.c b/keyboards/rmi_kb/herringbone/pro/keymaps/via/keymap.c index 71622cddcf..fa85436e48 100644 --- a/keyboards/rmi_kb/herringbone/pro/keymaps/via/keymap.c +++ b/keyboards/rmi_kb/herringbone/pro/keymaps/via/keymap.c @@ -54,24 +54,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 6, .col = 0}, - .pressed = false -}; + .pressed = false, + .type = KEY_EVENT + }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 6, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; 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); } } @@ -86,14 +88,14 @@ uint8_t current_frame = 0; bool encoder_update_user(uint8_t index, bool clockwise) { if (clockwise) { encoder_cw.pressed = true; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); wait_ms(20); anim_sleep = timer_read32(); oled_on(); } else { encoder_ccw.pressed = true; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); wait_ms(20); anim_sleep = timer_read32(); diff --git a/keyboards/rmi_kb/squishytkl/keymaps/via/keymap.c b/keyboards/rmi_kb/squishytkl/keymaps/via/keymap.c index 7bd524f9d9..825b11c95d 100644 --- a/keyboards/rmi_kb/squishytkl/keymaps/via/keymap.c +++ b/keyboards/rmi_kb/squishytkl/keymaps/via/keymap.c @@ -29,24 +29,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 13, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 13, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; 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); } } @@ -54,11 +56,11 @@ void matrix_scan_user(void) { bool encoder_update_user(uint8_t index, bool clockwise) { 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 true; diff --git a/keyboards/rmi_kb/wete/v2/keymaps/via/keymap.c b/keyboards/rmi_kb/wete/v2/keymaps/via/keymap.c index 8afc6f9c25..1feb3d4686 100644 --- a/keyboards/rmi_kb/wete/v2/keymaps/via/keymap.c +++ b/keyboards/rmi_kb/wete/v2/keymaps/via/keymap.c @@ -37,24 +37,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 12, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 12, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; 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); } } @@ -62,11 +64,11 @@ void matrix_scan_user(void) { bool encoder_update_user(uint8_t index, bool clockwise) { 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 true; diff --git a/keyboards/sawnsprojects/krush/krush65/hotswap/encoder_actions.c b/keyboards/sawnsprojects/krush/krush65/hotswap/encoder_actions.c index 8a91dde19a..96fcc9a614 100644 --- a/keyboards/sawnsprojects/krush/krush65/hotswap/encoder_actions.c +++ b/keyboards/sawnsprojects/krush/krush65/hotswap/encoder_actions.c @@ -30,7 +30,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -42,10 +43,11 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } -#endif
\ No newline at end of file +#endif diff --git a/keyboards/sofle/keymaps/keyhive_via/encoder.c b/keyboards/sofle/keymaps/keyhive_via/encoder.c index 0883c4a48a..7775cb7b86 100644 --- a/keyboards/sofle/keymaps/keyhive_via/encoder.c +++ b/keyboards/sofle/keymaps/keyhive_via/encoder.c @@ -26,7 +26,7 @@ void encoder_action_unregister(void) { for (int index = 0; index < 2; ++index) { if (encoder_state[index]) { - keyevent_t encoder_event = (keyevent_t){.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, .time = (timer_read() | 1)}; + keyevent_t encoder_event = (keyevent_t){.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, .time = timer_read(), .type = KEY_EVENT}; encoder_state[index] = 0; action_exec(encoder_event); } @@ -34,7 +34,7 @@ } void encoder_action_register(uint8_t index, bool clockwise) { - keyevent_t encoder_event = (keyevent_t){.key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, .time = (timer_read() | 1)}; + keyevent_t encoder_event = (keyevent_t){.key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, .time = timer_read(), .type = KEY_EVENT}; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } @@ -46,4 +46,3 @@ return false; }; #endif - diff --git a/keyboards/stello65/beta/encoder_actions.c b/keyboards/stello65/beta/encoder_actions.c index 72970a2ffc..87a53676e6 100644 --- a/keyboards/stello65/beta/encoder_actions.c +++ b/keyboards/stello65/beta/encoder_actions.c @@ -29,7 +29,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -41,7 +42,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/synthlabs/solo/keymaps/via/keymap.c b/keyboards/synthlabs/solo/keymaps/via/keymap.c index c6634c42d4..84f99df9ab 100644 --- a/keyboards/synthlabs/solo/keymaps/via/keymap.c +++ b/keyboards/synthlabs/solo/keymaps/via/keymap.c @@ -37,7 +37,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -49,7 +50,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/takashicompany/spreadwriter/keymaps/via/keymap.c b/keyboards/takashicompany/spreadwriter/keymaps/via/keymap.c index e04c1fea0d..c0d4a0003d 100644 --- a/keyboards/takashicompany/spreadwriter/keymaps/via/keymap.c +++ b/keyboards/takashicompany/spreadwriter/keymaps/via/keymap.c @@ -98,7 +98,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -110,7 +111,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); @@ -124,4 +126,4 @@ void matrix_scan_kb(void) { bool encoder_update_user(uint8_t index, bool clockwise) { encoder_action_register(index, clockwise); return true; -};
\ No newline at end of file +}; diff --git a/keyboards/wekey/we27/encoder_actions.c b/keyboards/wekey/we27/encoder_actions.c index 72970a2ffc..87a53676e6 100644 --- a/keyboards/wekey/we27/encoder_actions.c +++ b/keyboards/wekey/we27/encoder_actions.c @@ -29,7 +29,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -41,7 +42,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/winry/winry315/keymaps/via/encoder_actions.c b/keyboards/winry/winry315/keymaps/via/encoder_actions.c index 9a9092effd..d24d13bb26 100644 --- a/keyboards/winry/winry315/keymaps/via/encoder_actions.c +++ b/keyboards/winry/winry315/keymaps/via/encoder_actions.c @@ -37,7 +37,8 @@ static void exec_encoder_action(uint8_t index, bool clockwise, bool pressed) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = pressed, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; // clang-format on action_exec(encoder_event); diff --git a/keyboards/wuque/mammoth20x/mammoth20x.c b/keyboards/wuque/mammoth20x/mammoth20x.c index 6cc1dee21a..4619ef5dde 100644 --- a/keyboards/wuque/mammoth20x/mammoth20x.c +++ b/keyboards/wuque/mammoth20x/mammoth20x.c @@ -30,7 +30,9 @@ void encoder_action_unregister(void) keyevent_t encoder_event = (keyevent_t){ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = 0; action_exec(encoder_event); } @@ -41,7 +43,9 @@ void encoder_action_register(uint8_t index, bool clockwise) keyevent_t encoder_event = (keyevent_t){ .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } diff --git a/keyboards/wuque/mammoth75x/mammoth75x.c b/keyboards/wuque/mammoth75x/mammoth75x.c index c2bf2bbe37..9452195752 100644 --- a/keyboards/wuque/mammoth75x/mammoth75x.c +++ b/keyboards/wuque/mammoth75x/mammoth75x.c @@ -30,7 +30,9 @@ void encoder_action_unregister(void) keyevent_t encoder_event = (keyevent_t){ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = 0; action_exec(encoder_event); } @@ -41,7 +43,9 @@ void encoder_action_register(uint8_t index, bool clockwise) keyevent_t encoder_event = (keyevent_t){ .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } @@ -64,4 +68,3 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { return true; } #endif - diff --git a/keyboards/wuque/serneity65/serneity65.c b/keyboards/wuque/serneity65/serneity65.c index 1222722b4b..ff03a3ca5f 100644 --- a/keyboards/wuque/serneity65/serneity65.c +++ b/keyboards/wuque/serneity65/serneity65.c @@ -30,7 +30,9 @@ void encoder_action_unregister(void) keyevent_t encoder_event = (keyevent_t){ .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = 0; action_exec(encoder_event); } @@ -41,7 +43,9 @@ void encoder_action_register(uint8_t index, bool clockwise) keyevent_t encoder_event = (keyevent_t){ .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1)}; + .time = timer_read(), + .type = KEY_EVENT + }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); } diff --git a/keyboards/yandrstudio/nz67v2/keymaps/via/keymap.c b/keyboards/yandrstudio/nz67v2/keymaps/via/keymap.c index 3da37b5315..ed5075636a 100644 --- a/keyboards/yandrstudio/nz67v2/keymaps/via/keymap.c +++ b/keyboards/yandrstudio/nz67v2/keymaps/via/keymap.c @@ -43,20 +43,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) }; #ifdef ENCODER_ENABLE -keyevent_t encoder1_ccw = {.key = (keypos_t){.row = 4, .col = 4}, .pressed = false}; +keyevent_t encoder1_ccw = {.key = (keypos_t){.row = 4, .col = 4}, .pressed = false, .type = KEY_EVENT}; -keyevent_t encoder1_cw = {.key = (keypos_t){.row = 4, .col = 6}, .pressed = false}; +keyevent_t encoder1_cw = {.key = (keypos_t){.row = 4, .col = 6}, .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); } } @@ -64,11 +64,11 @@ void matrix_scan_user(void) { bool encoder_update_user(uint8_t index, bool clockwise) { 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); } return true; |