diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-06-02 01:30:07 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-06-02 01:32:19 +0200 |
| commit | dff03ecfc74d6af716637888338ebfa99ab7a027 (patch) | |
| tree | c06bf2b0a2e6657c3427c956dbd27a4e45211aaa /examples/rp/src/bin/blinky.rs | |
| parent | a0c5f7137fe0c45b8db0aad2a116aea91e6a93f7 (diff) | |
Move examples to a subdirectory
Diffstat (limited to 'examples/rp/src/bin/blinky.rs')
| -rw-r--r-- | examples/rp/src/bin/blinky.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs new file mode 100644 index 000000000..e42999912 --- /dev/null +++ b/examples/rp/src/bin/blinky.rs | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(asm)] | ||
| 4 | #![feature(min_type_alias_impl_trait)] | ||
| 5 | #![feature(impl_trait_in_bindings)] | ||
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(incomplete_features)] | ||
| 8 | |||
| 9 | #[path = "../example_common.rs"] | ||
| 10 | mod example_common; | ||
| 11 | |||
| 12 | use defmt::*; | ||
| 13 | use embassy::executor::Spawner; | ||
| 14 | use embassy_rp::{gpio, Peripherals}; | ||
| 15 | use embedded_hal::digital::v2::OutputPin; | ||
| 16 | use gpio::{Level, Output}; | ||
| 17 | |||
| 18 | #[embassy::main] | ||
| 19 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 20 | let mut led = Output::new(p.PIN_25, Level::Low); | ||
| 21 | |||
| 22 | loop { | ||
| 23 | info!("led on!"); | ||
| 24 | led.set_high().unwrap(); | ||
| 25 | cortex_m::asm::delay(1_000_000); | ||
| 26 | |||
| 27 | info!("led off!"); | ||
| 28 | led.set_low().unwrap(); | ||
| 29 | cortex_m::asm::delay(1_000_000); | ||
| 30 | } | ||
| 31 | } | ||
