summaryrefslogtreecommitdiff
path: root/keyboard/gh60/matrix.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-03-27 17:15:06 +0900
committertmk <nobody@nowhere>2013-03-27 17:15:06 +0900
commit2795b7a0a30c351a85f17cb4c0b414297e096282 (patch)
treed456c2a781ec6f81d3ed7ef2e567c952e121daf1 /keyboard/gh60/matrix.c
parent969cc4f812e3f86213f97adf340e3c7160fc639e (diff)
Fix debouncing on gh60, hbkb, macway
Diffstat (limited to 'keyboard/gh60/matrix.c')
-rw-r--r--keyboard/gh60/matrix.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c
index 3ba6801fbf..a2bd70e4b7 100644
--- a/keyboard/gh60/matrix.c
+++ b/keyboard/gh60/matrix.c
@@ -34,10 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static uint8_t debouncing = DEBOUNCE;
/* matrix state(1:on, 0:off) */
-static matrix_row_t *matrix;
-static matrix_row_t *matrix_debouncing;
-static matrix_row_t matrix0[MATRIX_ROWS];
-static matrix_row_t matrix1[MATRIX_ROWS];
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static matrix_row_t read_cols(void);
static void init_cols(void);
@@ -64,8 +62,6 @@ void matrix_init(void)
init_cols();
// initialize matrix state: all keys off
- matrix = matrix0;
- matrix_debouncing = matrix1;
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix[i] = 0;
matrix_debouncing[i] = 0;
@@ -92,9 +88,9 @@ uint8_t matrix_scan(void)
if (--debouncing) {
_delay_ms(1);
} else {
- matrix_row_t *tmp = matrix;
- matrix = matrix_debouncing;
- matrix_debouncing = tmp;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
}
}