From 3cf7f7322c24e3cab21d402f1a859b60df857603 Mon Sep 17 00:00:00 2001 From: Alex Ong Date: Wed, 29 Aug 2018 10:19:36 +1000 Subject: Removed "debounce_algo = manual" in all keyboards with CUSTOM_MATRIX = yes. --- quantum/matrix.c | 79 +++----------------------------------------------------- 1 file changed, 3 insertions(+), 76 deletions(-) (limited to 'quantum/matrix.c') diff --git a/quantum/matrix.c b/quantum/matrix.c index 3600d4e7b5..bc7eb6b585 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -27,17 +27,6 @@ along with this program. If not, see . #include "timer.h" -/* Set 0 if debouncing isn't needed */ - -#ifndef DEBOUNCING_DELAY -# define DEBOUNCING_DELAY 5 -#endif - -#if (DEBOUNCING_DELAY > 0) - static uint16_t debouncing_time; - static bool debouncing = false; -#endif - #if (MATRIX_COLS <= 8) # define print_matrix_header() print("\nr/c 01234567\n") # define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) @@ -67,8 +56,6 @@ static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - #if (DIODE_DIRECTION == COL2ROW) static void init_cols(void); @@ -122,30 +109,6 @@ uint8_t matrix_cols(void) { return MATRIX_COLS; } -// void matrix_power_up(void) { -// #if (DIODE_DIRECTION == COL2ROW) -// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { -// /* DDRxn */ -// _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF); -// toggle_row(r); -// } -// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { -// /* PORTxn */ -// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF); -// } -// #elif (DIODE_DIRECTION == ROW2COL) -// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { -// /* DDRxn */ -// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF); -// toggle_col(c); -// } -// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { -// /* PORTxn */ -// _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF); -// } -// #endif -// } - void matrix_init(void) { // initialize row and col @@ -160,7 +123,6 @@ void matrix_init(void) { // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; - matrix_debouncing[i] = 0; } matrix_init_quantum(); @@ -170,59 +132,24 @@ uint8_t matrix_scan(void) { #if (DIODE_DIRECTION == COL2ROW) - // Set row, read cols for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { -# if (DEBOUNCING_DELAY > 0) - bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row); - - if (matrix_changed) { - debouncing = true; - debouncing_time = timer_read(); - } - -# else - read_cols_on_row(matrix, current_row); -# endif - + read_cols_on_row(matrix, current_row); } - #elif (DIODE_DIRECTION == ROW2COL) - // Set col, read rows for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { -# if (DEBOUNCING_DELAY > 0) - bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col); - if (matrix_changed) { - debouncing = true; - debouncing_time = timer_read(); - } -# else - read_rows_on_col(matrix, current_col); -# endif - + read_rows_on_col(matrix, current_col); } - #endif -# if (DEBOUNCING_DELAY > 0) - if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = matrix_debouncing[i]; - } - debouncing = false; - } -# endif - matrix_scan_quantum(); return 1; } +//Deprecated. bool matrix_is_modified(void) { -#if (DEBOUNCING_DELAY > 0) - if (debouncing) return false; -#endif return true; } -- cgit v1.2.3 From d0b691df0ee74863ca54ca697aa4d4212cf401a7 Mon Sep 17 00:00:00 2001 From: alex-ong Date: Sat, 26 Jan 2019 17:03:46 +1100 Subject: DO NOT USE - debounce successfully compiled. --- quantum/matrix.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'quantum/matrix.c') diff --git a/quantum/matrix.c b/quantum/matrix.c index 71292db511..8fc4175bde 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -51,9 +51,8 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; #endif /* matrix state(1:on, 0:off) */ -static matrix_row_t raw_matrix[MATRIX_ROWS]; - -static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values +static matrix_row_t matrix[MATRIX_ROWS]; //debounced values #if (DIODE_DIRECTION == COL2ROW) static void init_cols(void); @@ -123,7 +122,7 @@ void matrix_init(void) { raw_matrix[i] = 0; matrix[i] = 0; } - debounce_init(MATRIX_ROWS); + debounce_init(); matrix_init_quantum(); } @@ -144,7 +143,7 @@ uint8_t matrix_scan(void) } #endif - debounce(raw_matrix, matrix, MATRIX_ROWS, changed); + debounce(raw_matrix, matrix, changed); matrix_scan_quantum(); return 1; -- cgit v1.2.3 From 123608fb318a42500d64d29aa46c7d08140033fd Mon Sep 17 00:00:00 2001 From: alex-ong Date: Sat, 26 Jan 2019 17:10:27 +1100 Subject: DO NOT USE Revert back to original API to support split_keyboards. --- quantum/matrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quantum/matrix.c') diff --git a/quantum/matrix.c b/quantum/matrix.c index 8fc4175bde..5b7a0e03b1 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -122,7 +122,7 @@ void matrix_init(void) { raw_matrix[i] = 0; matrix[i] = 0; } - debounce_init(); + debounce_init(MATRIX_ROWS); matrix_init_quantum(); } @@ -143,7 +143,7 @@ uint8_t matrix_scan(void) } #endif - debounce(raw_matrix, matrix, changed); + debounce(raw_matrix, matrix, MATRIX_ROWS, changed); matrix_scan_quantum(); return 1; -- cgit v1.2.3