diff options
author | Eric Tang <e_l_tang@outlook.com> | 2016-05-24 08:44:40 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-05-24 11:44:40 -0400 |
commit | 1ae6011cef2230826a9e6db6c5b638677bc640b7 (patch) | |
tree | d101c5495b8d9c0dde776d9f7d90f7aa7038483a | |
parent | 897f5b2f9d430b780149b46ba113a3fc61483b54 (diff) | |
download | qmk_firmware-1ae6011cef2230826a9e6db6c5b638677bc640b7.tar.gz qmk_firmware-1ae6011cef2230826a9e6db6c5b638677bc640b7.zip |
Clean up #343's code (#348)
-rw-r--r-- | quantum/matrix.c | 4 | ||||
-rw-r--r-- | tmk_core/common/keyboard.c | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c index 22126aa7a..d5fd7def8 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
@@ -37,10 +37,8 @@ static const io_pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | |||
37 | /* matrix state */ | 37 | /* matrix state */ |
38 | #if DIODE_DIRECTION == COL2ROW | 38 | #if DIODE_DIRECTION == COL2ROW |
39 | static matrix_row_t matrix[MATRIX_ROWS]; | 39 | static matrix_row_t matrix[MATRIX_ROWS]; |
40 | static matrix_row_t debouncing_matrix[MATRIX_ROWS]; | ||
41 | #else | 40 | #else |
42 | static matrix_col_t matrix[MATRIX_COLS]; | 41 | static matrix_col_t matrix[MATRIX_COLS]; |
43 | static matrix_col_t debouncing_matrix[MATRIX_COLS]; | ||
44 | #endif | 42 | #endif |
45 | static int8_t debouncing_delay = -1; | 43 | static int8_t debouncing_delay = -1; |
46 | 44 | ||
@@ -99,6 +97,7 @@ void matrix_init(void) { | |||
99 | 97 | ||
100 | #if DIODE_DIRECTION == COL2ROW | 98 | #if DIODE_DIRECTION == COL2ROW |
101 | uint8_t matrix_scan(void) { | 99 | uint8_t matrix_scan(void) { |
100 | static matrix_row_t debouncing_matrix[MATRIX_ROWS]; | ||
102 | for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { | 101 | for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { |
103 | toggle_row(r); | 102 | toggle_row(r); |
104 | matrix_row_t state = read_cols(); | 103 | matrix_row_t state = read_cols(); |
@@ -146,6 +145,7 @@ matrix_row_t matrix_get_row(uint8_t row) { | |||
146 | 145 | ||
147 | #else | 146 | #else |
148 | uint8_t matrix_scan(void) { | 147 | uint8_t matrix_scan(void) { |
148 | static matrix_col_t debouncing_matrix[MATRIX_COLS]; | ||
149 | for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { | 149 | for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { |
150 | toggle_col(c); | 150 | toggle_col(c); |
151 | matrix_col_t state = read_rows(); | 151 | matrix_col_t state = read_rows(); |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index c6d54ae33..bd543c45e 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
@@ -96,17 +96,15 @@ void keyboard_init(void) { | |||
96 | 96 | ||
97 | /* does routine keyboard jobs */ | 97 | /* does routine keyboard jobs */ |
98 | void keyboard_task(void) { | 98 | void keyboard_task(void) { |
99 | static matrix_row_t previous_matrix[MATRIX_ROWS]; | 99 | static uint8_t led_status; |
100 | #ifdef MATRIX_HAS_GHOST | ||
101 | static matrix_row_t deghosting_matrix[MATRIX_ROWS]; | ||
102 | #endif | ||
103 | static uint8_t led_status = 0; | ||
104 | matrix_scan(); | 100 | matrix_scan(); |
105 | for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { | 101 | for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { |
102 | static matrix_row_t previous_matrix[MATRIX_ROWS]; | ||
106 | matrix_row_t state = matrix_get_row(r); | 103 | matrix_row_t state = matrix_get_row(r); |
107 | matrix_row_t changes = state ^ previous_matrix[r]; | 104 | matrix_row_t changes = state ^ previous_matrix[r]; |
108 | if (changes) { | 105 | if (changes) { |
109 | #ifdef MATRIX_HAS_GHOST | 106 | #ifdef MATRIX_HAS_GHOST |
107 | static matrix_row_t deghosting_matrix[MATRIX_ROWS]; | ||
110 | if (is_row_ghosting(r)) { | 108 | if (is_row_ghosting(r)) { |
111 | /* debugs the deghosting mechanism */ | 109 | /* debugs the deghosting mechanism */ |
112 | /* doesn't update previous_matrix until the ghosting has stopped | 110 | /* doesn't update previous_matrix until the ghosting has stopped |