mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 03:50:02 +03:00
Cache sysTickPending inside ATOMIC_BLOCK
This commit is contained in:
parent
59e78fcd8e
commit
a89c36b5e1
1 changed files with 3 additions and 2 deletions
|
@ -78,7 +78,7 @@ void SysTick_Handler(void)
|
|||
|
||||
uint32_t microsISR(void)
|
||||
{
|
||||
register uint32_t ms, cycle_cnt;
|
||||
register uint32_t ms, pending, cycle_cnt;
|
||||
|
||||
ATOMIC_BLOCK(NVIC_PRIO_MAX) {
|
||||
cycle_cnt = SysTick->VAL;
|
||||
|
@ -97,9 +97,10 @@ uint32_t microsISR(void)
|
|||
}
|
||||
|
||||
ms = sysTickUptime;
|
||||
pending = sysTickPending;
|
||||
}
|
||||
|
||||
return ((ms + sysTickPending) * 1000) + (usTicks * 1000 - cycle_cnt) / usTicks;
|
||||
return ((ms + pending) * 1000) + (usTicks * 1000 - cycle_cnt) / usTicks;
|
||||
}
|
||||
|
||||
uint32_t micros(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue