diff options
-rw-r--r-- | keyboards/ergodox_ez/matrix.c | 12 | ||||
-rw-r--r-- | quantum/matrix.c | 14 |
2 files changed, 14 insertions, 12 deletions
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 9c1efa1d0..dc29cf5cd 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c | |||
@@ -39,6 +39,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
39 | #include "timer.h" | 39 | #include "timer.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | /* | ||
43 | * This constant define not debouncing time in msecs, but amount of matrix | ||
44 | * scan loops which should be made to get stable debounced results. | ||
45 | * | ||
46 | * On Ergodox matrix scan rate is relatively low, because of slow I2C. | ||
47 | * Now it's only 317 scans/second, or about 3.15 msec/scan. | ||
48 | * According to Cherry specs, debouncing time is 5 msec. | ||
49 | * | ||
50 | * And so, there is no sense to have DEBOUNCE higher than 2. | ||
51 | */ | ||
52 | |||
42 | #ifndef DEBOUNCE | 53 | #ifndef DEBOUNCE |
43 | # define DEBOUNCE 5 | 54 | # define DEBOUNCE 5 |
44 | #endif | 55 | #endif |
@@ -181,6 +192,7 @@ uint8_t matrix_scan(void) | |||
181 | if (debouncing) { | 192 | if (debouncing) { |
182 | if (--debouncing) { | 193 | if (--debouncing) { |
183 | wait_us(1); | 194 | wait_us(1); |
195 | // this should be wait_ms(1) but has been left as-is at EZ's request | ||
184 | } else { | 196 | } else { |
185 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 197 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
186 | matrix[i] = matrix_debouncing[i]; | 198 | matrix[i] = matrix_debouncing[i]; |
diff --git a/quantum/matrix.c b/quantum/matrix.c index 094917025..3174e0739 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
@@ -27,16 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
27 | #include "matrix.h" | 27 | #include "matrix.h" |
28 | 28 | ||
29 | /* Set 0 if debouncing isn't needed */ | 29 | /* Set 0 if debouncing isn't needed */ |
30 | /* | ||
31 | * This constant define not debouncing time in msecs, but amount of matrix | ||
32 | * scan loops which should be made to get stable debounced results. | ||
33 | * | ||
34 | * On Ergodox matrix scan rate is relatively low, because of slow I2C. | ||
35 | * Now it's only 317 scans/second, or about 3.15 msec/scan. | ||
36 | * According to Cherry specs, debouncing time is 5 msec. | ||
37 | * | ||
38 | * And so, there is no sense to have DEBOUNCE higher than 2. | ||
39 | */ | ||
40 | 30 | ||
41 | #ifndef DEBOUNCING_DELAY | 31 | #ifndef DEBOUNCING_DELAY |
42 | # define DEBOUNCING_DELAY 5 | 32 | # define DEBOUNCING_DELAY 5 |
@@ -168,7 +158,7 @@ uint8_t matrix_scan(void) | |||
168 | 158 | ||
169 | if (debouncing) { | 159 | if (debouncing) { |
170 | if (--debouncing) { | 160 | if (--debouncing) { |
171 | wait_us(1); | 161 | wait_ms(1); |
172 | } else { | 162 | } else { |
173 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 163 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
174 | matrix[i] = matrix_debouncing[i]; | 164 | matrix[i] = matrix_debouncing[i]; |
@@ -192,7 +182,7 @@ uint8_t matrix_scan(void) | |||
192 | 182 | ||
193 | if (debouncing) { | 183 | if (debouncing) { |
194 | if (--debouncing) { | 184 | if (--debouncing) { |
195 | wait_us(1); | 185 | wait_ms(1); |
196 | } else { | 186 | } else { |
197 | for (uint8_t i = 0; i < MATRIX_COLS; i++) { | 187 | for (uint8_t i = 0; i < MATRIX_COLS; i++) { |
198 | matrix_reversed[i] = matrix_reversed_debouncing[i]; | 188 | matrix_reversed[i] = matrix_reversed_debouncing[i]; |