mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 23:35:34 +03:00
PWM output calculations dynamic based on clock speed
This commit is contained in:
parent
14f82e2a63
commit
b9ebf8f4fd
11 changed files with 117 additions and 139 deletions
|
@ -204,7 +204,7 @@ static bool isTimerPeriodTooLarge(uint32_t timerPeriod)
|
|||
|
||||
static void serialTimerConfigureTimebase(const timerHardware_t *timerHardwarePtr, uint32_t baud)
|
||||
{
|
||||
uint32_t baseClock = SystemCoreClock / timerClockDivisor(timerHardwarePtr->tim);
|
||||
uint32_t baseClock = timerClock(timerHardwarePtr->tim);
|
||||
uint32_t clock = baseClock;
|
||||
uint32_t timerPeriod;
|
||||
|
||||
|
@ -220,9 +220,7 @@ static void serialTimerConfigureTimebase(const timerHardware_t *timerHardwarePtr
|
|||
}
|
||||
} while (isTimerPeriodTooLarge(timerPeriod));
|
||||
|
||||
uint8_t mhz = baseClock / 1000000;
|
||||
|
||||
timerConfigure(timerHardwarePtr, timerPeriod, mhz);
|
||||
timerConfigure(timerHardwarePtr, timerPeriod, baseClock);
|
||||
}
|
||||
|
||||
static void resetBuffers(softSerial_t *softSerial)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue