File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ pub trait SetDutyCycle: ErrorType {
9595 /// and that `denom` is not zero.
9696 #[ inline]
9797 fn set_duty_cycle_fraction ( & mut self , num : u16 , denom : u16 ) -> Result < ( ) , Self :: Error > {
98- let duty = num as u32 * self . get_max_duty_cycle ( ) as u32 / denom as u32 ;
98+ let duty = u32 :: from ( num) * u32 :: from ( self . get_max_duty_cycle ( ) ) / u32:: from ( denom ) ;
9999 self . set_duty_cycle ( duty as u16 )
100100 }
101101
@@ -104,7 +104,7 @@ pub trait SetDutyCycle: ErrorType {
104104 /// The caller is responsible for ensuring that `percent` is less than or equal to 100.
105105 #[ inline]
106106 fn set_duty_cycle_percent ( & mut self , percent : u8 ) -> Result < ( ) , Self :: Error > {
107- self . set_duty_cycle_fraction ( percent as u16 , 100 )
107+ self . set_duty_cycle_fraction ( u16:: from ( percent ) , 100 )
108108 }
109109}
110110
You can’t perform that action at this time.
0 commit comments