1
0
Fork 0

quantum accommodates more than 16 columns

This commit is contained in:
Jack Humbert 2016-05-09 00:36:23 -04:00
parent 35a72ca5e1
commit 684793360c

View file

@ -42,6 +42,13 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS]; static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
#endif #endif
#if MATRIX_COLS > 16
#define SHIFTER 1UL
#else
#define SHIFTER 1
#endif
static matrix_row_t read_cols(void); static matrix_row_t read_cols(void);
static void init_cols(void); static void init_cols(void);
static void unselect_rows(void); static void unselect_rows(void);
@ -235,15 +242,15 @@ static matrix_row_t read_cols(void)
#endif #endif
if ((col & 0xF0) == 0x20) { if ((col & 0xF0) == 0x20) {
result |= (PINB&(1<<(col & 0x0F)) ? 0 : (1<<x)); result |= (PINB&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x30) { } else if ((col & 0xF0) == 0x30) {
result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x)); result |= (PINC&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x40) { } else if ((col & 0xF0) == 0x40) {
result |= (PIND&(1<<(col & 0x0F)) ? 0 : (1<<x)); result |= (PIND&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x50) { } else if ((col & 0xF0) == 0x50) {
result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x)); result |= (PINE&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x60) { } else if ((col & 0xF0) == 0x60) {
result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x)); result |= (PINF&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} }
} }
return result; return result;