diff options
| author | jrmoulton <[email protected]> | 2025-06-10 15:47:54 -0600 |
|---|---|---|
| committer | jrmoulton <[email protected]> | 2025-06-10 15:48:36 -0600 |
| commit | cfad9798ff99d4de0571a512d156b5fe1ef1d427 (patch) | |
| tree | fc3bf670f82d139de19466cddad1e909db7f3d2e /examples/lpc55s69/src/bin/button_executor.rs | |
| parent | fc342915e6155dec7bafa3e135da7f37a9a07f5c (diff) | |
| parent | 6186d111a5c150946ee5b7e9e68d987a38c1a463 (diff) | |
merge new embassy changes
Diffstat (limited to 'examples/lpc55s69/src/bin/button_executor.rs')
| -rw-r--r-- | examples/lpc55s69/src/bin/button_executor.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/lpc55s69/src/bin/button_executor.rs b/examples/lpc55s69/src/bin/button_executor.rs new file mode 100644 index 000000000..836b1c9eb --- /dev/null +++ b/examples/lpc55s69/src/bin/button_executor.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | //! This example has been made with the LPCXpresso55S69 board in mind, which has a built-in LED on | ||
| 2 | //! PIO1_6 and a button (labeled "user") on PIO1_9. | ||
| 3 | |||
| 4 | #![no_std] | ||
| 5 | #![no_main] | ||
| 6 | |||
| 7 | use defmt::*; | ||
| 8 | use embassy_executor::Spawner; | ||
| 9 | use embassy_nxp::gpio::{Input, Level, Output, Pull}; | ||
| 10 | use {defmt_rtt as _, panic_halt as _}; | ||
| 11 | |||
| 12 | #[embassy_executor::main] | ||
| 13 | async fn main(_spawner: Spawner) -> ! { | ||
| 14 | let p = embassy_nxp::init(Default::default()); | ||
| 15 | |||
| 16 | let mut led = Output::new(p.PIO1_6, Level::Low); | ||
| 17 | let mut button = Input::new(p.PIO1_9, Pull::Up); | ||
| 18 | |||
| 19 | info!("Entered main loop"); | ||
| 20 | loop { | ||
| 21 | button.wait_for_rising_edge().await; | ||
| 22 | info!("Button pressed"); | ||
| 23 | led.toggle(); | ||
| 24 | } | ||
| 25 | } | ||
