|
|
@ -27,16 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#include "matrix.h"
|
|
|
|
#include "matrix.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Set 0 if debouncing isn't needed */
|
|
|
|
/* Set 0 if debouncing isn't needed */
|
|
|
|
/*
|
|
|
|
|
|
|
|
* This constant define not debouncing time in msecs, but amount of matrix
|
|
|
|
|
|
|
|
* scan loops which should be made to get stable debounced results.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* On Ergodox matrix scan rate is relatively low, because of slow I2C.
|
|
|
|
|
|
|
|
* Now it's only 317 scans/second, or about 3.15 msec/scan.
|
|
|
|
|
|
|
|
* According to Cherry specs, debouncing time is 5 msec.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* And so, there is no sense to have DEBOUNCE higher than 2.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DEBOUNCING_DELAY
|
|
|
|
#ifndef DEBOUNCING_DELAY
|
|
|
|
# define DEBOUNCING_DELAY 5
|
|
|
|
# define DEBOUNCING_DELAY 5
|
|
|
@ -168,7 +158,7 @@ uint8_t matrix_scan(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (debouncing) {
|
|
|
|
if (debouncing) {
|
|
|
|
if (--debouncing) {
|
|
|
|
if (--debouncing) {
|
|
|
|
wait_us(1);
|
|
|
|
wait_ms(1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
|
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
|
|
matrix[i] = matrix_debouncing[i];
|
|
|
|
matrix[i] = matrix_debouncing[i];
|
|
|
@ -192,7 +182,7 @@ uint8_t matrix_scan(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (debouncing) {
|
|
|
|
if (debouncing) {
|
|
|
|
if (--debouncing) {
|
|
|
|
if (--debouncing) {
|
|
|
|
wait_us(1);
|
|
|
|
wait_ms(1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (uint8_t i = 0; i < MATRIX_COLS; i++) {
|
|
|
|
for (uint8_t i = 0; i < MATRIX_COLS; i++) {
|
|
|
|
matrix_reversed[i] = matrix_reversed_debouncing[i];
|
|
|
|
matrix_reversed[i] = matrix_reversed_debouncing[i];
|
|
|
|