Make debounce() signal changes in the cooked matrix as return value (#17554)
This commit is contained in:
parent
cca5d35321
commit
8224f62806
13 changed files with 83 additions and 39 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue