From 17933a37757dfc2ee43011f69fd213fc10d69600 Mon Sep 17 00:00:00 2001 From: Jonas Jacobsson <01joja@gamil.com> Date: Tue, 23 Feb 2021 19:07:24 +0100 Subject: [PATCH] This will be removed --- src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d945d0b..9faf11a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,8 @@ const APP: () = { struct Resources { // late resources GPIOA: stm32::GPIOA, + GPIOC: stm32::GPIOC, + //button: <stm32::GPIOC as int>::PC13, } #[init(schedule = [toggle])] @@ -59,9 +61,15 @@ const APP: () = { // configure PA5 as output, RM0368 8.4.1 device.GPIOA.moder.modify(|_, w| w.moder5().bits(1)); + // Test button thingy. Think I put PC13 to input + device.GPIOC.moder.modify(|_, w| w.moder13().bits(0)); + // device.GPIOC.pupdr.modify(|_, w| w.pupdr13().bits(0)); + // pass on late resources init::LateResources { GPIOA: device.GPIOA, + GPIOC: device.GPIOC, + //button: device.button, } } @@ -76,7 +84,7 @@ const APP: () = { - #[task(resources = [GPIOA], schedule = [toggle])] + #[task(resources = [GPIOA,GPIOC], schedule = [toggle])] fn toggle(cx: toggle::Context) { static mut TOGGLE: bool = false; rprintln!("toggle @ {:?}", Instant::now()); @@ -87,10 +95,13 @@ const APP: () = { cx.resources.GPIOA.bsrr.write(|w| w.br5().set_bit()); } + //cx.resources.GPIOC.PullDown; + *TOGGLE = !*TOGGLE; cx.schedule .toggle(cx.scheduled + 16_000_000.cycles()) .unwrap(); + } extern "C" { -- GitLab