application: Perform system reset from panic handler if requested.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sat, 4 Jan 2020 18:29:57 +0000 (19:29 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Mon, 6 Jan 2020 09:45:34 +0000 (10:45 +0100)
This is untested; I'm not sure if it would work at all.

src/application/main.rs

index 4cad3e326ee1720361a991c263b6e7ec3db33d16..92429e5d4a404d05ed0a4ef9bba4a544cabe60ff 100644 (file)
@@ -79,6 +79,9 @@ impl Timer {
 #[panic_handler]
 fn panic(_info: &core::panic::PanicInfo) -> ! {
     loop {
+        if (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 {
+            nvic::system_reset();
+        }
     }
 }