Write button events to the serial port

This commit is contained in:
Paul van Tilburg 2019-03-12 15:47:40 +01:00
parent 07c4a3ccc6
commit e5b6a81841
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}