changed for STM32F4
Fork of FastPWM by
Diff: FastPWM_common.cpp
- Revision:
- 18:d91c0629e4e6
- Parent:
- 12:4600daab8a83
--- a/FastPWM_common.cpp Sat Oct 04 13:14:44 2014 +0000 +++ b/FastPWM_common.cpp Sat Oct 04 20:54:56 2014 +0000 @@ -95,9 +95,9 @@ void FastPWM::updateTicks( uint32_t prescaler ) { dticks = SystemCoreClock / (double)prescaler; - dticks_us = SystemCoreClock / (double)prescaler / 1000000.0f; - iticks_ms = SystemCoreClock / prescaler / 1000; - iticks_us = SystemCoreClock / prescaler / 1000000; + dticks_us = dticks / 1000000.0f; + iticks_us = (int)(dticks_us + 0.5); + iticks_ms = (int)(dticks_us * 1000.0 + 0.5); } int FastPWM::calcPrescaler(uint64_t clocks) {