diff options
-rw-r--r-- | quantum/debounce.h | 4 | ||||
-rw-r--r-- | quantum/debounce/debounce_sym_g.c | 8 | ||||
-rw-r--r-- | quantum/matrix.c | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/quantum/debounce.h b/quantum/debounce.h index 7fe2d693d..34b952ee7 100644 --- a/quantum/debounce.h +++ b/quantum/debounce.h | |||
@@ -16,11 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
16 | 16 | ||
17 | #include "matrix.h" | 17 | #include "matrix.h" |
18 | 18 | ||
19 | void debounce_init(void); //every debounce algorithm will have unique storage needs. | 19 | void debounce_init(uint8_t num_rows); //every debounce algorithm will have unique storage needs. |
20 | 20 | ||
21 | // raw is the current key state | 21 | // raw is the current key state |
22 | // cooked is the debounced input/output key state | 22 | // cooked is the debounced input/output key state |
23 | // changed is true if raw has changed since the last call | 23 | // changed is true if raw has changed since the last call |
24 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed); | 24 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed); |
25 | 25 | ||
26 | bool debounce_active(void); | 26 | bool debounce_active(void); |
diff --git a/quantum/debounce/debounce_sym_g.c b/quantum/debounce/debounce_sym_g.c index c206f2864..4a6996c73 100644 --- a/quantum/debounce/debounce_sym_g.c +++ b/quantum/debounce/debounce_sym_g.c | |||
@@ -26,10 +26,10 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state. | |||
26 | static bool debouncing = false; | 26 | static bool debouncing = false; |
27 | static uint16_t debouncing_time; | 27 | static uint16_t debouncing_time; |
28 | 28 | ||
29 | void debounce_init(void) {} | 29 | void debounce_init(uint8_t num_rows) {} |
30 | 30 | ||
31 | #if DEBOUNCE > 0 | 31 | #if DEBOUNCE > 0 |
32 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) | 32 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) |
33 | { | 33 | { |
34 | if (changed) { | 34 | if (changed) { |
35 | debouncing = true; | 35 | debouncing = true; |
@@ -37,14 +37,14 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) | |||
37 | } | 37 | } |
38 | 38 | ||
39 | if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { | 39 | if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { |
40 | for (int i = 0; i < MATRIX_ROWS; i++) { | 40 | for (int i = 0; i < num_rows; i++) { |
41 | cooked[i] = raw[i]; | 41 | cooked[i] = raw[i]; |
42 | } | 42 | } |
43 | debouncing = false; | 43 | debouncing = false; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | #else //no debouncing. | 46 | #else //no debouncing. |
47 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) | 47 | void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) |
48 | { | 48 | { |
49 | for (int i = 0; i < MATRIX_ROWS; i++) { | 49 | for (int i = 0; i < MATRIX_ROWS; i++) { |
50 | cooked[i] = raw[i]; | 50 | cooked[i] = raw[i]; |
diff --git a/quantum/matrix.c b/quantum/matrix.c index 8fc4175bd..5b7a0e03b 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
@@ -122,7 +122,7 @@ void matrix_init(void) { | |||
122 | raw_matrix[i] = 0; | 122 | raw_matrix[i] = 0; |
123 | matrix[i] = 0; | 123 | matrix[i] = 0; |
124 | } | 124 | } |
125 | debounce_init(); | 125 | debounce_init(MATRIX_ROWS); |
126 | 126 | ||
127 | matrix_init_quantum(); | 127 | matrix_init_quantum(); |
128 | } | 128 | } |
@@ -143,7 +143,7 @@ uint8_t matrix_scan(void) | |||
143 | } | 143 | } |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | debounce(raw_matrix, matrix, changed); | 146 | debounce(raw_matrix, matrix, MATRIX_ROWS, changed); |
147 | 147 | ||
148 | matrix_scan_quantum(); | 148 | matrix_scan_quantum(); |
149 | return 1; | 149 | return 1; |