summaryrefslogtreecommitdiff
path: root/quantum/debounce/none.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/debounce/none.c')
-rw-r--r--quantum/debounce/none.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c
index 1b8b1dc13a..0a8ccfc4ee 100644
--- a/quantum/debounce/none.c
+++ b/quantum/debounce/none.c
@@ -20,9 +20,15 @@
void debounce_init(uint8_t num_rows) {}
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;
+ bool cooked_changed = false;
- memcpy(cooked, raw, sizeof(matrix_row_t) * num_rows);
+ if (changed) {
+ size_t matrix_size = num_rows * sizeof(matrix_row_t);
+ if (memcmp(cooked, raw, matrix_size) != 0) {
+ memcpy(cooked, raw, matrix_size);
+ cooked_changed = true;
+ }
+ }
return cooked_changed;
}