mirror of https://github.com/ARMmbed/mbed-os.git
fix prescaler settings
parent
af534d61c0
commit
f11cb671e5
|
@ -144,8 +144,8 @@ void pwmout_period_us(pwmout_t* obj, int us) {
|
|||
uint32_t old_period_ticks = timer->MR3;
|
||||
|
||||
// for 16bit timer, set prescaler to avoid overflow
|
||||
if (timer == LPC_CT16B0 || timer == LPC_CT16B1) {
|
||||
uint16_t high_period_ticks = period_ticks >> 16;
|
||||
if ((high_period_ticks) && (timer == LPC_CT16B0 || timer == LPC_CT16B1)) {
|
||||
timer->PR = high_period_ticks;
|
||||
period_ticks /= (high_period_ticks + 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue