Skip to content

Commit

Permalink
[Core] Refactor keyevent_t for 1ms timing resolution (qmk#15847)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpskenn committed Nov 4, 2023
1 parent 4dc463b commit 68c9524
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions keyboards/nora/v031/v031.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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);
Expand All @@ -155,7 +156,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);
Expand Down
6 changes: 4 additions & 2 deletions keyboards/nora/v1/v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,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);
Expand All @@ -139,7 +140,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);
Expand Down

0 comments on commit 68c9524

Please sign in to comment.