application: Perform a system reset if PTA12 is pressed.
authorTilman Sauerbeck <tilman@code-monkey.de>
Wed, 18 Dec 2019 09:00:22 +0000 (10:00 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000 (20:38 +0100)
src/application/main.rs

index 1fdc577cf9c55fca378798ce5434a390ac345eb4..bd1091f3c2bbca3632de41c8c536bd7619b34d80 100644 (file)
@@ -32,6 +32,7 @@ use common::clock;
 use common::systick;
 use common::port;
 use common::gpio;
+use common::nvic;
 use common::usb_serial;
 
 extern {
@@ -63,5 +64,9 @@ pub unsafe extern fn main() {
 
         cdc_tx_buf.write(b".\n");
         cdc_tx_buf.flush();
+
+        if (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 {
+            nvic::system_reset();
+        }
     }
 }