diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2010-11-11 23:57:12 -0500 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2010-11-11 23:57:12 -0500 |
commit | e46c6f46af5e2565c5d8a7192808825743df1c14 (patch) | |
tree | c18796ade6e3d15cb757e5aaa8ae3b3efe76885f /cores/arduino/Tone.cpp | |
parent | 407d6bbc6fa9035dcb5e3b7b656eb3cbc871719d (diff) |
Fixing bug w/ subsequent calls to tone().
http://code.google.com/p/arduino/issues/detail?id=397
Diffstat (limited to 'cores/arduino/Tone.cpp')
-rwxr-xr-x | cores/arduino/Tone.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 8bdc5f7..c3910e7 100755 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -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 } } |