From: Tilman Sauerbeck Date: Sun, 5 Jan 2020 18:23:39 +0000 (+0100) Subject: application: Factor out the reset_requested() function. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=f1757e8d13dba2a0f06abbeb6aed84c39c272fd0;p=gps-watch.git application: Factor out the reset_requested() function. No change in behavior. --- diff --git a/src/application/main.rs b/src/application/main.rs index 8f7bd6d..2476630 100644 --- a/src/application/main.rs +++ b/src/application/main.rs @@ -76,11 +76,15 @@ impl Timer { } } +fn reset_requested() -> bool { + (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 +} + #[inline(never)] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop { - if (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 { + if reset_requested() { nvic::system_reset(); } } @@ -230,7 +234,7 @@ pub unsafe extern "C" fn _start() -> ! { } }); - if (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 { + if reset_requested() { nvic::system_reset(); } }