File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32 Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ void pwmout_write(pwmout_t *obj, float value)
139
139
value = 1 ;
140
140
}
141
141
142
- float pulse_period_in_s = obj -> period_cycles / (float ) pwm_clockfreq ;
142
+ float pulse_period_in_s = obj -> period_cycles / (( float ) ( pwm_clockfreq >> pwm_prescaler_div )) ;
143
143
pwmout_pulsewidth (obj , value * pulse_period_in_s );
144
144
}
145
145
@@ -192,7 +192,7 @@ void pwmout_period_us(pwmout_t *obj, int us)
192
192
193
193
void pwmout_pulsewidth (pwmout_t * obj , float seconds )
194
194
{
195
- obj -> width_cycles = pwm_clockfreq * seconds ;
195
+ obj -> width_cycles = ( uint32_t ) ((( float ) ( pwm_clockfreq >> pwm_prescaler_div )) * seconds ) ;
196
196
TIMER_CompareBufSet (PWM_TIMER , obj -> channel , obj -> width_cycles );
197
197
}
198
198
You can’t perform that action at this time.
0 commit comments