@@ -15,29 +15,41 @@ pub trait Watchdog {
15
15
16
16
/// Enables A watchdog timer to reset the processor if software is frozen or
17
17
/// stalled.
18
- pub trait WatchdogEnable {
19
- /// An enumeration of `WatchdogEnable ` errors.
18
+ pub trait Enable {
19
+ /// An enumeration of `Enable ` errors.
20
20
///
21
21
/// For infallible implementations, will be `Infallible`
22
22
type Error ;
23
23
24
24
/// Unit of time used by the watchdog
25
25
type Time ;
26
26
27
- /// Starts the watchdog with a given period, typically once this is done
28
- /// the watchdog needs to be kicked periodically or the processor is reset.
29
- fn try_start < T > ( & mut self , period : T ) -> Result < ( ) , Self :: Error >
27
+ /// The started watchdog that should be `feed()`
28
+ type Target : Watchdog ;
29
+
30
+ /// Starts the watchdog with a given period, typically once this is done
31
+ /// the watchdog needs to be kicked periodically or the processor is reset.
32
+ ///
33
+ /// This consumes the value and returns the `Watchdog` trait that you must
34
+ /// `feed()`.
35
+ fn try_start < T > ( & mut self , period : T ) -> Result < Self :: Target , Self :: Error >
30
36
where
31
37
T : Into < Self :: Time > ;
32
38
}
33
39
34
40
/// Disables a running watchdog timer so the processor won't be reset.
35
- pub trait WatchdogDisable {
36
- /// An enumeration of `WatchdogDisable ` errors.
41
+ pub trait Disable {
42
+ /// An enumeration of `Disable ` errors.
37
43
///
38
44
/// For infallible implementations, will be `Infallible`
39
45
type Error ;
40
46
47
+ /// Disabled watchdog instance that can be enabled.
48
+ type Target : Enable ;
49
+
41
50
/// Disables the watchdog
42
- fn try_disable ( & mut self ) -> Result < ( ) , Self :: Error > ;
51
+ ///
52
+ /// This stops the watchdog and returns the `Enable` trait so that
53
+ /// it can be started again.
54
+ fn try_disable ( & mut self ) -> Result < Self :: Target , Self :: Error > ;
43
55
}
0 commit comments