From e5b6a818411828317d3a30542f90aabd337af7bf Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Tue, 12 Mar 2019 15:47:40 +0100 Subject: [PATCH] Write button events to the serial port --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ae75a39..4e3ec28 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,10 +86,15 @@ const APP: () = { }); } - #[interrupt(binds = EXTI0, resources = [button, exti, led_cycle])] + #[interrupt(binds = EXTI0, resources = [button, exti, led_cycle, serial_tx])] fn button_pressed() { resources.led_cycle.lock(|led_cycle| led_cycle.reverse()); + // Write the fact that the button has been pressed to the serial port. + resources + .serial_tx + .lock(|serial_tx| writeln!(serial_tx, "button").unwrap()); + resources.button.clear_interrupt_pending_bit(resources.exti); }