xtensa/esp32-s2/rttimer: Disable alarm before setting a new value and enabling it
This commit is contained in:
parent
33f2d46bff
commit
8a142f474e
@ -176,6 +176,7 @@ static void start_rt_timer(struct rt_timer_s *timer,
|
||||
{
|
||||
/* Reset the hardware timer alarm */
|
||||
|
||||
ESP32S2_TIM_SETALRM(priv->timer, false);
|
||||
ESP32S2_TIM_SETALRVL(priv->timer, USEC_TO_CYCLES(timer->alarm));
|
||||
ESP32S2_TIM_SETALRM(priv->timer, true);
|
||||
}
|
||||
@ -254,6 +255,7 @@ static void stop_rt_timer(struct rt_timer_s *timer)
|
||||
list);
|
||||
alarm = next_timer->alarm;
|
||||
|
||||
ESP32S2_TIM_SETALRM(priv->timer, false);
|
||||
ESP32S2_TIM_SETALRVL(priv->timer, USEC_TO_CYCLES(alarm));
|
||||
ESP32S2_TIM_SETALRM(priv->timer, true);
|
||||
}
|
||||
@ -473,6 +475,8 @@ static int rt_timer_isr(int irq, void *context, void *arg)
|
||||
timer = container_of(priv->runlist.next,
|
||||
struct rt_timer_s, list);
|
||||
alarm = timer->alarm;
|
||||
|
||||
ESP32S2_TIM_SETALRM(priv->timer, false);
|
||||
ESP32S2_TIM_SETALRVL(priv->timer, USEC_TO_CYCLES(alarm));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user