Skip to content

Commit

Permalink
Reset row outputs in irq
Browse files Browse the repository at this point in the history
  • Loading branch information
bikeNomad committed May 17, 2011
1 parent b8caeab commit cb7d5d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
20 changes: 18 additions & 2 deletions remoteKeyboard.c
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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
}

Expand Down Expand Up @@ -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;
Expand All @@ -399,8 +417,6 @@ ISR(PCINT1_vect)
quiescentState = ~quiescentState;
break;

case 0: // no active column lines
break;
}

// remember last column scan
Expand Down
3 changes: 1 addition & 2 deletions remoteKeyboard.h
Expand Up @@ -76,9 +76,8 @@
# define LOG2_N_ROWS 3
# define UNUSED_ROWS_MASK ((0xFF<<N_ROWS)&0xFF)


# define PB_ROW_MASK 0x03
# define PB_TO_ROW(val) (((val)&0x03)<<6)
# define PB_TO_ROW(val) (((val)&PB_ROW_MASK)<<6)
# define PB_FROM_ROW(val) ((val)>>6)

# define PC_ROW_MASK 0x00
Expand Down

0 comments on commit cb7d5d6

Please sign in to comment.