1
0
Fork 0

[Core] Refactor keyevent_t for 1ms timing resolution (#15847)

This commit is contained in:
Stefan Kerkmann 2023-04-03 10:33:45 +02:00 committed by GitHub
parent 2d9140af53
commit fcf8b804ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 360 additions and 273 deletions

View file

@ -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;