File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -380,13 +380,11 @@ bool FspTimer::set_pulse_ms(double ms,TimerPWMChannel_t pwm_ch) {
380380 freq_hz = R_FSP_SystemClockHzGet (FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div ;
381381 }
382382
383- uint32_t pulse_counts_ms = (uint32_t ) ((uint64_t ) freq_hz/ 1000 * ms);
383+ uint32_t pulse_counts_ms = (uint32_t ) ((uint64_t ) ( freq_hz * ms)/ 1000 );
384384 if (!set_duty_cycle (pulse_counts_ms, pwm_ch)) {
385385 return false ;
386386 }
387-
388- return true ;
389-
387+ return true ;
390388}
391389
392390/* -------------------------------------------------------------------------- */
@@ -399,12 +397,11 @@ bool FspTimer::set_pulse_us(double us,TimerPWMChannel_t pwm_ch) {
399397 else if (type == AGT_TIMER){
400398 freq_hz = R_FSP_SystemClockHzGet (FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div ;
401399 }
402-
403- uint32_t pulse_counts_us = (uint32_t ) ((uint64_t ) freq_hz/ 1000000 * us);
400+
401+ uint32_t pulse_counts_us = (uint32_t ) ((uint64_t ) ( freq_hz * us)/ 1000000 );
404402 if (!set_duty_cycle (pulse_counts_us, pwm_ch)) {
405403 return false ;
406404 }
407-
408405 return true ;
409406}
410407
You can’t perform that action at this time.
0 commit comments