From 8224f62806b66f0825b68fd8c00436ee57a28e9a Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Thu, 7 Jul 2022 10:00:40 +0200 Subject: Make debounce() signal changes in the cooked matrix as return value (#17554) --- quantum/debounce/none.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'quantum/debounce/none.c') diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c index 8a85cc04a8..4cff5e05e2 100644 --- a/quantum/debounce/none.c +++ b/quantum/debounce/none.c @@ -17,13 +17,16 @@ #include "matrix.h" #include "quantum.h" #include +#include 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) {} -- cgit v1.2.3