Merge pull request #9105 from LaurentLouf/improve-precision-duty-cycle-pwm-stm

Add some rounding to determine the pulse value for PWM for the STM target
pull/9122/head
Cruz Monrreal 2018-12-17 14:43:43 -06:00 committed by GitHub
commit ff6744c85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;