Add some rounding to determine the pulse value for PWM for the STM target.

pull/9105/head
Laurent Louf 2018-12-14 12:08:09 +01:00
parent 3b138fba02
commit db3f05e5fe
1 changed files with 1 additions and 1 deletions

View File

@ -182,7 +182,7 @@ void pwmout_write(pwmout_t *obj, float value)
value = 1.0;
}
obj->pulse = (uint32_t)((float)obj->period * value);
obj->pulse = (uint32_t)((float)obj->period * value + 0.5);
// Configure channels
sConfig.OCMode = TIM_OCMODE_PWM1;