mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Trigger gyro SPI DMA reads in EXTI handler if supported and lock gyroTask loop to gyro to eliminate missed updates and jitter
This commit is contained in:
parent
415d4db5aa
commit
d5f62be013
63 changed files with 755 additions and 379 deletions
|
@ -68,7 +68,7 @@ void cycleCounterInit(void)
|
|||
|
||||
#if defined(DWT_LAR_UNLOCK_VALUE)
|
||||
#if defined(STM32F7) || defined(STM32H7)
|
||||
DWT->LAR = DWT_LAR_UNLOCK_VALUE;
|
||||
ITM->LAR = DWT_LAR_UNLOCK_VALUE;
|
||||
#elif defined(STM32F3) || defined(STM32F4)
|
||||
// Note: DWT_Type does not contain LAR member.
|
||||
#define DWT_LAR
|
||||
|
@ -146,7 +146,7 @@ uint32_t micros(void)
|
|||
return (ms * 1000) + (usTicks * 1000 - cycle_cnt) / usTicks;
|
||||
}
|
||||
|
||||
inline uint32_t getCycleCounter(void)
|
||||
uint32_t getCycleCounter(void)
|
||||
{
|
||||
return DWT->CYCCNT;
|
||||
}
|
||||
|
@ -156,6 +156,17 @@ uint32_t clockCyclesToMicros(uint32_t clockCycles)
|
|||
return clockCycles / usTicks;
|
||||
}
|
||||
|
||||
// Note that this conversion is signed as this is used for periods rather than absolute timestamps
|
||||
int32_t clockCyclesTo10thMicros(int32_t clockCycles)
|
||||
{
|
||||
return 10 * clockCycles / (int32_t)usTicks;
|
||||
}
|
||||
|
||||
uint32_t clockMicrosToCycles(uint32_t micros)
|
||||
{
|
||||
return micros * usTicks;
|
||||
}
|
||||
|
||||
// Return system uptime in milliseconds (rollover in 49 days)
|
||||
uint32_t millis(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue