Fixing bug w/ subsequent calls to tone().

http://code.google.com/p/arduino/issues/detail?id=397
This commit is contained in:
David A. Mellis 2010-11-11 23:57:12 -05:00
parent a403c19ade
commit c11098c237
1 changed files with 6 additions and 2 deletions

View File

@ -533,8 +533,12 @@ ISR(TIMER2_COMPA_vect)
}
else
{
disableTimer(2);
*timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop
// need to call noTone() so that the tone_pins[] entry is reset, so the
// timer gets initialized next time we call tone().
// XXX: this assumes timer 2 is always the first one used.
noTone(tone_pins[0]);
// disableTimer(2);
// *timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop
}
}