From f1757e8d13dba2a0f06abbeb6aed84c39c272fd0 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 5 Jan 2020 19:23:39 +0100 Subject: [PATCH] application: Factor out the reset_requested() function. No change in behavior. --- src/application/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(); } } -- 2.30.2