mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 09:16:07 +03:00
Mixed one timerClockDivisor
This commit is contained in:
parent
647b8b786f
commit
6e596cb252
1 changed files with 2 additions and 2 deletions
|
@ -846,8 +846,8 @@ uint16_t timerDmaSource(uint8_t channel)
|
||||||
|
|
||||||
uint16_t timerGetPrescalerByDesiredMhz(TIM_TypeDef *tim, uint16_t mhz)
|
uint16_t timerGetPrescalerByDesiredMhz(TIM_TypeDef *tim, uint16_t mhz)
|
||||||
{
|
{
|
||||||
// protection here for desired MHZ > SystemCoreClock???
|
// protection here for desired MHZ > timerClock???
|
||||||
if ((uint32_t)(mhz * 1000000) > (SystemCoreClock / timerClockDivisor(tim))) {
|
if ((uint32_t)(mhz * 1000000) > timerClock(tim)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (uint16_t)(round((timerClock(tim) / (mhz * 1000000)) - 1));
|
return (uint16_t)(round((timerClock(tim) / (mhz * 1000000)) - 1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue