diff options
| author | tmk <nobody@nowhere> | 2013-03-27 17:16:27 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-03-27 17:16:27 +0900 |
| commit | 366c75979535c27e10332a4842851fa7f91b2f7e (patch) | |
| tree | d456c2a781ec6f81d3ed7ef2e567c952e121daf1 | |
| parent | 969cc4f812e3f86213f97adf340e3c7160fc639e (diff) | |
| parent | 2795b7a0a30c351a85f17cb4c0b414297e096282 (diff) | |
| download | qmk_firmware-366c75979535c27e10332a4842851fa7f91b2f7e.tar.gz qmk_firmware-366c75979535c27e10332a4842851fa7f91b2f7e.zip | |
Merge branch 'matrix_scan_fix'
| -rw-r--r-- | keyboard/gh60/matrix.c | 14 | ||||
| -rw-r--r-- | keyboard/hbkb/Makefile.lufa | 4 | ||||
| -rw-r--r-- | keyboard/hbkb/config.h | 2 | ||||
| -rw-r--r-- | keyboard/hbkb/matrix.c | 50 | ||||
| -rw-r--r-- | keyboard/macway/Makefile.lufa | 3 | ||||
| -rw-r--r-- | keyboard/macway/Makefile.pjrc | 2 | ||||
| -rw-r--r-- | keyboard/macway/matrix.c | 63 |
7 files changed, 46 insertions, 92 deletions
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c index 3ba6801fb..a2bd70e4b 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/>. | |||
| 34 | static uint8_t debouncing = DEBOUNCE; | 34 | static uint8_t debouncing = DEBOUNCE; |
| 35 | 35 | ||
| 36 | /* matrix state(1:on, 0:off) */ | 36 | /* matrix state(1:on, 0:off) */ |
| 37 | static matrix_row_t *matrix; | 37 | static matrix_row_t matrix[MATRIX_ROWS]; |
| 38 | static matrix_row_t *matrix_debouncing; | 38 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; |
| 39 | static matrix_row_t matrix0[MATRIX_ROWS]; | ||
| 40 | static matrix_row_t matrix1[MATRIX_ROWS]; | ||
| 41 | 39 | ||
| 42 | static matrix_row_t read_cols(void); | 40 | static matrix_row_t read_cols(void); |
| 43 | static void init_cols(void); | 41 | static void init_cols(void); |
| @@ -64,8 +62,6 @@ void matrix_init(void) | |||
| 64 | init_cols(); | 62 | init_cols(); |
| 65 | 63 | ||
| 66 | // initialize matrix state: all keys off | 64 | // initialize matrix state: all keys off |
| 67 | matrix = matrix0; | ||
| 68 | matrix_debouncing = matrix1; | ||
| 69 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | 65 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
| 70 | matrix[i] = 0; | 66 | matrix[i] = 0; |
| 71 | matrix_debouncing[i] = 0; | 67 | matrix_debouncing[i] = 0; |
| @@ -92,9 +88,9 @@ uint8_t matrix_scan(void) | |||
| 92 | if (--debouncing) { | 88 | if (--debouncing) { |
| 93 | _delay_ms(1); | 89 | _delay_ms(1); |
| 94 | } else { | 90 | } else { |
| 95 | matrix_row_t *tmp = matrix; | 91 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 96 | matrix = matrix_debouncing; | 92 | matrix[i] = matrix_debouncing[i]; |
| 97 | matrix_debouncing = tmp; | 93 | } |
| 98 | } | 94 | } |
| 99 | } | 95 | } |
| 100 | 96 | ||
diff --git a/keyboard/hbkb/Makefile.lufa b/keyboard/hbkb/Makefile.lufa index 33366d720..a626d476c 100644 --- a/keyboard/hbkb/Makefile.lufa +++ b/keyboard/hbkb/Makefile.lufa | |||
| @@ -97,11 +97,11 @@ F_USB = $(F_CPU) | |||
| 97 | # Build Options | 97 | # Build Options |
| 98 | # comment out to disable the options. | 98 | # comment out to disable the options. |
| 99 | # | 99 | # |
| 100 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 100 | MOUSEKEY_ENABLE = yes # Mouse keys | 101 | MOUSEKEY_ENABLE = yes # Mouse keys |
| 101 | EXTRAKEY_ENABLE = yes # Audio control and System control | 102 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 102 | CONSOLE_ENABLE = yes # Console for debug | 103 | CONSOLE_ENABLE = yes # Console for debug |
| 103 | #NKRO_ENABLE = yes # USB Nkey Rollover | 104 | COMMAND_ENABLE = yes # Commands for debug and configuration |
| 104 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | ||
| 105 | 105 | ||
| 106 | 106 | ||
| 107 | # Boot Section Size in bytes | 107 | # Boot Section Size in bytes |
diff --git a/keyboard/hbkb/config.h b/keyboard/hbkb/config.h index aa3af30c1..b31a86538 100644 --- a/keyboard/hbkb/config.h +++ b/keyboard/hbkb/config.h | |||
| @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 37 | #define MATRIX_HAS_GHOST | 37 | #define MATRIX_HAS_GHOST |
| 38 | 38 | ||
| 39 | /* Set 0 if need no debouncing */ | 39 | /* Set 0 if need no debouncing */ |
| 40 | #define DEBOUNCE 10 | 40 | #define DEBOUNCE 5 |
| 41 | 41 | ||
| 42 | /* legacy keymap support */ | 42 | /* legacy keymap support */ |
| 43 | #define USE_LEGACY_KEYMAP | 43 | #define USE_LEGACY_KEYMAP |
diff --git a/keyboard/hbkb/matrix.c b/keyboard/hbkb/matrix.c index f6830a0f7..ee32312d9 100644 --- a/keyboard/hbkb/matrix.c +++ b/keyboard/hbkb/matrix.c | |||
| @@ -37,16 +37,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 37 | #endif | 37 | #endif |
| 38 | static uint8_t debouncing = DEBOUNCE; | 38 | static uint8_t debouncing = DEBOUNCE; |
| 39 | 39 | ||
| 40 | // matrix state buffer(1:on, 0:off) | 40 | /* matrix state(1:on, 0:off) */ |
| 41 | static uint8_t *matrix; | 41 | static matrix_row_t matrix[MATRIX_ROWS]; |
| 42 | static uint8_t *matrix_debouncing; | 42 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; |
| 43 | static uint8_t matrix0[MATRIX_ROWS]; | ||
| 44 | static uint8_t matrix1[MATRIX_ROWS]; | ||
| 45 | 43 | ||
| 46 | #ifdef MATRIX_HAS_GHOST | 44 | #ifdef MATRIX_HAS_GHOST |
| 47 | static bool matrix_has_ghost_in_row(uint8_t row); | 45 | static bool matrix_has_ghost_in_row(uint8_t row); |
| 48 | #endif | 46 | #endif |
| 49 | static uint8_t read_col(void); | 47 | static matrix_row_t read_cols(void); |
| 50 | static void unselect_rows(void); | 48 | static void unselect_rows(void); |
| 51 | static void select_row(uint8_t row); | 49 | static void select_row(uint8_t row); |
| 52 | 50 | ||
| @@ -65,13 +63,6 @@ uint8_t matrix_cols(void) | |||
| 65 | 63 | ||
| 66 | void matrix_init(void) | 64 | void matrix_init(void) |
| 67 | { | 65 | { |
| 68 | print_enable = true; | ||
| 69 | debug_enable = true; | ||
| 70 | debug_matrix = true; | ||
| 71 | debug_keyboard = false; | ||
| 72 | debug_mouse = false; | ||
| 73 | print("debug enabled.\n"); | ||
| 74 | |||
| 75 | // JTAG disable for PORT F. write JTD bit twice within four cycles. | 66 | // JTAG disable for PORT F. write JTD bit twice within four cycles. |
| 76 | MCUCR |= (1<<JTD); | 67 | MCUCR |= (1<<JTD); |
| 77 | MCUCR |= (1<<JTD); | 68 | MCUCR |= (1<<JTD); |
| @@ -84,10 +75,10 @@ void matrix_init(void) | |||
| 84 | PORTD = 0xFF; | 75 | PORTD = 0xFF; |
| 85 | 76 | ||
| 86 | // initialize matrix state: all keys off | 77 | // initialize matrix state: all keys off |
| 87 | for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix0[i] = 0x00; | 78 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
| 88 | for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix1[i] = 0x00; | 79 | matrix[i] = 0; |
| 89 | matrix = matrix0; | 80 | matrix_debouncing[i] = 0; |
| 90 | matrix_debouncing = matrix1; | 81 | } |
| 91 | } | 82 | } |
| 92 | 83 | ||
| 93 | uint8_t matrix_scan(void) | 84 | uint8_t matrix_scan(void) |
| @@ -95,8 +86,9 @@ uint8_t matrix_scan(void) | |||
| 95 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 86 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 96 | select_row(i); | 87 | select_row(i); |
| 97 | _delay_us(30); // without this wait read unstable value. | 88 | _delay_us(30); // without this wait read unstable value. |
| 98 | if (matrix_debouncing[i] != read_col()) { | 89 | matrix_row_t cols = read_cols(); |
| 99 | matrix_debouncing[i] = read_col(); | 90 | if (matrix_debouncing[i] != cols) { |
| 91 | matrix_debouncing[i] = cols; | ||
| 100 | if (debouncing) { | 92 | if (debouncing) { |
| 101 | debug("bounce!: "); debug_hex(debouncing); debug("\n"); | 93 | debug("bounce!: "); debug_hex(debouncing); debug("\n"); |
| 102 | } | 94 | } |
| @@ -109,9 +101,9 @@ uint8_t matrix_scan(void) | |||
| 109 | if (--debouncing) { | 101 | if (--debouncing) { |
| 110 | _delay_ms(1); | 102 | _delay_ms(1); |
| 111 | } else { | 103 | } else { |
| 112 | uint8_t *tmp = matrix; | 104 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 113 | matrix = matrix_debouncing; | 105 | matrix[i] = matrix_debouncing[i]; |
| 114 | matrix_debouncing = tmp; | 106 | } |
| 115 | } | 107 | } |
| 116 | } | 108 | } |
| 117 | 109 | ||
| @@ -127,15 +119,11 @@ bool matrix_is_modified(void) | |||
| 127 | inline | 119 | inline |
| 128 | bool matrix_is_on(uint8_t row, uint8_t col) | 120 | bool matrix_is_on(uint8_t row, uint8_t col) |
| 129 | { | 121 | { |
| 130 | return (matrix[row] & (1<<col)); | 122 | return (matrix[row] & ((matrix_row_t)1<<col)); |
| 131 | } | 123 | } |
| 132 | 124 | ||
| 133 | inline | 125 | inline |
| 134 | #if (MATRIX_COLS <= 8) | 126 | matrix_row_t matrix_get_row(uint8_t row) |
| 135 | uint8_t matrix_get_row(uint8_t row) | ||
| 136 | #else | ||
| 137 | uint16_t matrix_get_row(uint8_t row) | ||
| 138 | #endif | ||
| 139 | { | 127 | { |
| 140 | return matrix[row]; | 128 | return matrix[row]; |
| 141 | } | 129 | } |
| @@ -145,11 +133,7 @@ void matrix_print(void) | |||
| 145 | print("\nr/c 01234567\n"); | 133 | print("\nr/c 01234567\n"); |
| 146 | for (uint8_t row = 0; row < matrix_rows(); row++) { | 134 | for (uint8_t row = 0; row < matrix_rows(); row++) { |
| 147 | phex(row); print(": "); | 135 | phex(row); print(": "); |
| 148 | #if (MATRIX_COLS <= 8) | ||
| 149 | pbin_reverse(matrix_get_row(row)); | 136 | pbin_reverse(matrix_get_row(row)); |
| 150 | #else | ||
| 151 | pbin_reverse16(matrix_get_row(row)); | ||
| 152 | #endif | ||
| 153 | #ifdef MATRIX_HAS_GHOST | 137 | #ifdef MATRIX_HAS_GHOST |
| 154 | if (matrix_has_ghost_in_row(row)) { | 138 | if (matrix_has_ghost_in_row(row)) { |
| 155 | print(" <ghost"); | 139 | print(" <ghost"); |
| @@ -177,7 +161,7 @@ static bool matrix_has_ghost_in_row(uint8_t row) | |||
| 177 | #endif | 161 | #endif |
| 178 | 162 | ||
| 179 | inline | 163 | inline |
| 180 | static uint8_t read_col(void) | 164 | static matrix_row_t read_cols(void) |
| 181 | { | 165 | { |
| 182 | return ~PIND; | 166 | return ~PIND; |
| 183 | } | 167 | } |
diff --git a/keyboard/macway/Makefile.lufa b/keyboard/macway/Makefile.lufa index 1f365da11..f0acf7671 100644 --- a/keyboard/macway/Makefile.lufa +++ b/keyboard/macway/Makefile.lufa | |||
| @@ -97,11 +97,12 @@ F_USB = $(F_CPU) | |||
| 97 | # Build Options | 97 | # Build Options |
| 98 | # comment out to disable the options. | 98 | # comment out to disable the options. |
| 99 | # | 99 | # |
| 100 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 100 | MOUSEKEY_ENABLE = yes # Mouse keys | 101 | MOUSEKEY_ENABLE = yes # Mouse keys |
| 101 | EXTRAKEY_ENABLE = yes # Audio control and System control | 102 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 102 | CONSOLE_ENABLE = yes # Console for debug | 103 | CONSOLE_ENABLE = yes # Console for debug |
| 104 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 103 | #NKRO_ENABLE = yes # USB Nkey Rollover | 105 | #NKRO_ENABLE = yes # USB Nkey Rollover |
| 104 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | ||
| 105 | 106 | ||
| 106 | 107 | ||
| 107 | # Boot Section Size in bytes | 108 | # Boot Section Size in bytes |
diff --git a/keyboard/macway/Makefile.pjrc b/keyboard/macway/Makefile.pjrc index ecc236e3d..9e84a3418 100644 --- a/keyboard/macway/Makefile.pjrc +++ b/keyboard/macway/Makefile.pjrc | |||
| @@ -74,9 +74,11 @@ F_CPU = 16000000 | |||
| 74 | # Build Options | 74 | # Build Options |
| 75 | # comment out to disable the options. | 75 | # comment out to disable the options. |
| 76 | # | 76 | # |
| 77 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 77 | MOUSEKEY_ENABLE = yes # Mouse keys | 78 | MOUSEKEY_ENABLE = yes # Mouse keys |
| 78 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | 79 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support |
| 79 | EXTRAKEY_ENABLE = yes # Audio control and System control | 80 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 81 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 80 | #NKRO_ENABLE = yes # USB Nkey Rollover | 82 | #NKRO_ENABLE = yes # USB Nkey Rollover |
| 81 | 83 | ||
| 82 | 84 | ||
diff --git a/keyboard/macway/matrix.c b/keyboard/macway/matrix.c index 0f57bfeae..3d10b304d 100644 --- a/keyboard/macway/matrix.c +++ b/keyboard/macway/matrix.c | |||
| @@ -28,29 +28,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | #include "matrix.h" | 28 | #include "matrix.h" |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | #if (MATRIX_COLS > 16) | ||
| 32 | # error "MATRIX_COLS must not exceed 16" | ||
| 33 | #endif | ||
| 34 | #if (MATRIX_ROWS > 255) | ||
| 35 | # error "MATRIX_ROWS must not exceed 255" | ||
| 36 | #endif | ||
| 37 | |||
| 38 | |||
| 39 | #ifndef DEBOUNCE | 31 | #ifndef DEBOUNCE |
| 40 | # define DEBOUNCE 5 | 32 | # define DEBOUNCE 5 |
| 41 | #endif | 33 | #endif |
| 42 | static uint8_t debouncing = DEBOUNCE; | 34 | static uint8_t debouncing = DEBOUNCE; |
| 43 | 35 | ||
| 44 | // matrix state buffer(1:on, 0:off) | 36 | /* matrix state(1:on, 0:off) */ |
| 45 | static matrix_row_t *matrix; | 37 | static matrix_row_t matrix[MATRIX_ROWS]; |
| 46 | static matrix_row_t *matrix_debouncing; | 38 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; |
| 47 | static matrix_row_t matrix0[MATRIX_ROWS]; | ||
| 48 | static matrix_row_t matrix1[MATRIX_ROWS]; | ||
| 49 | 39 | ||
| 50 | #ifdef MATRIX_HAS_GHOST | 40 | #ifdef MATRIX_HAS_GHOST |
| 51 | static bool matrix_has_ghost_in_row(uint8_t row); | 41 | static bool matrix_has_ghost_in_row(uint8_t row); |
| 52 | #endif | 42 | #endif |
| 53 | static matrix_row_t read_col(void); | 43 | static matrix_row_t read_cols(void); |
| 54 | static void unselect_rows(void); | 44 | static void unselect_rows(void); |
| 55 | static void select_row(uint8_t row); | 45 | static void select_row(uint8_t row); |
| 56 | 46 | ||
| @@ -77,36 +67,34 @@ void matrix_init(void) | |||
| 77 | 67 | ||
| 78 | // initialize matrix state: all keys off | 68 | // initialize matrix state: all keys off |
| 79 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | 69 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
| 80 | matrix0[i] = 0; | 70 | matrix[i] = 0; |
| 81 | matrix1[i] = 0; | 71 | matrix_debouncing[i] = 0; |
| 82 | } | 72 | } |
| 83 | matrix = matrix0; | ||
| 84 | matrix_debouncing = matrix1; | ||
| 85 | } | 73 | } |
| 86 | 74 | ||
| 87 | uint8_t matrix_scan(void) | 75 | uint8_t matrix_scan(void) |
| 88 | { | 76 | { |
| 89 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 77 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 90 | unselect_rows(); | ||
| 91 | select_row(i); | 78 | select_row(i); |
| 92 | _delay_us(30); // without this wait read unstable value. | 79 | _delay_us(30); // without this wait read unstable value. |
| 93 | if (matrix[i] != read_col()) { | 80 | matrix_row_t cols = read_cols(); |
| 94 | matrix[i] = read_col(); | 81 | if (matrix_debouncing[i] != cols) { |
| 82 | matrix_debouncing[i] = cols; | ||
| 95 | if (debouncing) { | 83 | if (debouncing) { |
| 96 | debug("bounce!: "); debug_hex(debouncing); print("\n"); | 84 | debug("bounce!: "); debug_hex(debouncing); debug("\n"); |
| 97 | } | 85 | } |
| 98 | debouncing = DEBOUNCE; | 86 | debouncing = DEBOUNCE; |
| 99 | } | 87 | } |
| 88 | unselect_rows(); | ||
| 100 | } | 89 | } |
| 101 | unselect_rows(); | ||
| 102 | 90 | ||
| 103 | if (debouncing) { | 91 | if (debouncing) { |
| 104 | if (--debouncing) { | 92 | if (--debouncing) { |
| 105 | _delay_ms(1); | 93 | _delay_ms(1); |
| 106 | } else { | 94 | } else { |
| 107 | matrix_row_t *tmp = matrix; | 95 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 108 | matrix = matrix_debouncing; | 96 | matrix[i] = matrix_debouncing[i]; |
| 109 | matrix_debouncing = tmp; | 97 | } |
| 110 | } | 98 | } |
| 111 | 99 | ||
| 112 | } | 100 | } |
| @@ -123,7 +111,7 @@ bool matrix_is_modified(void) | |||
| 123 | inline | 111 | inline |
| 124 | bool matrix_is_on(uint8_t row, uint8_t col) | 112 | bool matrix_is_on(uint8_t row, uint8_t col) |
| 125 | { | 113 | { |
| 126 | return (matrix[row] & (1<<col)); | 114 | return (matrix[row] & ((matrix_row_t)1<<col)); |
| 127 | } | 115 | } |
| 128 | 116 | ||
| 129 | inline | 117 | inline |
| @@ -137,11 +125,7 @@ void matrix_print(void) | |||
| 137 | print("\nr/c 01234567\n"); | 125 | print("\nr/c 01234567\n"); |
| 138 | for (uint8_t row = 0; row < matrix_rows(); row++) { | 126 | for (uint8_t row = 0; row < matrix_rows(); row++) { |
| 139 | phex(row); print(": "); | 127 | phex(row); print(": "); |
| 140 | #if (MATRIX_COLS <= 8) | ||
| 141 | pbin_reverse(matrix_get_row(row)); | 128 | pbin_reverse(matrix_get_row(row)); |
| 142 | #else | ||
| 143 | pbin_reverse16(matrix_get_row(row)); | ||
| 144 | #endif | ||
| 145 | #ifdef MATRIX_HAS_GHOST | 129 | #ifdef MATRIX_HAS_GHOST |
| 146 | if (matrix_has_ghost_in_row(row)) { | 130 | if (matrix_has_ghost_in_row(row)) { |
| 147 | print(" <ghost"); | 131 | print(" <ghost"); |
| @@ -151,19 +135,6 @@ void matrix_print(void) | |||
| 151 | } | 135 | } |
| 152 | } | 136 | } |
| 153 | 137 | ||
| 154 | uint8_t matrix_key_count(void) | ||
| 155 | { | ||
| 156 | uint8_t count = 0; | ||
| 157 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 158 | #if (MATRIX_COLS <= 8) | ||
| 159 | count += bitpop(matrix[i]); | ||
| 160 | #else | ||
| 161 | count += bitpop16(matrix[i]); | ||
| 162 | #endif | ||
| 163 | } | ||
| 164 | return count; | ||
| 165 | } | ||
| 166 | |||
| 167 | #ifdef MATRIX_HAS_GHOST | 138 | #ifdef MATRIX_HAS_GHOST |
| 168 | inline | 139 | inline |
| 169 | static bool matrix_has_ghost_in_row(uint8_t row) | 140 | static bool matrix_has_ghost_in_row(uint8_t row) |
| @@ -174,7 +145,7 @@ static bool matrix_has_ghost_in_row(uint8_t row) | |||
| 174 | 145 | ||
| 175 | // ghost exists in case same state as other row | 146 | // ghost exists in case same state as other row |
| 176 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | 147 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
| 177 | if (i != row && (matrix[i] & matrix[row]) == matrix[row]) | 148 | if (i != row && (matrix[i] & matrix[row])) |
| 178 | return true; | 149 | return true; |
| 179 | } | 150 | } |
| 180 | return false; | 151 | return false; |
| @@ -182,7 +153,7 @@ static bool matrix_has_ghost_in_row(uint8_t row) | |||
| 182 | #endif | 153 | #endif |
| 183 | 154 | ||
| 184 | inline | 155 | inline |
| 185 | static matrix_row_t read_col(void) | 156 | static matrix_row_t read_cols(void) |
| 186 | { | 157 | { |
| 187 | return ~PINB; | 158 | return ~PINB; |
| 188 | } | 159 | } |
