File tree 1 file changed +4
-7
lines changed
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) {
380
380
freq_hz = R_FSP_SystemClockHzGet (FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div ;
381
381
}
382
382
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 );
384
384
if (!set_duty_cycle (pulse_counts_ms, pwm_ch)) {
385
385
return false ;
386
386
}
387
-
388
- return true ;
389
-
387
+ return true ;
390
388
}
391
389
392
390
/* -------------------------------------------------------------------------- */
@@ -399,12 +397,11 @@ bool FspTimer::set_pulse_us(double us,TimerPWMChannel_t pwm_ch) {
399
397
else if (type == AGT_TIMER){
400
398
freq_hz = R_FSP_SystemClockHzGet (FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div ;
401
399
}
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 );
404
402
if (!set_duty_cycle (pulse_counts_us, pwm_ch)) {
405
403
return false ;
406
404
}
407
-
408
405
return true ;
409
406
}
410
407
You can’t perform that action at this time.
0 commit comments