diff --git a/remoteKeyboard.c b/remoteKeyboard.c index 34c92c4..bdaa3f3 100644 --- a/remoteKeyboard.c +++ b/remoteKeyboard.c @@ -192,6 +192,11 @@ static void assertRowOutputs(row_mask_t mask, row_mask_t polarity) else PORTB &= ~bits; } + else + { + DDRB &= ~PB_ROW_MASK; // reset to inputs + PORTB &= ~PB_ROW_MASK; // and don't pull up + } #endif #if PC_ROW_MASK != 0 bits = PC_FROM_ROW(mask); @@ -203,6 +208,11 @@ static void assertRowOutputs(row_mask_t mask, row_mask_t polarity) else PORTC &= ~bits; } + else + { + DDRC &= ~PC_ROW_MASK; // reset to inputs + PORTC &= ~PC_ROW_MASK; // and don't pull up + } #endif #if PD_ROW_MASK != 0 bits = PD_FROM_ROW(mask); @@ -214,6 +224,11 @@ static void assertRowOutputs(row_mask_t mask, row_mask_t polarity) else PORTD &= ~bits; } + else + { + DDRD &= ~PD_ROW_MASK; // reset to inputs + PORTD &= ~PD_ROW_MASK; // and don't pull up + } #endif } @@ -389,6 +404,9 @@ ISR(PCINT1_vect) } break; + case 0: // no active column lines + break; + case N_COLUMNS - 1: // quiescent state wrong; one active columnInputs ^= quiescentState; // restore flipped bits quiescentState = ~quiescentState; @@ -399,8 +417,6 @@ ISR(PCINT1_vect) quiescentState = ~quiescentState; break; - case 0: // no active column lines - break; } // remember last column scan diff --git a/remoteKeyboard.h b/remoteKeyboard.h index 9cc1da4..eda5b18 100644 --- a/remoteKeyboard.h +++ b/remoteKeyboard.h @@ -76,9 +76,8 @@ # define LOG2_N_ROWS 3 # define UNUSED_ROWS_MASK ((0xFF<>6) # define PC_ROW_MASK 0x00