@@ -71,11 +71,13 @@ pub trait SetDuty: ErrorType {
71
71
fn set_duty ( & mut self , duty : u16 ) -> Result < ( ) , Self :: Error > ;
72
72
73
73
/// Set the duty cycle to 0%, or always inactive.
74
+ #[ inline]
74
75
fn set_off ( & mut self ) -> Result < ( ) , Self :: Error > {
75
76
self . set_duty ( 0 )
76
77
}
77
78
78
79
/// Set the duty cycle to 100%, or always active.
80
+ #[ inline]
79
81
fn set_on ( & mut self ) -> Result < ( ) , Self :: Error > {
80
82
self . set_duty ( self . get_max_duty ( ) )
81
83
}
@@ -84,6 +86,7 @@ pub trait SetDuty: ErrorType {
84
86
///
85
87
/// The caller is responsible for ensuring that `num` is less than or equal to `denom`,
86
88
/// and that `denom` is not zero.
89
+ #[ inline]
87
90
fn set_fraction ( & mut self , num : u16 , denom : u16 ) -> Result < ( ) , Self :: Error > {
88
91
let duty = num as u32 * self . get_max_duty ( ) as u32 / denom as u32 ;
89
92
self . set_duty ( duty as u16 )
@@ -92,6 +95,7 @@ pub trait SetDuty: ErrorType {
92
95
/// Set the duty cycle to `percent / 100`
93
96
///
94
97
/// The caller is responsible for ensuring that `percent` is less than or equal to 100.
98
+ #[ inline]
95
99
fn set_percent ( & mut self , percent : u8 ) -> Result < ( ) , Self :: Error > {
96
100
self . set_fraction ( percent as u16 , 100 )
97
101
}
0 commit comments