aboutsummaryrefslogtreecommitdiff
path: root/keyboard/gh60/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/gh60/matrix.c')
-rw-r--r--keyboard/gh60/matrix.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c
index 4c18a6191..1a774e17e 100644
--- a/keyboard/gh60/matrix.c
+++ b/keyboard/gh60/matrix.c
@@ -82,7 +82,7 @@ uint8_t matrix_scan(void)
82 unselect_rows(); 82 unselect_rows();
83 select_row(i); 83 select_row(i);
84 _delay_us(1); // without this wait read unstable value. 84 _delay_us(1); // without this wait read unstable value.
85 uint16_t cols = ~read_cols(); 85 uint16_t cols = read_cols();
86 if (matrix[i] != cols) { 86 if (matrix[i] != cols) {
87 matrix[i] = cols; 87 matrix[i] = cols;
88 if (debouncing) { 88 if (debouncing) {
@@ -132,7 +132,7 @@ uint16_t matrix_get_row(uint8_t row)
132 132
133void matrix_print(void) 133void matrix_print(void)
134{ 134{
135 print("\nr/c 01234567\n"); 135 print("\nr/c 01234567890ABCDEF\n");
136 for (uint8_t row = 0; row < MATRIX_ROWS; row++) { 136 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
137 phex(row); print(": "); 137 phex(row); print(": ");
138 pbin_reverse16(matrix_get_row(row)); 138 pbin_reverse16(matrix_get_row(row));
@@ -170,20 +170,20 @@ static void init_cols(void)
170 170
171static uint16_t read_cols(void) 171static uint16_t read_cols(void)
172{ 172{
173 return (PINF&(1<<0) ? (1<<0) : 0) | 173 return (PINF&(1<<0) ? 0 : (1<<0)) |
174 (PINF&(1<<1) ? (1<<1) : 0) | 174 (PINF&(1<<1) ? 0 : (1<<1)) |
175 (PINE&(1<<6) ? (1<<2) : 0) | 175 (PINE&(1<<6) ? 0 : (1<<2)) |
176 (PINC&(1<<7) ? (1<<3) : 0) | 176 (PINC&(1<<7) ? 0 : (1<<3)) |
177 (PINC&(1<<6) ? (1<<4) : 0) | 177 (PINC&(1<<6) ? 0 : (1<<4)) |
178 (PINB&(1<<6) ? (1<<5) : 0) | 178 (PINB&(1<<6) ? 0 : (1<<5)) |
179 (PIND&(1<<4) ? (1<<6) : 0) | 179 (PIND&(1<<4) ? 0 : (1<<6)) |
180 (PINB&(1<<1) ? (1<<7) : 0) | 180 (PINB&(1<<1) ? 0 : (1<<7)) |
181 (PINB&(1<<0) ? (1<<8) : 0) | 181 (PINB&(1<<0) ? 0 : (1<<8)) |
182 (PINB&(1<<5) ? (1<<9) : 0) | 182 (PINB&(1<<5) ? 0 : (1<<9)) |
183 (PINB&(1<<4) ? (1<<10) : 0) | 183 (PINB&(1<<4) ? 0 : (1<<10)) |
184 (PIND&(1<<7) ? (1<<11) : 0) | 184 (PIND&(1<<7) ? 0 : (1<<11)) |
185 (PIND&(1<<6) ? (1<<12) : 0) | 185 (PIND&(1<<6) ? 0 : (1<<12)) |
186 (PINB&(1<<3) ? (1<<13) : 0); 186 (PINB&(1<<3) ? 0 : (1<<13));
187} 187}
188 188
189/* Row pin configuration 189/* Row pin configuration