From 40cbe0de432c32e020857fe4a801fb4b4db34503 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 11 Mar 2020 12:32:49 +0100 Subject: [PATCH] Tone: allow running indefinitely when called without duration --- cores/arduino/Tone.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 29a5842d..d30e0d79 100644 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -21,7 +21,9 @@ class Tone { void start(void) { ticker.attach(mbed::callback(this, &Tone::toggle), 0.5f / float(frequency)); - start_timeout(); + if (duration != 0) { + start_timeout(); + } } void toggle() {