mirror of https://github.com/ARMmbed/mbed-os.git
Add some rounding to determine the pulse value for PWM for the STM target.
parent
3b138fba02
commit
db3f05e5fe
|
@ -182,7 +182,7 @@ void pwmout_write(pwmout_t *obj, float value)
|
||||||
value = 1.0;
|
value = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->pulse = (uint32_t)((float)obj->period * value);
|
obj->pulse = (uint32_t)((float)obj->period * value + 0.5);
|
||||||
|
|
||||||
// Configure channels
|
// Configure channels
|
||||||
sConfig.OCMode = TIM_OCMODE_PWM1;
|
sConfig.OCMode = TIM_OCMODE_PWM1;
|
||||||
|
|
Loading…
Reference in New Issue