/* Copyright 2014 Kai Ryu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* * scan matrix */ #include #include #include #include #include "timer.h" #include "print.h" #include "debug.h" #include "util.h" #include "matrix.h" #ifdef PS2_MOUSE_ENABLE #include "ps2.h" #endif #include "vibration.h" #include "buzzer.h" #include "keymap_common.h" #ifndef DEBOUNCE # define DEBOUNCE 5 #endif /* matrix state(1:on, 0:off) */ static matrix_row_t matrix = 0; static matrix_row_t matrix_debouncing = 0; static matrix_row_t debouncing = 0; static uint16_t debouncing_last[MATRIX_COLS]; static matrix_row_t read_cols(void); static void init_cols(void); #ifdef PS2_MOUSE_ENABLE uint8_t ps2_mouse_enabled; #endif inline uint8_t matrix_rows(void) { return MATRIX_ROWS; } inline uint8_t matrix_cols(void) { return MATRIX_COLS; } void matrix_init(void) { #ifdef PS2_MOUSE_ENABLE // ps2 mouse detect DDRD &= ~(1< DEBOUNCE) { debouncing &= ~(1<