File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,22 @@ impl IndependentWatchDog {
92
92
self . iwdg . kr . write ( |w| w. key ( ) . reset ( ) ) ;
93
93
a
94
94
}
95
+
96
+ /// Stop the watchdog timer
97
+ pub fn stop ( & mut self ) -> Self {
98
+ self . access_registers ( |iwdg| {
99
+ iwdg. pr . reset ( ) ;
100
+ iwdg. rlr . reset ( ) ;
101
+ } ) ;
102
+ }
103
+
104
+ /// Release the independent watchdog peripheral.
105
+ ///
106
+ /// Disables the watchdog before releasing it.
107
+ pub fn free ( mut self ) -> IWDG {
108
+ self . stop ( ) ;
109
+ self . iwdg
110
+ }
95
111
}
96
112
97
113
impl WatchdogEnable for IndependentWatchDog {
Original file line number Diff line number Diff line change @@ -81,4 +81,11 @@ mod tests {
81
81
asm:: delay ( delay) ;
82
82
}
83
83
}
84
+
85
+ // It takes some time, until defmt_test exits.
86
+ // In this time, the wathcodg can not be fed. So disable it in the last test.
87
+ #[ test]
88
+ fn disable ( state : & mut State ) {
89
+ state. iwdg . stop ( ) ;
90
+ }
84
91
}
You can’t perform that action at this time.
0 commit comments