diff options
| author | Mathias <[email protected]> | 2022-08-18 21:08:57 +0200 |
|---|---|---|
| committer | Mathias <[email protected]> | 2022-08-18 21:08:57 +0200 |
| commit | a7d6bc7ba5faef3d711b944baf6c8e3685fdb37e (patch) | |
| tree | d35085173fb8e4a0ff3b6357e3aaef18c6124e6e /docs/modules/ROOT/examples/basic | |
| parent | 9c9b7b1a66dc90a9183886867811d2db57df714c (diff) | |
| parent | aefa5275a2ab2cac6caef599e7adb76ce1beeddd (diff) | |
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/dma
Diffstat (limited to 'docs/modules/ROOT/examples/basic')
| -rw-r--r-- | docs/modules/ROOT/examples/basic/Cargo.toml | 1 | ||||
| -rw-r--r-- | docs/modules/ROOT/examples/basic/src/main.rs | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/docs/modules/ROOT/examples/basic/Cargo.toml b/docs/modules/ROOT/examples/basic/Cargo.toml index 59e1a437a..ae124a871 100644 --- a/docs/modules/ROOT/examples/basic/Cargo.toml +++ b/docs/modules/ROOT/examples/basic/Cargo.toml | |||
| @@ -6,6 +6,7 @@ version = "0.1.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } | 8 | embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } |
| 9 | embassy-time = { version = "0.1.0", path = "../../../../../embassy-time", features = ["defmt", "nightly"] } | ||
| 9 | embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } | 10 | embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } |
| 10 | 11 | ||
| 11 | defmt = "0.3" | 12 | defmt = "0.3" |
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs index cec39fd91..04170db55 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/modules/ROOT/examples/basic/src/main.rs | |||
| @@ -3,11 +3,10 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_executor::time::{Duration, Timer}; | ||
| 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 9 | use embassy_nrf::peripherals::P0_13; | 8 | use embassy_nrf::peripherals::P0_13; |
| 10 | use embassy_nrf::Peripherals; | 9 | use embassy_time::{Duration, Timer}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; // global logger | 10 | use {defmt_rtt as _, panic_probe as _}; // global logger |
| 12 | 11 | ||
| 13 | #[embassy_executor::task] | 12 | #[embassy_executor::task] |
| @@ -21,7 +20,9 @@ async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | |||
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | #[embassy_executor::main] | 22 | #[embassy_executor::main] |
| 24 | async fn main(spawner: Spawner, p: Peripherals) { | 23 | async fn main(spawner: Spawner) { |
| 24 | let p = embassy_nrf::init(Default::default()); | ||
| 25 | |||
| 25 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 26 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 26 | unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); | 27 | unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); |
| 27 | } | 28 | } |
