File tree 1 file changed +2
-2
lines changed
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 {
95
95
/// and that `denom` is not zero.
96
96
#[ inline]
97
97
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 ) ;
99
99
self . set_duty_cycle ( duty as u16 )
100
100
}
101
101
@@ -104,7 +104,7 @@ pub trait SetDutyCycle: ErrorType {
104
104
/// The caller is responsible for ensuring that `percent` is less than or equal to 100.
105
105
#[ inline]
106
106
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 )
108
108
}
109
109
}
110
110
You can’t perform that action at this time.
0 commit comments