Merged in lihaichen/nuttx/stm32_tim (pull request #806)
fix stm32 tim bug Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
parent
3dd479d1b9
commit
8e7f8bbde3
@ -270,7 +270,7 @@ static int stm32_timer_handler(int irq, void * context, void * arg)
|
||||
FAR struct stm32_lowerhalf_s *lower = (struct stm32_lowerhalf_s *) arg;
|
||||
uint32_t next_interval_us = 0;
|
||||
|
||||
STM32_TIM_ACKINT(lower->tim, 0);
|
||||
STM32_TIM_ACKINT(lower->tim, ATIM_DIER_UIE);
|
||||
|
||||
if (lower->callback(&next_interval_us, lower->arg))
|
||||
{
|
||||
@ -313,7 +313,7 @@ static int stm32_start(FAR struct timer_lowerhalf_s *lower)
|
||||
if (priv->callback != NULL)
|
||||
{
|
||||
STM32_TIM_SETISR(priv->tim, stm32_timer_handler, priv, 0);
|
||||
STM32_TIM_ENABLEINT(priv->tim, 0);
|
||||
STM32_TIM_ENABLEINT(priv->tim, ATIM_DIER_UIE);
|
||||
}
|
||||
|
||||
priv->started = true;
|
||||
@ -347,7 +347,7 @@ static int stm32_stop(struct timer_lowerhalf_s *lower)
|
||||
if (priv->started)
|
||||
{
|
||||
STM32_TIM_SETMODE(priv->tim, STM32_TIM_MODE_DISABLED);
|
||||
STM32_TIM_DISABLEINT(priv->tim, 0);
|
||||
STM32_TIM_DISABLEINT(priv->tim, ATIM_DIER_UIE);
|
||||
STM32_TIM_SETISR(priv->tim, NULL, NULL, 0);
|
||||
priv->started = false;
|
||||
return OK;
|
||||
@ -435,11 +435,11 @@ static void stm32_setcallback(FAR struct timer_lowerhalf_s *lower,
|
||||
if (callback != NULL && priv->started)
|
||||
{
|
||||
STM32_TIM_SETISR(priv->tim, stm32_timer_handler, priv, 0);
|
||||
STM32_TIM_ENABLEINT(priv->tim, 0);
|
||||
STM32_TIM_ENABLEINT(priv->tim, ATIM_DIER_UIE);
|
||||
}
|
||||
else
|
||||
{
|
||||
STM32_TIM_DISABLEINT(priv->tim, 0);
|
||||
STM32_TIM_DISABLEINT(priv->tim, ATIM_DIER_UIE);
|
||||
STM32_TIM_SETISR(priv->tim, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user