1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

Tightening up code inside atomic block, and whitespace changes (tabs to spaces)

This commit is contained in:
Ben Hitchcock 2014-12-04 06:59:27 +08:00
parent 8a9e51c779
commit 895d215265
3 changed files with 40 additions and 40 deletions

View file

@ -806,12 +806,13 @@ void timerStart(void)
**/
void timerForceOverflow(volatile TIM_TypeDef *tim)
{
ATOMIC_BLOCK(NVIC_PRIO_TIMER) {
// Save the current count so that PPM reading will work on the same timer that was forced to overflow
uint8_t timerIndex = lookupTimerIndex((const TIM_TypeDef *)tim);
timerConfig[timerIndex].forcedOverflowTimerValue = tim->CNT + 1;
uint8_t timerIndex = lookupTimerIndex((const TIM_TypeDef *)tim);
// Force an overflow by setting the UG bit
tim->EGR |= TIM_EGR_UG;
}
ATOMIC_BLOCK(NVIC_PRIO_TIMER) {
// Save the current count so that PPM reading will work on the same timer that was forced to overflow
timerConfig[timerIndex].forcedOverflowTimerValue = tim->CNT + 1;
// Force an overflow by setting the UG bit
tim->EGR |= TIM_EGR_UG;
}
}