From 2795b7a0a30c351a85f17cb4c0b414297e096282 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 27 Mar 2013 17:15:06 +0900 Subject: Fix debouncing on gh60, hbkb, macway --- keyboard/gh60/matrix.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'keyboard/gh60') diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c index 3ba6801fbf..a2bd70e4b7 100644 --- a/keyboard/gh60/matrix.c +++ b/keyboard/gh60/matrix.c @@ -34,10 +34,8 @@ along with this program. If not, see . static uint8_t debouncing = DEBOUNCE; /* matrix state(1:on, 0:off) */ -static matrix_row_t *matrix; -static matrix_row_t *matrix_debouncing; -static matrix_row_t matrix0[MATRIX_ROWS]; -static matrix_row_t matrix1[MATRIX_ROWS]; +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static matrix_row_t read_cols(void); static void init_cols(void); @@ -64,8 +62,6 @@ void matrix_init(void) init_cols(); // initialize matrix state: all keys off - matrix = matrix0; - matrix_debouncing = matrix1; for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; @@ -92,9 +88,9 @@ uint8_t matrix_scan(void) if (--debouncing) { _delay_ms(1); } else { - matrix_row_t *tmp = matrix; - matrix = matrix_debouncing; - matrix_debouncing = tmp; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } } } -- cgit v1.2.1