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

@ -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) {

View file

@ -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) {