impl wdt modes#556
Conversation
Rahix
left a comment
There was a problem hiding this comment.
Hi, thanks a lot for the contribution!
Please have a look at the CI failures. Is this something you need to fix on your side or is it about bad register definitions that need to be fixed in avr-device?
Additionally, please add an example to examples/arduino-uno which demonstrates the use of the WDT interrupt.
| Self { p, _h: PhantomData } | ||
| } | ||
|
|
||
| pub fn rearm(&mut self, m: &WDT::MCUSR) { |
There was a problem hiding this comment.
Please add documentation: What is this function used for? What effects does it have?
| self.p.raw_init(m); | ||
| } | ||
|
|
||
| pub fn set_mode(&mut self, mode: WdtMode) { |
|
|
||
| #[derive(Copy, Clone)] | ||
| /// The mode that dictates how the watchdog should behave. | ||
| /// This needs to be called **after** the `start` function. |
There was a problem hiding this comment.
You cannot "call" an enum. This statement probably belongs into the documentation of one of the methods?
| /// **Warning**: On many `atmega` devices, a watchdog timeout resets the mode automatically, to | ||
| /// prevent the microcontroller from getting stuck in a infinite loop. So subsequent timeouts |
There was a problem hiding this comment.
Please be specific here: Which MCUs actually behave like this and which don't? Is it even a good idea to distingush about this or should we rather require the call of rearm() on every AVR microcontroller?
This adds the ability to set the mode for the watchdog.
Previously the wdt mode was enforced to softreset the board.
Now we can also set it to trigger the
WDTinterrupt by callingwatchdog.set_mode().This PR closes #552
Please let me know if there is anything i need to change!