diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 6115e618d..d76e5ced4 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -69,4 +69,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Test
- run: cd embassy && cargo test
+ run: cd embassy-util && cargo test
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 5ce8e4e7d..1ac3fc513 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -12,10 +12,15 @@
//"embassy-net/medium-ethernet",
//"embassy-net/tcp",
//"embassy-net/pool-16",
+ //"time-tick-16mhz",
+ //"defmt-timestamp-uptime",
"nightly",
+ //"unstable-traits",
],
"rust-analyzer.linkedProjects": [
// Declare for the target you wish to develop
+ //"embassy-executor/Cargo.toml",
+ //"embassy-util/Cargo.toml",
"examples/nrf/Cargo.toml",
// "examples/rp/Cargo.toml",
// "examples/std/Cargo.toml",
diff --git a/README.md b/README.md
index a7a7ccd54..423740674 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Rust's async/await allows
- embassy-nrf, for the Nordic Semiconductor nRF52, nRF53, nRF91 series.
- **Time that Just Works** -
-No more messing with hardware timers. embassy::time provides Instant, Duration and Timer types that are globally available and never overflow.
+No more messing with hardware timers. embassy_executor::time provides Instant, Duration and Timer types that are globally available and never overflow.
- **Real-time ready** -
Tasks on the same async executor run cooperatively, but you can create multiple executors with different priorities, so that higher priority tasks preempt lower priority ones. See the example.
@@ -44,13 +44,13 @@ The nrf-softdevice cr
```rust,ignore
use defmt::info;
-use embassy::executor::Spawner;
-use embassy::time::{Duration, Timer};
+use embassy_executor::executor::Spawner;
+use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
use embassy_nrf::Peripherals;
// Declare async tasks
-#[embassy::task]
+#[embassy_executor::task]
async fn blink(pin: AnyPin) {
let mut led = Output::new(pin, Level::Low, OutputDrive::Standard);
@@ -64,7 +64,7 @@ async fn blink(pin: AnyPin) {
}
// Main is itself an async task as well.
-#[embassy::main]
+#[embassy_executor::main]
async fn main(spawner: Spawner, p: Peripherals) {
// Spawned tasks run in the background, concurrently.
spawner.spawn(blink(p.P0_13.degrade())).unwrap();
@@ -132,7 +132,7 @@ Embassy is guaranteed to compile on the latest stable Rust version at the time o
Several features require nightly:
-- The `#[embassy::main]` and `#[embassy::task]` attribute macros.
+- The `#[embassy_executor::main]` and `#[embassy_executor::task]` attribute macros.
- Async traits
These are enabled by activating the `nightly` Cargo feature. If you do so, Embassy is guaranteed to compile on the exact nightly version specified in `rust-toolchain.toml`. It might compile with older or newer nightly versions, but that may change in any new patch release.
diff --git a/ci.sh b/ci.sh
index e34f1dfe3..6ec2410f7 100755
--- a/ci.sh
+++ b/ci.sh
@@ -32,10 +32,10 @@ rm -rf stm32-metapac
mv stm32-metapac-gen/out stm32-metapac
cargo batch \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly,log,executor-agnostic \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,log \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52811,gpiote,time-driver-rtc1 \
@@ -54,27 +54,27 @@ cargo batch \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits,log \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f410tb,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f411ce,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f429zi,log,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h755zi-cm7,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h7b3ai,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32l476vg,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wb15cc,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l072cz,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l041f6,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32l151cb-a,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f398ve,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32g0c1ve,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f217zg,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features nightly,stm32l552ze,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32wl54jc-cm0p,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wle5ub,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f107vc,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f103re,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f100c4,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f411ce,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h7b3ai,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wb15cc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l041f6,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f398ve,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32g0c1ve,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features nightly,stm32l552ze,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32wl54jc-cm0p,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wle5ub,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f107vc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f103re,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f100c4,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
- --- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4,embassy/time-tick-32768hz \
+ --- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
--- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml --target thumbv7em-none-eabi \
--- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml --target thumbv7em-none-eabi \
@@ -106,7 +106,7 @@ cargo batch \
--- build --release --manifest-path examples/boot/application/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32l4 --bin b \
--- build --release --manifest-path examples/boot/application/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/boot/stm32wl --bin b \
--- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
- --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4,embassy/time-tick-32768hz \
+ --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
--- build --release --manifest-path examples/wasm/Cargo.toml --target wasm32-unknown-unknown --out-dir out/examples/wasm \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103c8 --out-dir out/tests/bluepill-stm32f103c8 \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi --out-dir out/tests/nucleo-stm32f429zi \
diff --git a/ci_stable.sh b/ci_stable.sh
index 2723936e7..7521827d8 100755
--- a/ci_stable.sh
+++ b/ci_stable.sh
@@ -9,10 +9,10 @@ export DEFMT_LOG=trace
sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml
cargo batch \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features log,executor-agnostic \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features defmt \
- --- build --release --manifest-path embassy/Cargo.toml --target thumbv6m-none-eabi --features defmt \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features log \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features defmt \
+ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52811,gpiote,time-driver-rtc1 \
@@ -30,38 +30,38 @@ cargo batch \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,defmt \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,log \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g473cc,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585zi,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb55vy,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55uc-cm4,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r9zi,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303vc,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy/time-tick-32768hz \
- --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g473cc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585zi,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb55vy,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55uc-cm4,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r9zi,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303vc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \
+ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \
--- build --release --manifest-path examples/nrf/Cargo.toml --target thumbv7em-none-eabi --no-default-features --out-dir out/examples/nrf --bin raw_spawn \
--- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --no-default-features --out-dir out/examples/stm32l0 --bin raw_spawn \
diff --git a/docs/modules/ROOT/examples/basic/Cargo.toml b/docs/modules/ROOT/examples/basic/Cargo.toml
index ed1c3cb1c..59e1a437a 100644
--- a/docs/modules/ROOT/examples/basic/Cargo.toml
+++ b/docs/modules/ROOT/examples/basic/Cargo.toml
@@ -5,7 +5,7 @@ name = "embassy-basic-example"
version = "0.1.0"
[dependencies]
-embassy = { version = "0.1.0", path = "../../../../../embassy", features = ["defmt", "nightly"] }
+embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] }
embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] }
defmt = "0.3"
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs
index 461741fd7..cec39fd91 100644
--- a/docs/modules/ROOT/examples/basic/src/main.rs
+++ b/docs/modules/ROOT/examples/basic/src/main.rs
@@ -3,14 +3,14 @@
#![feature(type_alias_impl_trait)]
use defmt::*;
-use embassy::executor::Spawner;
-use embassy::time::{Duration, Timer};
+use embassy_executor::executor::Spawner;
+use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_nrf::peripherals::P0_13;
use embassy_nrf::Peripherals;
use {defmt_rtt as _, panic_probe as _}; // global logger
-#[embassy::task]
+#[embassy_executor::task]
async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) {
loop {
led.set_high();
@@ -20,7 +20,7 @@ async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) {
}
}
-#[embassy::main]
+#[embassy_executor::main]
async fn main(spawner: Spawner, p: Peripherals) {
let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300))));
diff --git a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
index 2dca3cc8d..9048d9302 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml
@@ -8,7 +8,7 @@ members = [
]
[patch.crates-io]
-embassy = { path = "../../../../../embassy" }
+embassy-executor = { path = "../../../../../embassy-executor" }
embassy-stm32 = { path = "../../../../../embassy-stm32" }
stm32-metapac = { path = "../../../../../stm32-metapac" }
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
index e0c63251e..e2933076f 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
cortex-m = "0.7"
cortex-m-rt = "0.7"
embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"], default-features = false }
-embassy = { version = "0.1.0", default-features = false, features = ["nightly"] }
+embassy-executor = { version = "0.1.0", default-features = false, features = ["nightly"] }
defmt = "0.3.0"
defmt-rtt = "0.3.0"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
index 56bc698da..b944a7994 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs
@@ -2,13 +2,13 @@
#![no_main]
#![feature(type_alias_impl_trait)]
-use embassy::executor::Spawner;
+use embassy_executor::executor::Spawner;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
-#[embassy::main]
+#[embassy_executor::main]
async fn main(_s: Spawner, p: Peripherals) {
let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh);
let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13);
diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml
index 5bb2c34b3..abb7bb5c2 100644
--- a/embassy-boot/boot/Cargo.toml
+++ b/embassy-boot/boot/Cargo.toml
@@ -9,7 +9,7 @@ description = "Bootloader using Embassy"
[dependencies]
defmt = { version = "0.3", optional = true }
log = { version = "0.4", optional = true }
-embassy = { path = "../../embassy", default-features = false }
+embassy-util = { version = "0.1.0", path = "../../embassy-util" }
embedded-storage = "0.3.0"
embedded-storage-async = "0.3.0"
diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml
index ea5794836..5dc3ce52b 100644
--- a/embassy-boot/nrf/Cargo.toml
+++ b/embassy-boot/nrf/Cargo.toml
@@ -9,7 +9,7 @@ description = "Bootloader lib for nRF chips"
[dependencies]
defmt = { version = "0.3", optional = true }
-embassy = { path = "../../embassy", default-features = false }
+embassy-util = { path = "../../embassy-util" }
embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] }
embassy-boot = { path = "../boot", default-features = false }
cortex-m = { version = "0.7" }
diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml
index 13ae54b31..eab8d160a 100644
--- a/embassy-boot/stm32/Cargo.toml
+++ b/embassy-boot/stm32/Cargo.toml
@@ -11,7 +11,7 @@ defmt = { version = "0.3", optional = true }
defmt-rtt = { version = "0.3", optional = true }
log = { version = "0.4", optional = true }
-embassy = { path = "../../embassy", default-features = false }
+embassy-util = { path = "../../embassy-util" }
embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] }
embassy-boot = { path = "../boot", default-features = false }
cortex-m = { version = "0.7" }
diff --git a/embassy-cortex-m/Cargo.toml b/embassy-cortex-m/Cargo.toml
index 9dbec0462..454f34e0b 100644
--- a/embassy-cortex-m/Cargo.toml
+++ b/embassy-cortex-m/Cargo.toml
@@ -35,7 +35,8 @@ prio-bits-8 = []
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
-embassy = { version = "0.1.0", path = "../embassy"}
+embassy-util = { version = "0.1.0", path = "../embassy-util" }
+embassy-executor = { version = "0.1.0", path = "../embassy-executor"}
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common"}
atomic-polyfill = "0.1.5"
diff --git a/embassy-cortex-m/src/executor.rs b/embassy-cortex-m/src/executor.rs
index 17ccf0e81..4a3fa9903 100644
--- a/embassy-cortex-m/src/executor.rs
+++ b/embassy-cortex-m/src/executor.rs
@@ -1,7 +1,7 @@
//! Executor specific to cortex-m devices.
use core::marker::PhantomData;
-pub use embassy::executor::*;
+pub use embassy_executor::executor::*;
use crate::interrupt::{Interrupt, InterruptExt};
@@ -60,18 +60,18 @@ impl InterruptExecutor {
/// The executor keeps running in the background through the interrupt.
///
/// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`]
- /// is returned instead of a [`Spawner`](embassy::executor::Spawner) because the executor effectively runs in a
+ /// is returned instead of a [`Spawner`](embassy_executor::executor::Spawner) because the executor effectively runs in a
/// different "thread" (the interrupt), so spawning tasks on it is effectively
/// sending them.
///
- /// To obtain a [`Spawner`](embassy::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy::executor::Spawner::for_current_executor()) from
+ /// To obtain a [`Spawner`](embassy_executor::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy_executor::executor::Spawner::for_current_executor()) from
/// a task running in it.
///
/// This function requires `&'static mut self`. This means you have to store the
/// Executor instance in a place where it'll live forever and grants you mutable
/// access. There's a few ways to do this:
///
- /// - a [Forever](embassy::util::Forever) (safe)
+ /// - a [Forever](embassy_util::Forever) (safe)
/// - a `static mut` (unsafe)
/// - a local variable in a function you know never returns (like `fn main() -> !`), upgrading its lifetime with `transmute`. (unsafe)
pub fn start(&'static mut self) -> SendSpawner {
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index 455786be9..f245783cf 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -9,7 +9,7 @@ std = []
nightly = ["embedded-hal-async", "embedded-storage-async"]
[dependencies]
-embassy = { version = "0.1.0", path = "../embassy" }
+embassy-util = { version = "0.1.0", path = "../embassy-util" }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true }
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
index fa77a06d3..bd023fb6a 100644
--- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
@@ -4,8 +4,8 @@
//!
//! ```rust
//! use embassy_embedded_hal::shared_bus::i2c::I2cDevice;
-//! use embassy::mutex::Mutex;
-//! use embassy::blocking_mutex::raw::ThreadModeRawMutex;
+//! use embassy_util::mutex::Mutex;
+//! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
//!
//! static I2C_BUS: Forever>> = Forever::new();
//! let config = twim::Config::default();
@@ -24,8 +24,8 @@
//! ```
use core::future::Future;
-use embassy::blocking_mutex::raw::RawMutex;
-use embassy::mutex::Mutex;
+use embassy_util::blocking_mutex::raw::RawMutex;
+use embassy_util::mutex::Mutex;
use embedded_hal_async::i2c;
use crate::shared_bus::I2cDeviceError;
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
index a08eaa82d..caa37f6f3 100644
--- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
@@ -4,8 +4,8 @@
//!
//! ```rust
//! use embassy_embedded_hal::shared_bus::spi::SpiDevice;
-//! use embassy::mutex::Mutex;
-//! use embassy::blocking_mutex::raw::ThreadModeRawMutex;
+//! use embassy_util::mutex::Mutex;
+//! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
//!
//! static SPI_BUS: Forever>> = Forever::new();
//! let mut config = spim::Config::default();
@@ -27,8 +27,8 @@
//! ```
use core::future::Future;
-use embassy::blocking_mutex::raw::RawMutex;
-use embassy::mutex::Mutex;
+use embassy_util::blocking_mutex::raw::RawMutex;
+use embassy_util::mutex::Mutex;
use embedded_hal_1::digital::blocking::OutputPin;
use embedded_hal_1::spi::ErrorType;
use embedded_hal_async::spi;
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
index c8b5e30f6..1fc343d15 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
@@ -4,7 +4,7 @@
//!
//! ```rust
//! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
-//! use embassy::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
+//! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
//!
//! static I2C_BUS: Forever>>> = Forever::new();
//! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
@@ -18,8 +18,8 @@
use core::cell::RefCell;
-use embassy::blocking_mutex::raw::RawMutex;
-use embassy::blocking_mutex::Mutex;
+use embassy_util::blocking_mutex::raw::RawMutex;
+use embassy_util::blocking_mutex::Mutex;
use embedded_hal_1::i2c::blocking::{I2c, Operation};
use embedded_hal_1::i2c::ErrorType;
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
index d0648f59a..a61326594 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
@@ -4,7 +4,7 @@
//!
//! ```rust
//! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice;
-//! use embassy::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
+//! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
//!
//! static SPI_BUS: Forever>>> = Forever::new();
//! let irq = interrupt::take!(SPIM3);
@@ -20,8 +20,8 @@
use core::cell::RefCell;
-use embassy::blocking_mutex::raw::RawMutex;
-use embassy::blocking_mutex::Mutex;
+use embassy_util::blocking_mutex::raw::RawMutex;
+use embassy_util::blocking_mutex::Mutex;
use embedded_hal_1::digital::blocking::OutputPin;
use embedded_hal_1::spi;
use embedded_hal_1::spi::blocking::SpiBusFlush;
diff --git a/embassy/Cargo.toml b/embassy-executor/Cargo.toml
similarity index 69%
rename from embassy/Cargo.toml
rename to embassy-executor/Cargo.toml
index a5d36c10c..d8ac4ac00 100644
--- a/embassy/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -1,11 +1,12 @@
[package]
-name = "embassy"
+name = "embassy-executor"
version = "0.1.0"
edition = "2021"
+
[package.metadata.embassy_docs]
-src_base = "https://github.com/embassy-rs/embassy/blob/embassy-v$VERSION/embassy/src/"
-src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy/src/"
+src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
+src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
features = ["nightly", "defmt", "unstable-traits", "time", "time-tick-1mhz"]
flavors = [
{ name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] },
@@ -21,7 +22,7 @@ flavors = [
[features]
default = []
-std = ["futures/std", "time", "time-tick-1mhz", "embassy-macros/std"]
+std = ["time", "time-tick-1mhz", "embassy-macros/std"]
wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"]
# Enable nightly-only features
@@ -35,12 +36,12 @@ unstable-traits = ["embedded-hal-1"]
# To use this you must have a time driver provided.
defmt-timestamp-uptime = ["defmt"]
-# Enable `embassy::time` module.
+# Enable `embassy_executor::time` module.
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
# Enabling it directly without supplying a time driver will fail to link.
time = []
-# Set the `embassy::time` tick rate.
+# Set the `embassy_executor::time` tick rate.
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
# If you're not writing your own driver, check the driver documentation to customize the tick rate.
# If you're writing a driver and your tick rate is not listed here, please add it and send a PR!
@@ -49,8 +50,6 @@ time-tick-1000hz = ["time"]
time-tick-1mhz = ["time"]
time-tick-16mhz = ["time"]
-executor-agnostic = []
-
[dependencies]
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
@@ -59,37 +58,13 @@ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
-futures = { version = "0.3.17", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] }
-pin-project = { version = "1.0.8", default-features = false }
+futures-util = { version = "0.3.17", default-features = false }
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
atomic-polyfill = "0.1.5"
critical-section = "0.2.5"
-heapless = "0.7.5"
cfg-if = "1.0.0"
# WASM dependencies
wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true }
js-sys = { version = "0.3", optional = true }
-wasm-timer = { version = "0.2.5", optional = true }
-
-[target."thumbv6m-none-eabi".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv7m-none-eabi".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv7em-none-eabi".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv7em-none-eabihf".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv8m.base-none-eabi".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv8m.main-none-eabi".dependencies]
-cortex-m = "0.7.3"
-[target."thumbv8m.main-none-eabihf".dependencies]
-cortex-m = "0.7.3"
-
-[dev-dependencies]
-embassy = { path = ".", features = ["executor-agnostic"] }
-futures-executor = { version = "0.3.17", features = [ "thread-pool" ] }
-futures-test = "0.3.17"
-futures-timer = "3.0.2"
-futures-util = { version = "0.3.17", features = [ "channel" ] }
+wasm-timer = { version = "0.2.5", optional = true }
\ No newline at end of file
diff --git a/embassy/build.rs b/embassy-executor/build.rs
similarity index 100%
rename from embassy/build.rs
rename to embassy-executor/build.rs
diff --git a/embassy/src/executor/arch/cortex_m.rs b/embassy-executor/src/executor/arch/cortex_m.rs
similarity index 90%
rename from embassy/src/executor/arch/cortex_m.rs
rename to embassy-executor/src/executor/arch/cortex_m.rs
index cf80389b6..d6e758dfb 100644
--- a/embassy/src/executor/arch/cortex_m.rs
+++ b/embassy-executor/src/executor/arch/cortex_m.rs
@@ -1,3 +1,4 @@
+use core::arch::asm;
use core::marker::PhantomData;
use core::ptr;
@@ -22,7 +23,7 @@ impl Executor {
/// Create a new Executor.
pub fn new() -> Self {
Self {
- inner: raw::Executor::new(|_| cortex_m::asm::sev(), ptr::null_mut()),
+ inner: raw::Executor::new(|_| unsafe { asm!("sev") }, ptr::null_mut()),
not_send: PhantomData,
}
}
@@ -49,8 +50,10 @@ impl Executor {
init(self.inner.spawner());
loop {
- unsafe { self.inner.poll() };
- cortex_m::asm::wfe();
+ unsafe {
+ self.inner.poll();
+ asm!("wfe");
+ };
}
}
}
diff --git a/embassy/src/executor/arch/riscv32.rs b/embassy-executor/src/executor/arch/riscv32.rs
similarity index 100%
rename from embassy/src/executor/arch/riscv32.rs
rename to embassy-executor/src/executor/arch/riscv32.rs
diff --git a/embassy/src/executor/arch/std.rs b/embassy-executor/src/executor/arch/std.rs
similarity index 100%
rename from embassy/src/executor/arch/std.rs
rename to embassy-executor/src/executor/arch/std.rs
diff --git a/embassy/src/executor/arch/wasm.rs b/embassy-executor/src/executor/arch/wasm.rs
similarity index 100%
rename from embassy/src/executor/arch/wasm.rs
rename to embassy-executor/src/executor/arch/wasm.rs
diff --git a/embassy/src/executor/arch/xtensa.rs b/embassy-executor/src/executor/arch/xtensa.rs
similarity index 100%
rename from embassy/src/executor/arch/xtensa.rs
rename to embassy-executor/src/executor/arch/xtensa.rs
diff --git a/embassy/src/executor/mod.rs b/embassy-executor/src/executor/mod.rs
similarity index 98%
rename from embassy/src/executor/mod.rs
rename to embassy-executor/src/executor/mod.rs
index 758269363..45d00c568 100644
--- a/embassy/src/executor/mod.rs
+++ b/embassy-executor/src/executor/mod.rs
@@ -10,8 +10,6 @@
//! - Fair: a task can't monopolize CPU time even if it's constantly being woken. All other tasks get a chance to run before a given task gets polled for the second time.
//! - Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks.
-#![deny(missing_docs)]
-
cfg_if::cfg_if! {
if #[cfg(cortex_m)] {
#[path="arch/cortex_m.rs"]
diff --git a/embassy/src/executor/raw/mod.rs b/embassy-executor/src/executor/raw/mod.rs
similarity index 98%
rename from embassy/src/executor/raw/mod.rs
rename to embassy-executor/src/executor/raw/mod.rs
index 0cfe617eb..87317bc02 100644
--- a/embassy/src/executor/raw/mod.rs
+++ b/embassy-executor/src/executor/raw/mod.rs
@@ -5,7 +5,7 @@
//! ## WARNING: here be dragons!
//!
//! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe
-//! executor wrappers in [`executor`](crate::executor) and the [`embassy::task`](embassy_macros::task) macro, which are fully safe.
+//! executor wrappers in [`executor`](crate::executor) and the [`embassy_executor::task`](embassy_macros::task) macro, which are fully safe.
mod run_queue;
#[cfg(feature = "time")]
@@ -99,7 +99,7 @@ impl TaskHeader {
/// A `TaskStorage` must live forever, it may not be deallocated even after the task has finished
/// running. Hence the relevant methods require `&'static self`. It may be reused, however.
///
-/// Internally, the [embassy::task](embassy_macros::task) macro allocates an array of `TaskStorage`s
+/// Internally, the [embassy_executor::task](embassy_macros::task) macro allocates an array of `TaskStorage`s
/// in a `static`. The most common reason to use the raw `Task` is to have control of where
/// the memory for the task is allocated: on the stack, or on the heap with e.g. `Box::leak`, etc.
diff --git a/embassy/src/executor/raw/run_queue.rs b/embassy-executor/src/executor/raw/run_queue.rs
similarity index 100%
rename from embassy/src/executor/raw/run_queue.rs
rename to embassy-executor/src/executor/raw/run_queue.rs
diff --git a/embassy/src/executor/raw/timer_queue.rs b/embassy-executor/src/executor/raw/timer_queue.rs
similarity index 100%
rename from embassy/src/executor/raw/timer_queue.rs
rename to embassy-executor/src/executor/raw/timer_queue.rs
diff --git a/embassy/src/executor/raw/util.rs b/embassy-executor/src/executor/raw/util.rs
similarity index 100%
rename from embassy/src/executor/raw/util.rs
rename to embassy-executor/src/executor/raw/util.rs
diff --git a/embassy/src/executor/raw/waker.rs b/embassy-executor/src/executor/raw/waker.rs
similarity index 91%
rename from embassy/src/executor/raw/waker.rs
rename to embassy-executor/src/executor/raw/waker.rs
index 605cda4ca..f6ae332fa 100644
--- a/embassy/src/executor/raw/waker.rs
+++ b/embassy-executor/src/executor/raw/waker.rs
@@ -40,7 +40,7 @@ pub fn task_from_waker(waker: &Waker) -> NonNull {
// TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992
let hack: &WakerHack = unsafe { mem::transmute(waker) };
if hack.vtable != &VTABLE {
- panic!("Found waker not created by the embassy executor. Consider enabling the `executor-agnostic` feature on the `embassy` crate.")
+ panic!("Found waker not created by the Embassy executor. `embassy_executor::time::Timer` only works with the Embassy executor.")
}
// safety: we never create a waker with a null data pointer.
diff --git a/embassy/src/executor/spawner.rs b/embassy-executor/src/executor/spawner.rs
similarity index 93%
rename from embassy/src/executor/spawner.rs
rename to embassy-executor/src/executor/spawner.rs
index c8d036eb8..25a0d7dbb 100644
--- a/embassy/src/executor/spawner.rs
+++ b/embassy-executor/src/executor/spawner.rs
@@ -3,13 +3,13 @@ use core::mem;
use core::ptr::NonNull;
use core::task::Poll;
-use futures::future::poll_fn;
+use futures_util::future::poll_fn;
use super::raw;
/// Token to spawn a newly-created task in an executor.
///
-/// When calling a task function (like `#[embassy::task] async fn my_task() { ... }`), the returned
+/// When calling a task function (like `#[embassy_executor::task] async fn my_task() { ... }`), the returned
/// value is a `SpawnToken` that represents an instance of the task, ready to spawn. You must
/// then spawn it into an executor, typically with [`Spawner::spawn()`].
///
@@ -56,9 +56,9 @@ impl Drop for SpawnToken {
pub enum SpawnError {
/// Too many instances of this task are already running.
///
- /// By default, a task marked with `#[embassy::task]` can only have one instance
+ /// By default, a task marked with `#[embassy_executor::task]` can only have one instance
/// running at a time. You may allow multiple instances to run in parallel with
- /// `#[embassy::task(pool_size = 4)]`, at the cost of higher RAM usage.
+ /// `#[embassy_executor::task(pool_size = 4)]`, at the cost of higher RAM usage.
Busy,
}
@@ -101,7 +101,7 @@ impl Spawner {
/// Spawn a task into an executor.
///
- /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy::task]`).
+ /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy_executor::task]`).
pub fn spawn(&self, token: SpawnToken) -> Result<(), SpawnError> {
let task = token.raw_task;
mem::forget(token);
@@ -177,7 +177,7 @@ impl SendSpawner {
/// Spawn a task into an executor.
///
- /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy::task]`).
+ /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy_executor::task]`).
pub fn spawn(&self, token: SpawnToken) -> Result<(), SpawnError> {
let header = token.raw_task;
mem::forget(token);
diff --git a/embassy/src/fmt.rs b/embassy-executor/src/fmt.rs
similarity index 100%
rename from embassy/src/fmt.rs
rename to embassy-executor/src/fmt.rs
diff --git a/embassy/src/lib.rs b/embassy-executor/src/lib.rs
similarity index 88%
rename from embassy/src/lib.rs
rename to embassy-executor/src/lib.rs
index b7be8b34c..69e4aeb4b 100644
--- a/embassy/src/lib.rs
+++ b/embassy-executor/src/lib.rs
@@ -8,14 +8,9 @@
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
-pub mod blocking_mutex;
-pub mod channel;
pub mod executor;
-pub mod mutex;
#[cfg(feature = "time")]
pub mod time;
-pub mod util;
-pub mod waitqueue;
#[cfg(feature = "nightly")]
pub use embassy_macros::{main, task};
diff --git a/embassy/src/time/delay.rs b/embassy-executor/src/time/delay.rs
similarity index 98%
rename from embassy/src/time/delay.rs
rename to embassy-executor/src/time/delay.rs
index 83a895e93..d76ed32eb 100644
--- a/embassy/src/time/delay.rs
+++ b/embassy-executor/src/time/delay.rs
@@ -35,7 +35,7 @@ cfg_if::cfg_if! {
if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] {
use crate::time::Timer;
use core::future::Future;
- use futures::FutureExt;
+ use futures_util::FutureExt;
impl embedded_hal_async::delay::DelayUs for Delay {
type Error = core::convert::Infallible;
diff --git a/embassy/src/time/driver.rs b/embassy-executor/src/time/driver.rs
similarity index 95%
rename from embassy/src/time/driver.rs
rename to embassy-executor/src/time/driver.rs
index 760a828b3..48e2f1c7d 100644
--- a/embassy/src/time/driver.rs
+++ b/embassy-executor/src/time/driver.rs
@@ -1,17 +1,17 @@
//! Time driver interface
//!
-//! This module defines the interface a driver needs to implement to power the `embassy::time` module.
+//! This module defines the interface a driver needs to implement to power the `embassy_executor::time` module.
//!
//! # Implementing a driver
//!
//! - Define a struct `MyDriver`
//! - Implement [`Driver`] for it
//! - Register it as the global driver with [`time_driver_impl`].
-//! - Enable the Cargo features `embassy/time` and one of `embassy/time-tick-*` corresponding to the
+//! - Enable the Cargo features `embassy-executor/time` and one of `embassy-executor/time-tick-*` corresponding to the
//! tick rate of your driver.
//!
//! If you wish to make the tick rate configurable by the end user, you should do so by exposing your own
-//! Cargo features and having each enable the corresponding `embassy/time-tick-*`.
+//! Cargo features and having each enable the corresponding `embassy-executor/time-tick-*`.
//!
//! # Linkage details
//!
@@ -34,10 +34,10 @@
//! # Example
//!
//! ```
-//! use embassy::time::driver::{Driver, AlarmHandle};
+//! use embassy_executor::time::driver::{Driver, AlarmHandle};
//!
//! struct MyDriver{}; // not public!
-//! embassy::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
+//! embassy_executor::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
//!
//! impl Driver for MyDriver {
//! fn now(&self) -> u64 {
diff --git a/embassy/src/time/driver_std.rs b/embassy-executor/src/time/driver_std.rs
similarity index 100%
rename from embassy/src/time/driver_std.rs
rename to embassy-executor/src/time/driver_std.rs
diff --git a/embassy/src/time/driver_wasm.rs b/embassy-executor/src/time/driver_wasm.rs
similarity index 100%
rename from embassy/src/time/driver_wasm.rs
rename to embassy-executor/src/time/driver_wasm.rs
diff --git a/embassy/src/time/duration.rs b/embassy-executor/src/time/duration.rs
similarity index 100%
rename from embassy/src/time/duration.rs
rename to embassy-executor/src/time/duration.rs
diff --git a/embassy/src/time/instant.rs b/embassy-executor/src/time/instant.rs
similarity index 100%
rename from embassy/src/time/instant.rs
rename to embassy-executor/src/time/instant.rs
diff --git a/embassy/src/time/mod.rs b/embassy-executor/src/time/mod.rs
similarity index 94%
rename from embassy/src/time/mod.rs
rename to embassy-executor/src/time/mod.rs
index 018e01c84..b787a5cf2 100644
--- a/embassy/src/time/mod.rs
+++ b/embassy-executor/src/time/mod.rs
@@ -26,7 +26,7 @@
//! like `2021-08-24 13:33:21`).
//!
//! If persistence across reboots is not needed, support can be built on top of
-//! `embassy::time` by storing the offset between "seconds elapsed since boot"
+//! `embassy_executor::time` by storing the offset between "seconds elapsed since boot"
//! and "seconds since unix epoch".
//!
//! # Time driver
@@ -35,7 +35,7 @@
//! Only one driver can be active in a program.
//!
//! All methods and structs transparently call into the active driver. This makes it
-//! possible for libraries to use `embassy::time` in a driver-agnostic way without
+//! possible for libraries to use `embassy_executor::time` in a driver-agnostic way without
//! requiring generic parameters.
//!
//! For more details, check the [`driver`] module.
diff --git a/embassy/src/time/timer.rs b/embassy-executor/src/time/timer.rs
similarity index 92%
rename from embassy/src/time/timer.rs
rename to embassy-executor/src/time/timer.rs
index 2194a4b14..b9cdb1be5 100644
--- a/embassy/src/time/timer.rs
+++ b/embassy-executor/src/time/timer.rs
@@ -2,8 +2,8 @@ use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
-use futures::future::{select, Either};
-use futures::{pin_mut, Stream};
+use futures_util::future::{select, Either};
+use futures_util::{pin_mut, Stream};
use crate::executor::raw;
use crate::time::{Duration, Instant};
@@ -49,9 +49,9 @@ impl Timer {
/// # #![feature(type_alias_impl_trait)]
/// #
/// # fn foo() {}
- /// use embassy::time::{Duration, Timer};
+ /// use embassy_executor::time::{Duration, Timer};
///
- /// #[embassy::task]
+ /// #[embassy_executor::task]
/// async fn demo_sleep_seconds() {
/// // suspend this task for one second.
/// Timer::after(Duration::from_secs(1)).await;
@@ -88,10 +88,10 @@ impl Future for Timer {
/// ``` no_run
/// # #![feature(type_alias_impl_trait)]
/// #
-/// use embassy::time::{Duration, Timer};
+/// use embassy_executor::time::{Duration, Timer};
/// # fn foo() {}
///
-/// #[embassy::task]
+/// #[embassy_executor::task]
/// async fn ticker_example_0() {
/// loop {
/// foo();
@@ -108,11 +108,11 @@ impl Future for Timer {
/// ``` no_run
/// # #![feature(type_alias_impl_trait)]
/// #
-/// use embassy::time::{Duration, Ticker};
+/// use embassy_executor::time::{Duration, Ticker};
/// use futures::StreamExt;
/// # fn foo(){}
///
-/// #[embassy::task]
+/// #[embassy_executor::task]
/// async fn ticker_example_1() {
/// let mut ticker = Ticker::every(Duration::from_secs(1));
/// loop {
diff --git a/embassy-hal-common/Cargo.toml b/embassy-hal-common/Cargo.toml
index f7ebcc21e..4a6a61003 100644
--- a/embassy-hal-common/Cargo.toml
+++ b/embassy-hal-common/Cargo.toml
@@ -6,9 +6,8 @@ edition = "2021"
[features]
[dependencies]
-embassy = { version = "0.1.0", path = "../embassy" }
-
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
-cortex-m = "0.7.3"
+
+embassy-util = { version = "0.1.0", path = "../embassy-util" }
num-traits = { version = "0.2.14", default-features = false }
diff --git a/embassy-hal-common/src/lib.rs b/embassy-hal-common/src/lib.rs
index d3d9e0a84..5d2649d02 100644
--- a/embassy-hal-common/src/lib.rs
+++ b/embassy-hal-common/src/lib.rs
@@ -10,13 +10,3 @@ mod peripheral;
pub mod ratio;
pub mod ring_buffer;
pub use peripheral::{Peripheral, PeripheralRef};
-
-/// Low power blocking wait loop using WFE/SEV.
-pub fn low_power_wait_until(mut condition: impl FnMut() -> bool) {
- while !condition() {
- // WFE might "eat" an event that would have otherwise woken the executor.
- cortex_m::asm::wfe();
- }
- // Retrigger an event to be transparent to the executor.
- cortex_m::asm::sev();
-}
diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml
index 9b6b2c652..6c1b01e67 100644
--- a/embassy-lora/Cargo.toml
+++ b/embassy-lora/Cargo.toml
@@ -8,8 +8,8 @@ src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/em
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-lora/src/"
features = ["time", "defmt"]
flavors = [
- { name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy/time-tick-32768hz"] },
- { name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy/time-tick-32768hz"] },
+ { name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] },
+ { name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] },
]
[lib]
@@ -24,7 +24,8 @@ time = []
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
-embassy = { version = "0.1.0", path = "../embassy", default-features = false }
+embassy-executor = { version = "0.1.0", path = "../embassy-executor" }
+embassy-util = { version = "0.1.0", path = "../embassy-util" }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
embedded-hal-async = { version = "0.1.0-alpha.1" }
diff --git a/embassy-lora/src/lib.rs b/embassy-lora/src/lib.rs
index b2da22090..29ea45863 100644
--- a/embassy-lora/src/lib.rs
+++ b/embassy-lora/src/lib.rs
@@ -18,6 +18,6 @@ pub struct LoraTimer;
impl lorawan_device::async_device::radio::Timer for LoraTimer {
type DelayFuture<'m> = impl core::future::Future