diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-05-09 00:36:23 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-05-09 00:36:23 -0400 |
| commit | 684793360cdb08ac1e50a6d27e1796fadd527adb (patch) | |
| tree | b666da50e3910825815083a6796255ac96362455 /quantum | |
| parent | 35a72ca5e1abaf2eece7f61c17f94260ea1d16c7 (diff) | |
| download | qmk_firmware-684793360cdb08ac1e50a6d27e1796fadd527adb.tar.gz qmk_firmware-684793360cdb08ac1e50a6d27e1796fadd527adb.zip | |
quantum accommodates more than 16 columns
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/matrix.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c index 2dab6ae94..7d70f728d 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
| @@ -42,6 +42,13 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | |||
| 42 | static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS]; | 42 | static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS]; |
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | |||
| 46 | #if MATRIX_COLS > 16 | ||
| 47 | #define SHIFTER 1UL | ||
| 48 | #else | ||
| 49 | #define SHIFTER 1 | ||
| 50 | #endif | ||
| 51 | |||
| 45 | static matrix_row_t read_cols(void); | 52 | static matrix_row_t read_cols(void); |
| 46 | static void init_cols(void); | 53 | static void init_cols(void); |
| 47 | static void unselect_rows(void); | 54 | static void unselect_rows(void); |
| @@ -235,15 +242,15 @@ static matrix_row_t read_cols(void) | |||
| 235 | #endif | 242 | #endif |
| 236 | 243 | ||
| 237 | if ((col & 0xF0) == 0x20) { | 244 | if ((col & 0xF0) == 0x20) { |
| 238 | result |= (PINB&(1<<(col & 0x0F)) ? 0 : (1<<x)); | 245 | result |= (PINB&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); |
| 239 | } else if ((col & 0xF0) == 0x30) { | 246 | } else if ((col & 0xF0) == 0x30) { |
| 240 | result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x)); | 247 | result |= (PINC&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); |
| 241 | } else if ((col & 0xF0) == 0x40) { | 248 | } else if ((col & 0xF0) == 0x40) { |
| 242 | result |= (PIND&(1<<(col & 0x0F)) ? 0 : (1<<x)); | 249 | result |= (PIND&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); |
| 243 | } else if ((col & 0xF0) == 0x50) { | 250 | } else if ((col & 0xF0) == 0x50) { |
| 244 | result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x)); | 251 | result |= (PINE&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); |
| 245 | } else if ((col & 0xF0) == 0x60) { | 252 | } else if ((col & 0xF0) == 0x60) { |
| 246 | result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x)); | 253 | result |= (PINF&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); |
| 247 | } | 254 | } |
| 248 | } | 255 | } |
| 249 | return result; | 256 | return result; |
