mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
The interrupt occurs over the counter overflow
This commit is contained in:
@@ -693,17 +693,17 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
stm32_putreg16(priv, STM32_GTIM_SR_OFFSET, regval & ~GTIM_SR_UIF);
|
stm32_putreg16(priv, STM32_GTIM_SR_OFFSET, regval & ~GTIM_SR_UIF);
|
||||||
|
|
||||||
/* Check the direction bit in the CR1 register and add or subtract the
|
/* Check the direction bit in the CR1 register and add or subtract the
|
||||||
* maximum value, as appropriate.
|
* maximum value + 1, as appropriate.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regval = stm32_getreg16(priv, STM32_GTIM_CR1_OFFSET);
|
regval = stm32_getreg16(priv, STM32_GTIM_CR1_OFFSET);
|
||||||
if ((regval & ATIM_CR1_DIR) != 0)
|
if ((regval & ATIM_CR1_DIR) != 0)
|
||||||
{
|
{
|
||||||
priv->position -= (int32_t)0x0000ffff;
|
priv->position -= (int32_t)0x00010000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
priv->position += (int32_t)0x0000ffff;
|
priv->position += (int32_t)0x00010000;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user