@@ -847,6 +847,9 @@ pub trait Capture {
847
847
// reason: pre-singletons API. The `PwmPin` trait seems more useful because it models independent
848
848
// PWM channels. Here a certain number of channels are multiplexed in a single implementer.
849
849
pub trait Pwm {
850
+ /// Enumeration of `Pwm` errors
851
+ type Error ;
852
+
850
853
/// Enumeration of channels that can be used with this `Pwm` interface
851
854
///
852
855
/// If your `Pwm` interface has no channels you can use the type `()`
@@ -863,25 +866,25 @@ pub trait Pwm {
863
866
type Duty ;
864
867
865
868
/// Disables a PWM `channel`
866
- fn disable ( & mut self , channel : Self :: Channel ) ;
869
+ fn disable ( & mut self , channel : Self :: Channel ) -> Result < ( ) , Self :: Error > ;
867
870
868
871
/// Enables a PWM `channel`
869
- fn enable ( & mut self , channel : Self :: Channel ) ;
872
+ fn enable ( & mut self , channel : Self :: Channel ) -> Result < ( ) , Self :: Error > ;
870
873
871
874
/// Returns the current PWM period
872
- fn get_period ( & self ) -> Self :: Time ;
875
+ fn get_period ( & self ) -> Result < Self :: Time , Self :: Error > ;
873
876
874
877
/// Returns the current duty cycle
875
- fn get_duty ( & self , channel : Self :: Channel ) -> Self :: Duty ;
878
+ fn get_duty ( & self , channel : Self :: Channel ) -> Result < Self :: Duty , Self :: Error > ;
876
879
877
880
/// Returns the maximum duty cycle value
878
- fn get_max_duty ( & self ) -> Self :: Duty ;
881
+ fn get_max_duty ( & self ) -> Result < Self :: Duty , Self :: Error > ;
879
882
880
883
/// Sets a new duty cycle
881
- fn set_duty ( & mut self , channel : Self :: Channel , duty : Self :: Duty ) ;
884
+ fn set_duty ( & mut self , channel : Self :: Channel , duty : Self :: Duty ) -> Result < ( ) , Self :: Error > ;
882
885
883
886
/// Sets a new PWM period
884
- fn set_period < P > ( & mut self , period : P )
887
+ fn set_period < P > ( & mut self , period : P ) -> Result < ( ) , Self :: Error >
885
888
where
886
889
P : Into < Self :: Time > ;
887
890
}
0 commit comments