diff options
Diffstat (limited to 'quantum/debounce/sym_defer_pr.c')
-rw-r--r-- | quantum/debounce/sym_defer_pr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/quantum/debounce/sym_defer_pr.c b/quantum/debounce/sym_defer_pr.c index ce24f0922f..452c4599d0 100644 --- a/quantum/debounce/sym_defer_pr.c +++ b/quantum/debounce/sym_defer_pr.c @@ -46,11 +46,12 @@ void debounce_free(void) { last_raw = NULL; } -void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { - uint16_t now = timer_read(); - uint16_t elapsed16 = TIMER_DIFF_16(now, last_time); - last_time = now; - uint8_t elapsed = (elapsed16 > 255) ? 255 : elapsed16; +bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { + uint16_t now = timer_read(); + uint16_t elapsed16 = TIMER_DIFF_16(now, last_time); + last_time = now; + uint8_t elapsed = (elapsed16 > 255) ? 255 : elapsed16; + bool cooked_changed = false; uint8_t* countdown = countdowns; @@ -63,10 +64,13 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool } else if (*countdown > elapsed) { *countdown -= elapsed; } else if (*countdown) { + cooked_changed |= cooked[row] ^ raw_row; cooked[row] = raw_row; *countdown = 0; } } + + return cooked_changed; } bool debounce_active(void) { |