pwm_stm32: Fix stm32_pwm_set_frequency return value
Function should return actual PWM frequency that was set.
It returned negative value on error but 0 for success.
Now function return actual frequency.
@@ -345,7 +345,7 @@ stm32_pwm_set_frequency(struct pwm_dev *dev, uint32_t freq_hz)
LL_TIM_SetPrescaler(pwm->timx, div1);
LL_TIM_SetAutoReload(pwm->timx, div2);
- return STM32_PWM_ERR_OK;
+ return timer_clock / (div1 + 1) / (div2 + 1);
}
static int
