@@ -71,11 +71,13 @@ pub trait SetDuty: ErrorType {
7171 fn set_duty ( & mut self , duty : u16 ) -> Result < ( ) , Self :: Error > ;
7272
7373 /// Set the duty cycle to 0%, or always inactive.
74+ #[ inline]
7475 fn set_off ( & mut self ) -> Result < ( ) , Self :: Error > {
7576 self . set_duty ( 0 )
7677 }
7778
7879 /// Set the duty cycle to 100%, or always active.
80+ #[ inline]
7981 fn set_on ( & mut self ) -> Result < ( ) , Self :: Error > {
8082 self . set_duty ( self . get_max_duty ( ) )
8183 }
@@ -84,6 +86,7 @@ pub trait SetDuty: ErrorType {
8486 ///
8587 /// The caller is responsible for ensuring that `num` is less than or equal to `denom`,
8688 /// and that `denom` is not zero.
89+ #[ inline]
8790 fn set_fraction ( & mut self , num : u16 , denom : u16 ) -> Result < ( ) , Self :: Error > {
8891 let duty = num as u32 * self . get_max_duty ( ) as u32 / denom as u32 ;
8992 self . set_duty ( duty as u16 )
@@ -92,6 +95,7 @@ pub trait SetDuty: ErrorType {
9295 /// Set the duty cycle to `percent / 100`
9396 ///
9497 /// The caller is responsible for ensuring that `percent` is less than or equal to 100.
98+ #[ inline]
9599 fn set_percent ( & mut self , percent : u8 ) -> Result < ( ) , Self :: Error > {
96100 self . set_fraction ( percent as u16 , 100 )
97101 }
0 commit comments