aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
Diffstat (limited to 'cores')
-rwxr-xr-xcores/arduino/Tone.cpp8
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
}
}