You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/06/25 10:04:26 UTC

[incubator-nuttx] 04/04: tone: stop tone using 0 duty, not stop()

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b3327419d348a468e48694dae736b5201c6f8d12
Author: Matias Nitsche <mn...@dc.uba.ar>
AuthorDate: Sun Jun 21 11:48:07 2020 -0300

    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 85411cd..7cc315f 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);
 }
 
 /****************************************************************************