Make debounce() signal changes in the cooked matrix as return value (#17554)

This commit is contained in:
Stefan Kerkmann 2022-07-07 10:00:40 +02:00 committed by GitHub
parent cca5d35321
commit 8224f62806
Failed to generate hash of commit
13 changed files with 83 additions and 39 deletions

View file

@ -17,13 +17,16 @@
#include "matrix.h"
#include "quantum.h"
#include <stdlib.h>
#include <string.h>
void debounce_init(uint8_t num_rows) {}
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
for (int i = 0; i < num_rows; i++) {
cooked[i] = raw[i];
}
bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
bool cooked_changed = memcmp(raw, cooked, sizeof(matrix_row_t) * num_rows) != 0;
memcpy(cooked, raw, sizeof(matrix_row_t) * num_rows);
return cooked_changed;
}
void debounce_free(void) {}