Merge pull request #4454 from haukepetersen/fix_stm32f4_pwmfreq
cpu/stm32f4discovery: fixed freq return in pwm_init
This commit is contained in:
commit
26eeb9f544
@ -120,6 +120,8 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re
|
|||||||
}
|
}
|
||||||
tim->PSC = (pwm_clk / (resolution * frequency)) - 1;
|
tim->PSC = (pwm_clk / (resolution * frequency)) - 1;
|
||||||
tim->ARR = resolution - 1;
|
tim->ARR = resolution - 1;
|
||||||
|
/* calculate the actual PWM frequency */
|
||||||
|
frequency = (pwm_clk / (resolution * (tim->PSC + 1)));
|
||||||
|
|
||||||
/* set PWM mode */
|
/* set PWM mode */
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user