diff options
author | Tobias Matt <t.matt81+github@gmail.com> | 2016-05-13 10:08:29 +0200 |
---|---|---|
committer | Tobias Matt <t.matt81+github@gmail.com> | 2016-05-13 10:08:29 +0200 |
commit | 65645fb8cad05307b9faf9a897eefd5ae8c46dad (patch) | |
tree | c522c0cd320c4930b7532d892c0831b148c98e93 /quantum/matrix.c | |
parent | 4122ad3f7b0e0dc1083a54b51430c8d7207d74ef (diff) | |
parent | 69f05e1afd2e046938209e00db62d18efead4932 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'quantum/matrix.c')
-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 2dab6ae941..7d70f728d4 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -42,6 +42,13 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS]; #endif + +#if MATRIX_COLS > 16 + #define SHIFTER 1UL +#else + #define SHIFTER 1 +#endif + static matrix_row_t read_cols(void); static void init_cols(void); static void unselect_rows(void); @@ -235,15 +242,15 @@ static matrix_row_t read_cols(void) #endif 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) { - result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x)); + result |= (PINC&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); } 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) { - result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x)); + result |= (PINE&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); } else if ((col & 0xF0) == 0x60) { - result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x)); + result |= (PINF&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x)); } } return result; |