diff options
Diffstat (limited to 'quantum/debounce/sym_defer_g.c')
| -rw-r--r-- | quantum/debounce/sym_defer_g.c | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c index 47450992a4..d04310a761 100644 --- a/quantum/debounce/sym_defer_g.c +++ b/quantum/debounce/sym_defer_g.c @@ -20,6 +20,7 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.  #include "matrix.h"  #include "timer.h"  #include "quantum.h" +#include <string.h>  #ifndef DEBOUNCE  #    define DEBOUNCE 5  #endif @@ -30,18 +31,23 @@ static fast_timer_t debouncing_time;  void debounce_init(uint8_t num_rows) {} -void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { +bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { +    bool cooked_changed = false; +      if (changed) {          debouncing      = true;          debouncing_time = timer_read_fast();      }      if (debouncing && timer_elapsed_fast(debouncing_time) >= DEBOUNCE) { -        for (int i = 0; i < num_rows; i++) { -            cooked[i] = raw[i]; +        if (memcmp(cooked, raw, sizeof(matrix_row_t) * num_rows) != 0) { +            memcpy(cooked, raw, sizeof(matrix_row_t) * num_rows); +            cooked_changed = true;          }          debouncing = false;      } + +    return cooked_changed;  }  void debounce_free(void) {} | 
