From 1f125e1c9bed5dfb9a91f98c6db5750b34a45941 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 11 Aug 2014 17:55:04 +0900 Subject: [PATCH] Improve debouncing algorithm --- keyboard/tentapad/matrix.c | 40 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/keyboard/tentapad/matrix.c b/keyboard/tentapad/matrix.c index 438b8c41..939afee5 100644 --- a/keyboard/tentapad/matrix.c +++ b/keyboard/tentapad/matrix.c @@ -92,39 +92,21 @@ uint8_t matrix_scan(void) { matrix_row_t cols = read_cols(); for (uint8_t col = 0; col < MATRIX_COLS; col++) { - if ((cols & (1< DEBOUNCE) { - // released + if (debouncing & (1< DEBOUNCE) { + debouncing &= ~(1< DEBOUNCE) { - // released - matrix &= ~(1<