Write button events to the serial port
This commit is contained in:
parent
07c4a3ccc6
commit
e5b6a81841
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue