Fix doc example compile

This commit is contained in:
Ulf Lilleengen 2021-12-10 12:58:23 +01:00
parent e5d4d0952b
commit aa0abe976a
3 changed files with 10 additions and 8 deletions

View file

@ -5,9 +5,8 @@ name = "embassy-basic-example"
version = "0.1.0"
[dependencies]
embassy = { version = "0.1.0", path = "../../../../embassy", features = ["defmt"] }
embassy-traits = { version = "0.1.0", path = "../../../../embassy-traits", features = ["defmt"] }
embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
embassy = { version = "0.1.0", path = "../../../../../embassy", features = ["defmt"] }
embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
defmt = "0.3"
defmt-rtt = "0.3"

View file

@ -9,8 +9,11 @@ use defmt::*;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_nrf::Peripherals;
use embassy_nrf::{
gpio::{Level, Output, OutputDrive},
peripherals::P0_13,
Peripherals,
};
use embedded_hal::digital::v2::OutputPin;
#[embassy::task]

View file

@ -30,7 +30,7 @@ After a bit of import declaration, the tasks run by the application should be de
[source,rust]
----
include::example$basic/src/main.rs[lines="16..24"]
include::example$basic/src/main.rs[lines="18..27"]
----
An embassy task must be declared `async`, and may NOT take generic arguments. In this case, we are handed the LED that should be blinked and the interval of the blinking.
@ -45,7 +45,7 @@ The `Spawner` is the way the main application spawns other tasks. The `Periphera
[source,rust]
----
include::example$basic/src/main.rs[lines="26..30"]
include::example$basic/src/main.rs[lines="28..-1"]
----
@ -64,7 +64,7 @@ The project definition needs to contain the embassy dependencies:
[source,toml]
----
include::example$basic/Cargo.toml[lines="8..10"]
include::example$basic/Cargo.toml[lines="8..9"]
----
Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well).