You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/12/28 01:45:38 UTC

[nuttx] 04/04: esp32c3: Clear the timer interrupt to avoid losing the next one

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

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

commit 1b58542dd464bbd22d2b55cd9dc0f93cd7c6122f
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Tue Dec 27 16:43:01 2022 -0300

    esp32c3: Clear the timer interrupt to avoid losing the next one
---
 arch/risc-v/src/esp32c3/esp32c3_tim_lowerhalf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/risc-v/src/esp32c3/esp32c3_tim_lowerhalf.c b/arch/risc-v/src/esp32c3/esp32c3_tim_lowerhalf.c
index d7baf881ff..89f5ff4985 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_tim_lowerhalf.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_tim_lowerhalf.c
@@ -134,6 +134,8 @@ static int esp32c3_timer_handler(int irq, void *context, void *arg)
     (struct esp32c3_timer_lowerhalf_s *)arg;
   uint32_t next_interval_us = 0;
 
+  ESP32C3_TIM_ACKINT(priv->tim);        /* Clear the Interrupt */
+
   if (priv->callback(&next_interval_us, priv->upper))
     {
       if (next_interval_us > 0)
@@ -149,7 +151,7 @@ static int esp32c3_timer_handler(int irq, void *context, void *arg)
     }
 
   ESP32C3_TIM_SETALRM(priv->tim, true); /* Re-enables the alarm */
-  ESP32C3_TIM_ACKINT(priv->tim);        /* Clear the Interrupt */
+
   return OK;
 }