LED cotnrol bug fixed.
This commit is contained in:
parent
ba3b4d7daf
commit
cf173e6c84
1 changed files with 2 additions and 1 deletions
|
@ -83,7 +83,6 @@ ISR (TIMER1_COMPA_vect)
|
||||||
|
|
||||||
// PORTD = __, 9, C, B, A,D+,D-,__
|
// PORTD = __, 9, C, B, A,D+,D-,__
|
||||||
PORTD &= 0b10000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2; bit 6 = wire 9 to the LEDs)
|
PORTD &= 0b10000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2; bit 6 = wire 9 to the LEDs)
|
||||||
PORTD |= (1 << 6) | ((1 << level) << 3); // set the current level and pin 6 to high (9th LEDs off)
|
|
||||||
|
|
||||||
uint8_t tmp = level * 9; // calculate the position in the frame
|
uint8_t tmp = level * 9; // calculate the position in the frame
|
||||||
|
|
||||||
|
@ -94,6 +93,8 @@ ISR (TIMER1_COMPA_vect)
|
||||||
if ( (((frame >> tmp) >> 8) & 0x01) )
|
if ( (((frame >> tmp) >> 8) & 0x01) )
|
||||||
PORTD &= ~(1 << 6); // turn the 9th LED on if required
|
PORTD &= ~(1 << 6); // turn the 9th LED on if required
|
||||||
|
|
||||||
|
PORTD |= (1 << 6) | ((1 << level) << 3); // set the current level and pin 6 to high (9th LEDs off)
|
||||||
|
|
||||||
// rotate through the 3 level
|
// rotate through the 3 level
|
||||||
level++;
|
level++;
|
||||||
if (level > 2) level = 0;
|
if (level > 2) level = 0;
|
||||||
|
|
Loading…
Reference in a new issue