From b3327419d348a468e48694dae736b5201c6f8d12 Mon Sep 17 00:00:00 2001 From: Matias Nitsche Date: Sun, 21 Jun 2020 11:48:07 -0300 Subject: [PATCH] tone: stop tone using 0 duty, not stop() --- drivers/audio/tone.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index 85411cd549..7cc315fa32 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -328,7 +328,16 @@ static void stop_note(FAR struct tone_upperhalf_s *upper) { FAR struct pwm_lowerhalf_s *tone = upper->devtone; - tone->ops->stop(tone); +#ifdef CONFIG_PWM_MULTICHAN + upper->tone.channels[0].channel = upper->channel; + upper->tone.channels[0].duty = 0; +#else + upper->tone.duty = 0; +#endif + + /* REVISIT: Should check the return value */ + + tone->ops->start(tone, &upper->tone); } /****************************************************************************