diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-29 21:58:35 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-29 23:40:36 +0200 |
| commit | a0f1b0ee01d461607660d2d56b5b1bdc57e0d3fb (patch) | |
| tree | e60fc8f8db8ec07e55d655c1a830b07f4db0b7d2 | |
| parent | 8745d646f0976791b7098456aa61adb983fb1c18 (diff) | |
Split embassy crate into embassy-executor, embassy-util.
319 files changed, 1159 insertions, 998 deletions
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: | |||
| 69 | steps: | 69 | steps: |
| 70 | - uses: actions/checkout@v2 | 70 | - uses: actions/checkout@v2 |
| 71 | - name: Test | 71 | - name: Test |
| 72 | run: cd embassy && cargo test | 72 | 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 @@ | |||
| 12 | //"embassy-net/medium-ethernet", | 12 | //"embassy-net/medium-ethernet", |
| 13 | //"embassy-net/tcp", | 13 | //"embassy-net/tcp", |
| 14 | //"embassy-net/pool-16", | 14 | //"embassy-net/pool-16", |
| 15 | //"time-tick-16mhz", | ||
| 16 | //"defmt-timestamp-uptime", | ||
| 15 | "nightly", | 17 | "nightly", |
| 18 | //"unstable-traits", | ||
| 16 | ], | 19 | ], |
| 17 | "rust-analyzer.linkedProjects": [ | 20 | "rust-analyzer.linkedProjects": [ |
| 18 | // Declare for the target you wish to develop | 21 | // Declare for the target you wish to develop |
| 22 | //"embassy-executor/Cargo.toml", | ||
| 23 | //"embassy-util/Cargo.toml", | ||
| 19 | "examples/nrf/Cargo.toml", | 24 | "examples/nrf/Cargo.toml", |
| 20 | // "examples/rp/Cargo.toml", | 25 | // "examples/rp/Cargo.toml", |
| 21 | // "examples/std/Cargo.toml", | 26 | // "examples/std/Cargo.toml", |
| @@ -16,7 +16,7 @@ Rust's <a href="https://rust-lang.github.io/async-book/">async/await</a> allows | |||
| 16 | - <a href="https://docs.embassy.dev/embassy-nrf/">embassy-nrf</a>, for the Nordic Semiconductor nRF52, nRF53, nRF91 series. | 16 | - <a href="https://docs.embassy.dev/embassy-nrf/">embassy-nrf</a>, for the Nordic Semiconductor nRF52, nRF53, nRF91 series. |
| 17 | 17 | ||
| 18 | - **Time that Just Works** - | 18 | - **Time that Just Works** - |
| 19 | No more messing with hardware timers. <a href="https://docs.embassy.dev/embassy/git/thumbv7em-none-eabihf/time/index.html">embassy::time</a> provides Instant, Duration and Timer types that are globally available and never overflow. | 19 | No more messing with hardware timers. <a href="https://docs.embassy.dev/embassy/git/thumbv7em-none-eabihf/time/index.html">embassy_executor::time</a> provides Instant, Duration and Timer types that are globally available and never overflow. |
| 20 | 20 | ||
| 21 | - **Real-time ready** - | 21 | - **Real-time ready** - |
| 22 | 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 <a href="https://github.com/embassy-rs/embassy/blob/master/examples/nrf/src/bin/multiprio.rs">example</a>. | 22 | 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 <a href="https://github.com/embassy-rs/embassy/blob/master/examples/nrf/src/bin/multiprio.rs">example</a>. |
| @@ -44,13 +44,13 @@ The <a href="https://github.com/embassy-rs/nrf-softdevice">nrf-softdevice</a> cr | |||
| 44 | 44 | ||
| 45 | ```rust,ignore | 45 | ```rust,ignore |
| 46 | use defmt::info; | 46 | use defmt::info; |
| 47 | use embassy::executor::Spawner; | 47 | use embassy_executor::executor::Spawner; |
| 48 | use embassy::time::{Duration, Timer}; | 48 | use embassy_executor::time::{Duration, Timer}; |
| 49 | use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; | 49 | use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; |
| 50 | use embassy_nrf::Peripherals; | 50 | use embassy_nrf::Peripherals; |
| 51 | 51 | ||
| 52 | // Declare async tasks | 52 | // Declare async tasks |
| 53 | #[embassy::task] | 53 | #[embassy_executor::task] |
| 54 | async fn blink(pin: AnyPin) { | 54 | async fn blink(pin: AnyPin) { |
| 55 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); | 55 | let mut led = Output::new(pin, Level::Low, OutputDrive::Standard); |
| 56 | 56 | ||
| @@ -64,7 +64,7 @@ async fn blink(pin: AnyPin) { | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | // Main is itself an async task as well. | 66 | // Main is itself an async task as well. |
| 67 | #[embassy::main] | 67 | #[embassy_executor::main] |
| 68 | async fn main(spawner: Spawner, p: Peripherals) { | 68 | async fn main(spawner: Spawner, p: Peripherals) { |
| 69 | // Spawned tasks run in the background, concurrently. | 69 | // Spawned tasks run in the background, concurrently. |
| 70 | spawner.spawn(blink(p.P0_13.degrade())).unwrap(); | 70 | 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 | |||
| 132 | 132 | ||
| 133 | Several features require nightly: | 133 | Several features require nightly: |
| 134 | 134 | ||
| 135 | - The `#[embassy::main]` and `#[embassy::task]` attribute macros. | 135 | - The `#[embassy_executor::main]` and `#[embassy_executor::task]` attribute macros. |
| 136 | - Async traits | 136 | - Async traits |
| 137 | 137 | ||
| 138 | 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. | 138 | 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. |
| @@ -32,10 +32,10 @@ rm -rf stm32-metapac | |||
| 32 | mv stm32-metapac-gen/out stm32-metapac | 32 | mv stm32-metapac-gen/out stm32-metapac |
| 33 | 33 | ||
| 34 | cargo batch \ | 34 | cargo batch \ |
| 35 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly \ | 35 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly \ |
| 36 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly,log,executor-agnostic \ | 36 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,log \ |
| 37 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \ | 37 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \ |
| 38 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \ | 38 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \ |
| 39 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \ | 39 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \ |
| 40 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \ | 40 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \ |
| 41 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52811,gpiote,time-driver-rtc1 \ | 41 | --- 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 \ | |||
| 54 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits,log \ | 54 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits,log \ |
| 55 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits \ | 55 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits \ |
| 56 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly \ | 56 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly \ |
| 57 | --- 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 \ | 57 | --- 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 \ |
| 58 | --- 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 \ | 58 | --- 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 \ |
| 59 | --- 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 \ | 59 | --- 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 \ |
| 60 | --- 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 \ | 60 | --- 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 \ |
| 61 | --- 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 \ | 61 | --- 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 \ |
| 62 | --- 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 \ | 62 | --- 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 \ |
| 63 | --- 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 \ | 63 | --- 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 \ |
| 64 | --- 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 \ | 64 | --- 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 \ |
| 65 | --- 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 \ | 65 | --- 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 \ |
| 66 | --- 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 \ | 66 | --- 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 \ |
| 67 | --- 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 \ | 67 | --- 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 \ |
| 68 | --- 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 \ | 68 | --- 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 \ |
| 69 | --- 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 \ | 69 | --- 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 \ |
| 70 | --- 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 \ | 70 | --- 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 \ |
| 71 | --- 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 \ | 71 | --- 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 \ |
| 72 | --- 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 \ | 72 | --- 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 \ |
| 73 | --- 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 \ | 73 | --- 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 \ |
| 74 | --- 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 \ | 74 | --- 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 \ |
| 75 | --- 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 \ | 75 | --- 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 \ |
| 76 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ | 76 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ |
| 77 | --- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4,embassy/time-tick-32768hz \ | 77 | --- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ |
| 78 | --- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \ | 78 | --- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \ |
| 79 | --- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml --target thumbv7em-none-eabi \ | 79 | --- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml --target thumbv7em-none-eabi \ |
| 80 | --- build --release --manifest-path docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml --target thumbv7em-none-eabi \ | 80 | --- 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 \ | |||
| 106 | --- build --release --manifest-path examples/boot/application/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32l4 --bin b \ | 106 | --- build --release --manifest-path examples/boot/application/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/boot/stm32l4 --bin b \ |
| 107 | --- build --release --manifest-path examples/boot/application/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/boot/stm32wl --bin b \ | 107 | --- build --release --manifest-path examples/boot/application/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/boot/stm32wl --bin b \ |
| 108 | --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ | 108 | --- build --release --manifest-path examples/boot/bootloader/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ |
| 109 | --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4,embassy/time-tick-32768hz \ | 109 | --- build --release --manifest-path examples/boot/bootloader/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ |
| 110 | --- build --release --manifest-path examples/wasm/Cargo.toml --target wasm32-unknown-unknown --out-dir out/examples/wasm \ | 110 | --- build --release --manifest-path examples/wasm/Cargo.toml --target wasm32-unknown-unknown --out-dir out/examples/wasm \ |
| 111 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103c8 --out-dir out/tests/bluepill-stm32f103c8 \ | 111 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103c8 --out-dir out/tests/bluepill-stm32f103c8 \ |
| 112 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi --out-dir out/tests/nucleo-stm32f429zi \ | 112 | --- 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 | |||
| 9 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml | 9 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml |
| 10 | 10 | ||
| 11 | cargo batch \ | 11 | cargo batch \ |
| 12 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi \ | 12 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi \ |
| 13 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features log,executor-agnostic \ | 13 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features log \ |
| 14 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv7em-none-eabi --features defmt \ | 14 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features defmt \ |
| 15 | --- build --release --manifest-path embassy/Cargo.toml --target thumbv6m-none-eabi --features defmt \ | 15 | --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \ |
| 16 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \ | 16 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \ |
| 17 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \ | 17 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \ |
| 18 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52811,gpiote,time-driver-rtc1 \ | 18 | --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52811,gpiote,time-driver-rtc1 \ |
| @@ -30,38 +30,38 @@ cargo batch \ | |||
| 30 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,defmt \ | 30 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,defmt \ |
| 31 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,log \ | 31 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,log \ |
| 32 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi \ | 32 | --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi \ |
| 33 | --- 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 \ | 33 | --- 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 \ |
| 34 | --- 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 \ | 34 | --- 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 \ |
| 35 | --- 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 \ | 35 | --- 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 \ |
| 36 | --- 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 \ | 36 | --- 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 \ |
| 37 | --- 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 \ | 37 | --- 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 \ |
| 38 | --- 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 \ | 38 | --- 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 \ |
| 39 | --- 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 \ | 39 | --- 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 \ |
| 40 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy/time-tick-32768hz \ | 40 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 41 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \ | 41 | --- 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 \ |
| 42 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy/time-tick-32768hz \ | 42 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 43 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy/time-tick-32768hz,unstable-traits \ | 43 | --- 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 \ |
| 44 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy/time-tick-32768hz \ | 44 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 45 | --- 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 \ | 45 | --- 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 \ |
| 46 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy/time-tick-32768hz \ | 46 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 47 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \ | 47 | --- 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 \ |
| 48 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy/time-tick-32768hz \ | 48 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 49 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy/time-tick-32768hz,unstable-traits \ | 49 | --- 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 \ |
| 50 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy/time-tick-32768hz \ | 50 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 51 | --- 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 \ | 51 | --- 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 \ |
| 52 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 52 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 53 | --- 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 \ | 53 | --- 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 \ |
| 54 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy/time-tick-32768hz \ | 54 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 55 | --- 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 \ | 55 | --- 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 \ |
| 56 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 56 | --- 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 \ |
| 57 | --- 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 \ | 57 | --- 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 \ |
| 58 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 58 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 59 | --- 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 \ | 59 | --- 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 \ |
| 60 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 60 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 61 | --- 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 \ | 61 | --- 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 \ |
| 62 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 62 | --- 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 \ |
| 63 | --- 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 \ | 63 | --- 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 \ |
| 64 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy/time-tick-32768hz \ | 64 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ |
| 65 | --- 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 \ | 65 | --- 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 \ |
| 66 | --- build --release --manifest-path examples/nrf/Cargo.toml --target thumbv7em-none-eabi --no-default-features --out-dir out/examples/nrf --bin raw_spawn \ | 66 | --- build --release --manifest-path examples/nrf/Cargo.toml --target thumbv7em-none-eabi --no-default-features --out-dir out/examples/nrf --bin raw_spawn \ |
| 67 | --- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --no-default-features --out-dir out/examples/stm32l0 --bin raw_spawn \ | 67 | --- 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" | |||
| 5 | version = "0.1.0" | 5 | version = "0.1.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy = { version = "0.1.0", path = "../../../../../embassy", features = ["defmt", "nightly"] } | 8 | embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } |
| 9 | embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } | 9 | embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } |
| 10 | 10 | ||
| 11 | defmt = "0.3" | 11 | 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 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 9 | use embassy_nrf::peripherals::P0_13; | 9 | use embassy_nrf::peripherals::P0_13; |
| 10 | use embassy_nrf::Peripherals; | 10 | use embassy_nrf::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; // global logger | 11 | use {defmt_rtt as _, panic_probe as _}; // global logger |
| 12 | 12 | ||
| 13 | #[embassy::task] | 13 | #[embassy_executor::task] |
| 14 | async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | 14 | async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { |
| 15 | loop { | 15 | loop { |
| 16 | led.set_high(); | 16 | led.set_high(); |
| @@ -20,7 +20,7 @@ async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | |||
| 20 | } | 20 | } |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | #[embassy::main] | 23 | #[embassy_executor::main] |
| 24 | async fn main(spawner: Spawner, p: Peripherals) { | 24 | async fn main(spawner: Spawner, p: Peripherals) { |
| 25 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 25 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 26 | unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); | 26 | 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 = [ | |||
| 8 | ] | 8 | ] |
| 9 | 9 | ||
| 10 | [patch.crates-io] | 10 | [patch.crates-io] |
| 11 | embassy = { path = "../../../../../embassy" } | 11 | embassy-executor = { path = "../../../../../embassy-executor" } |
| 12 | embassy-stm32 = { path = "../../../../../embassy-stm32" } | 12 | embassy-stm32 = { path = "../../../../../embassy-stm32" } |
| 13 | stm32-metapac = { path = "../../../../../stm32-metapac" } | 13 | stm32-metapac = { path = "../../../../../stm32-metapac" } |
| 14 | 14 | ||
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" | |||
| 7 | cortex-m = "0.7" | 7 | cortex-m = "0.7" |
| 8 | cortex-m-rt = "0.7" | 8 | cortex-m-rt = "0.7" |
| 9 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"], default-features = false } | 9 | embassy-stm32 = { version = "0.1.0", features = ["stm32l475vg", "memory-x", "exti"], default-features = false } |
| 10 | embassy = { version = "0.1.0", default-features = false, features = ["nightly"] } | 10 | embassy-executor = { version = "0.1.0", default-features = false, features = ["nightly"] } |
| 11 | 11 | ||
| 12 | defmt = "0.3.0" | 12 | defmt = "0.3.0" |
| 13 | defmt-rtt = "0.3.0" | 13 | 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 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_stm32::exti::ExtiInput; | 6 | use embassy_stm32::exti::ExtiInput; |
| 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_s: Spawner, p: Peripherals) { | 12 | async fn main(_s: Spawner, p: Peripherals) { |
| 13 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); | 13 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); |
| 14 | let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13); | 14 | 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" | |||
| 9 | [dependencies] | 9 | [dependencies] |
| 10 | defmt = { version = "0.3", optional = true } | 10 | defmt = { version = "0.3", optional = true } |
| 11 | log = { version = "0.4", optional = true } | 11 | log = { version = "0.4", optional = true } |
| 12 | embassy = { path = "../../embassy", default-features = false } | 12 | embassy-util = { version = "0.1.0", path = "../../embassy-util" } |
| 13 | embedded-storage = "0.3.0" | 13 | embedded-storage = "0.3.0" |
| 14 | embedded-storage-async = "0.3.0" | 14 | embedded-storage-async = "0.3.0" |
| 15 | 15 | ||
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" | |||
| 9 | [dependencies] | 9 | [dependencies] |
| 10 | defmt = { version = "0.3", optional = true } | 10 | defmt = { version = "0.3", optional = true } |
| 11 | 11 | ||
| 12 | embassy = { path = "../../embassy", default-features = false } | 12 | embassy-util = { path = "../../embassy-util" } |
| 13 | embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } | 13 | embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } |
| 14 | embassy-boot = { path = "../boot", default-features = false } | 14 | embassy-boot = { path = "../boot", default-features = false } |
| 15 | cortex-m = { version = "0.7" } | 15 | 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 } | |||
| 11 | defmt-rtt = { version = "0.3", optional = true } | 11 | defmt-rtt = { version = "0.3", optional = true } |
| 12 | log = { version = "0.4", optional = true } | 12 | log = { version = "0.4", optional = true } |
| 13 | 13 | ||
| 14 | embassy = { path = "../../embassy", default-features = false } | 14 | embassy-util = { path = "../../embassy-util" } |
| 15 | embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] } | 15 | embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] } |
| 16 | embassy-boot = { path = "../boot", default-features = false } | 16 | embassy-boot = { path = "../boot", default-features = false } |
| 17 | cortex-m = { version = "0.7" } | 17 | 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 = [] | |||
| 35 | defmt = { version = "0.3", optional = true } | 35 | defmt = { version = "0.3", optional = true } |
| 36 | log = { version = "0.4.14", optional = true } | 36 | log = { version = "0.4.14", optional = true } |
| 37 | 37 | ||
| 38 | embassy = { version = "0.1.0", path = "../embassy"} | 38 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 39 | embassy-executor = { version = "0.1.0", path = "../embassy-executor"} | ||
| 39 | embassy-macros = { version = "0.1.0", path = "../embassy-macros"} | 40 | embassy-macros = { version = "0.1.0", path = "../embassy-macros"} |
| 40 | embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common"} | 41 | embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common"} |
| 41 | atomic-polyfill = "0.1.5" | 42 | 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 @@ | |||
| 1 | //! Executor specific to cortex-m devices. | 1 | //! Executor specific to cortex-m devices. |
| 2 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 3 | 3 | ||
| 4 | pub use embassy::executor::*; | 4 | pub use embassy_executor::executor::*; |
| 5 | 5 | ||
| 6 | use crate::interrupt::{Interrupt, InterruptExt}; | 6 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 7 | 7 | ||
| @@ -60,18 +60,18 @@ impl<I: Interrupt> InterruptExecutor<I> { | |||
| 60 | /// The executor keeps running in the background through the interrupt. | 60 | /// The executor keeps running in the background through the interrupt. |
| 61 | /// | 61 | /// |
| 62 | /// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`] | 62 | /// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`] |
| 63 | /// is returned instead of a [`Spawner`](embassy::executor::Spawner) because the executor effectively runs in a | 63 | /// is returned instead of a [`Spawner`](embassy_executor::executor::Spawner) because the executor effectively runs in a |
| 64 | /// different "thread" (the interrupt), so spawning tasks on it is effectively | 64 | /// different "thread" (the interrupt), so spawning tasks on it is effectively |
| 65 | /// sending them. | 65 | /// sending them. |
| 66 | /// | 66 | /// |
| 67 | /// To obtain a [`Spawner`](embassy::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy::executor::Spawner::for_current_executor()) from | 67 | /// To obtain a [`Spawner`](embassy_executor::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy_executor::executor::Spawner::for_current_executor()) from |
| 68 | /// a task running in it. | 68 | /// a task running in it. |
| 69 | /// | 69 | /// |
| 70 | /// This function requires `&'static mut self`. This means you have to store the | 70 | /// This function requires `&'static mut self`. This means you have to store the |
| 71 | /// Executor instance in a place where it'll live forever and grants you mutable | 71 | /// Executor instance in a place where it'll live forever and grants you mutable |
| 72 | /// access. There's a few ways to do this: | 72 | /// access. There's a few ways to do this: |
| 73 | /// | 73 | /// |
| 74 | /// - a [Forever](embassy::util::Forever) (safe) | 74 | /// - a [Forever](embassy_util::Forever) (safe) |
| 75 | /// - a `static mut` (unsafe) | 75 | /// - a `static mut` (unsafe) |
| 76 | /// - a local variable in a function you know never returns (like `fn main() -> !`), upgrading its lifetime with `transmute`. (unsafe) | 76 | /// - a local variable in a function you know never returns (like `fn main() -> !`), upgrading its lifetime with `transmute`. (unsafe) |
| 77 | pub fn start(&'static mut self) -> SendSpawner { | 77 | 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 = [] | |||
| 9 | nightly = ["embedded-hal-async", "embedded-storage-async"] | 9 | nightly = ["embedded-hal-async", "embedded-storage-async"] |
| 10 | 10 | ||
| 11 | [dependencies] | 11 | [dependencies] |
| 12 | embassy = { version = "0.1.0", path = "../embassy" } | 12 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 13 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } | 13 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } |
| 14 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } | 14 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } |
| 15 | embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } | 15 | 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 @@ | |||
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust |
| 6 | //! use embassy_embedded_hal::shared_bus::i2c::I2cDevice; | 6 | //! use embassy_embedded_hal::shared_bus::i2c::I2cDevice; |
| 7 | //! use embassy::mutex::Mutex; | 7 | //! use embassy_util::mutex::Mutex; |
| 8 | //! use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 8 | //! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| 9 | //! | 9 | //! |
| 10 | //! static I2C_BUS: Forever<Mutex::<ThreadModeRawMutex, Twim<TWISPI0>>> = Forever::new(); | 10 | //! static I2C_BUS: Forever<Mutex::<ThreadModeRawMutex, Twim<TWISPI0>>> = Forever::new(); |
| 11 | //! let config = twim::Config::default(); | 11 | //! let config = twim::Config::default(); |
| @@ -24,8 +24,8 @@ | |||
| 24 | //! ``` | 24 | //! ``` |
| 25 | use core::future::Future; | 25 | use core::future::Future; |
| 26 | 26 | ||
| 27 | use embassy::blocking_mutex::raw::RawMutex; | 27 | use embassy_util::blocking_mutex::raw::RawMutex; |
| 28 | use embassy::mutex::Mutex; | 28 | use embassy_util::mutex::Mutex; |
| 29 | use embedded_hal_async::i2c; | 29 | use embedded_hal_async::i2c; |
| 30 | 30 | ||
| 31 | use crate::shared_bus::I2cDeviceError; | 31 | 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 @@ | |||
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust |
| 6 | //! use embassy_embedded_hal::shared_bus::spi::SpiDevice; | 6 | //! use embassy_embedded_hal::shared_bus::spi::SpiDevice; |
| 7 | //! use embassy::mutex::Mutex; | 7 | //! use embassy_util::mutex::Mutex; |
| 8 | //! use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 8 | //! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| 9 | //! | 9 | //! |
| 10 | //! static SPI_BUS: Forever<Mutex<ThreadModeRawMutex, spim::Spim<SPI3>>> = Forever::new(); | 10 | //! static SPI_BUS: Forever<Mutex<ThreadModeRawMutex, spim::Spim<SPI3>>> = Forever::new(); |
| 11 | //! let mut config = spim::Config::default(); | 11 | //! let mut config = spim::Config::default(); |
| @@ -27,8 +27,8 @@ | |||
| 27 | //! ``` | 27 | //! ``` |
| 28 | use core::future::Future; | 28 | use core::future::Future; |
| 29 | 29 | ||
| 30 | use embassy::blocking_mutex::raw::RawMutex; | 30 | use embassy_util::blocking_mutex::raw::RawMutex; |
| 31 | use embassy::mutex::Mutex; | 31 | use embassy_util::mutex::Mutex; |
| 32 | use embedded_hal_1::digital::blocking::OutputPin; | 32 | use embedded_hal_1::digital::blocking::OutputPin; |
| 33 | use embedded_hal_1::spi::ErrorType; | 33 | use embedded_hal_1::spi::ErrorType; |
| 34 | use embedded_hal_async::spi; | 34 | 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 @@ | |||
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust |
| 6 | //! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; | 6 | //! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; |
| 7 | //! use embassy::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; | 7 | //! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; |
| 8 | //! | 8 | //! |
| 9 | //! static I2C_BUS: Forever<NoopMutex<RefCell<Twim<TWISPI0>>>> = Forever::new(); | 9 | //! static I2C_BUS: Forever<NoopMutex<RefCell<Twim<TWISPI0>>>> = Forever::new(); |
| 10 | //! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); | 10 | //! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); |
| @@ -18,8 +18,8 @@ | |||
| 18 | 18 | ||
| 19 | use core::cell::RefCell; | 19 | use core::cell::RefCell; |
| 20 | 20 | ||
| 21 | use embassy::blocking_mutex::raw::RawMutex; | 21 | use embassy_util::blocking_mutex::raw::RawMutex; |
| 22 | use embassy::blocking_mutex::Mutex; | 22 | use embassy_util::blocking_mutex::Mutex; |
| 23 | use embedded_hal_1::i2c::blocking::{I2c, Operation}; | 23 | use embedded_hal_1::i2c::blocking::{I2c, Operation}; |
| 24 | use embedded_hal_1::i2c::ErrorType; | 24 | use embedded_hal_1::i2c::ErrorType; |
| 25 | 25 | ||
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 @@ | |||
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust |
| 6 | //! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice; | 6 | //! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice; |
| 7 | //! use embassy::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; | 7 | //! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; |
| 8 | //! | 8 | //! |
| 9 | //! static SPI_BUS: Forever<NoopMutex<RefCell<Spim<SPI3>>>> = Forever::new(); | 9 | //! static SPI_BUS: Forever<NoopMutex<RefCell<Spim<SPI3>>>> = Forever::new(); |
| 10 | //! let irq = interrupt::take!(SPIM3); | 10 | //! let irq = interrupt::take!(SPIM3); |
| @@ -20,8 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | use core::cell::RefCell; | 21 | use core::cell::RefCell; |
| 22 | 22 | ||
| 23 | use embassy::blocking_mutex::raw::RawMutex; | 23 | use embassy_util::blocking_mutex::raw::RawMutex; |
| 24 | use embassy::blocking_mutex::Mutex; | 24 | use embassy_util::blocking_mutex::Mutex; |
| 25 | use embedded_hal_1::digital::blocking::OutputPin; | 25 | use embedded_hal_1::digital::blocking::OutputPin; |
| 26 | use embedded_hal_1::spi; | 26 | use embedded_hal_1::spi; |
| 27 | use embedded_hal_1::spi::blocking::SpiBusFlush; | 27 | use embedded_hal_1::spi::blocking::SpiBusFlush; |
diff --git a/embassy/Cargo.toml b/embassy-executor/Cargo.toml index a5d36c10c..d8ac4ac00 100644 --- a/embassy/Cargo.toml +++ b/embassy-executor/Cargo.toml | |||
| @@ -1,11 +1,12 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "embassy" | 2 | name = "embassy-executor" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | 5 | ||
| 6 | |||
| 6 | [package.metadata.embassy_docs] | 7 | [package.metadata.embassy_docs] |
| 7 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-v$VERSION/embassy/src/" | 8 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" |
| 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy/src/" | 9 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" |
| 9 | features = ["nightly", "defmt", "unstable-traits", "time", "time-tick-1mhz"] | 10 | features = ["nightly", "defmt", "unstable-traits", "time", "time-tick-1mhz"] |
| 10 | flavors = [ | 11 | flavors = [ |
| 11 | { name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] }, | 12 | { name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] }, |
| @@ -21,7 +22,7 @@ flavors = [ | |||
| 21 | 22 | ||
| 22 | [features] | 23 | [features] |
| 23 | default = [] | 24 | default = [] |
| 24 | std = ["futures/std", "time", "time-tick-1mhz", "embassy-macros/std"] | 25 | std = ["time", "time-tick-1mhz", "embassy-macros/std"] |
| 25 | wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"] | 26 | wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"] |
| 26 | 27 | ||
| 27 | # Enable nightly-only features | 28 | # Enable nightly-only features |
| @@ -35,12 +36,12 @@ unstable-traits = ["embedded-hal-1"] | |||
| 35 | # To use this you must have a time driver provided. | 36 | # To use this you must have a time driver provided. |
| 36 | defmt-timestamp-uptime = ["defmt"] | 37 | defmt-timestamp-uptime = ["defmt"] |
| 37 | 38 | ||
| 38 | # Enable `embassy::time` module. | 39 | # Enable `embassy_executor::time` module. |
| 39 | # NOTE: This feature is only intended to be enabled by crates providing the time driver implementation. | 40 | # NOTE: This feature is only intended to be enabled by crates providing the time driver implementation. |
| 40 | # Enabling it directly without supplying a time driver will fail to link. | 41 | # Enabling it directly without supplying a time driver will fail to link. |
| 41 | time = [] | 42 | time = [] |
| 42 | 43 | ||
| 43 | # Set the `embassy::time` tick rate. | 44 | # Set the `embassy_executor::time` tick rate. |
| 44 | # NOTE: This feature is only intended to be enabled by crates providing the time driver implementation. | 45 | # NOTE: This feature is only intended to be enabled by crates providing the time driver implementation. |
| 45 | # If you're not writing your own driver, check the driver documentation to customize the tick rate. | 46 | # If you're not writing your own driver, check the driver documentation to customize the tick rate. |
| 46 | # If you're writing a driver and your tick rate is not listed here, please add it and send a PR! | 47 | # 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"] | |||
| 49 | time-tick-1mhz = ["time"] | 50 | time-tick-1mhz = ["time"] |
| 50 | time-tick-16mhz = ["time"] | 51 | time-tick-16mhz = ["time"] |
| 51 | 52 | ||
| 52 | executor-agnostic = [] | ||
| 53 | |||
| 54 | [dependencies] | 53 | [dependencies] |
| 55 | defmt = { version = "0.3", optional = true } | 54 | defmt = { version = "0.3", optional = true } |
| 56 | log = { version = "0.4.14", optional = true } | 55 | log = { version = "0.4.14", optional = true } |
| @@ -59,37 +58,13 @@ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } | |||
| 59 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} | 58 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} |
| 60 | embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} | 59 | embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} |
| 61 | 60 | ||
| 62 | futures = { version = "0.3.17", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] } | 61 | futures-util = { version = "0.3.17", default-features = false } |
| 63 | pin-project = { version = "1.0.8", default-features = false } | ||
| 64 | embassy-macros = { version = "0.1.0", path = "../embassy-macros"} | 62 | embassy-macros = { version = "0.1.0", path = "../embassy-macros"} |
| 65 | atomic-polyfill = "0.1.5" | 63 | atomic-polyfill = "0.1.5" |
| 66 | critical-section = "0.2.5" | 64 | critical-section = "0.2.5" |
| 67 | heapless = "0.7.5" | ||
| 68 | cfg-if = "1.0.0" | 65 | cfg-if = "1.0.0" |
| 69 | 66 | ||
| 70 | # WASM dependencies | 67 | # WASM dependencies |
| 71 | wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true } | 68 | wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true } |
| 72 | js-sys = { version = "0.3", optional = true } | 69 | js-sys = { version = "0.3", optional = true } |
| 73 | wasm-timer = { version = "0.2.5", optional = true } | 70 | wasm-timer = { version = "0.2.5", optional = true } \ No newline at end of file |
| 74 | |||
| 75 | [target."thumbv6m-none-eabi".dependencies] | ||
| 76 | cortex-m = "0.7.3" | ||
| 77 | [target."thumbv7m-none-eabi".dependencies] | ||
| 78 | cortex-m = "0.7.3" | ||
| 79 | [target."thumbv7em-none-eabi".dependencies] | ||
| 80 | cortex-m = "0.7.3" | ||
| 81 | [target."thumbv7em-none-eabihf".dependencies] | ||
| 82 | cortex-m = "0.7.3" | ||
| 83 | [target."thumbv8m.base-none-eabi".dependencies] | ||
| 84 | cortex-m = "0.7.3" | ||
| 85 | [target."thumbv8m.main-none-eabi".dependencies] | ||
| 86 | cortex-m = "0.7.3" | ||
| 87 | [target."thumbv8m.main-none-eabihf".dependencies] | ||
| 88 | cortex-m = "0.7.3" | ||
| 89 | |||
| 90 | [dev-dependencies] | ||
| 91 | embassy = { path = ".", features = ["executor-agnostic"] } | ||
| 92 | futures-executor = { version = "0.3.17", features = [ "thread-pool" ] } | ||
| 93 | futures-test = "0.3.17" | ||
| 94 | futures-timer = "3.0.2" | ||
| 95 | futures-util = { version = "0.3.17", features = [ "channel" ] } | ||
diff --git a/embassy/build.rs b/embassy-executor/build.rs index 6fe82b44f..6fe82b44f 100644 --- a/embassy/build.rs +++ b/embassy-executor/build.rs | |||
diff --git a/embassy/src/executor/arch/cortex_m.rs b/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 @@ | |||
| 1 | use core::arch::asm; | ||
| 1 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 2 | use core::ptr; | 3 | use core::ptr; |
| 3 | 4 | ||
| @@ -22,7 +23,7 @@ impl Executor { | |||
| 22 | /// Create a new Executor. | 23 | /// Create a new Executor. |
| 23 | pub fn new() -> Self { | 24 | pub fn new() -> Self { |
| 24 | Self { | 25 | Self { |
| 25 | inner: raw::Executor::new(|_| cortex_m::asm::sev(), ptr::null_mut()), | 26 | inner: raw::Executor::new(|_| unsafe { asm!("sev") }, ptr::null_mut()), |
| 26 | not_send: PhantomData, | 27 | not_send: PhantomData, |
| 27 | } | 28 | } |
| 28 | } | 29 | } |
| @@ -49,8 +50,10 @@ impl Executor { | |||
| 49 | init(self.inner.spawner()); | 50 | init(self.inner.spawner()); |
| 50 | 51 | ||
| 51 | loop { | 52 | loop { |
| 52 | unsafe { self.inner.poll() }; | 53 | unsafe { |
| 53 | cortex_m::asm::wfe(); | 54 | self.inner.poll(); |
| 55 | asm!("wfe"); | ||
| 56 | }; | ||
| 54 | } | 57 | } |
| 55 | } | 58 | } |
| 56 | } | 59 | } |
diff --git a/embassy/src/executor/arch/riscv32.rs b/embassy-executor/src/executor/arch/riscv32.rs index 7a7d5698c..7a7d5698c 100644 --- a/embassy/src/executor/arch/riscv32.rs +++ b/embassy-executor/src/executor/arch/riscv32.rs | |||
diff --git a/embassy/src/executor/arch/std.rs b/embassy-executor/src/executor/arch/std.rs index b93ab8a79..b93ab8a79 100644 --- a/embassy/src/executor/arch/std.rs +++ b/embassy-executor/src/executor/arch/std.rs | |||
diff --git a/embassy/src/executor/arch/wasm.rs b/embassy-executor/src/executor/arch/wasm.rs index 9d5aa31ed..9d5aa31ed 100644 --- a/embassy/src/executor/arch/wasm.rs +++ b/embassy-executor/src/executor/arch/wasm.rs | |||
diff --git a/embassy/src/executor/arch/xtensa.rs b/embassy-executor/src/executor/arch/xtensa.rs index 20bd7b8a5..20bd7b8a5 100644 --- a/embassy/src/executor/arch/xtensa.rs +++ b/embassy-executor/src/executor/arch/xtensa.rs | |||
diff --git a/embassy/src/executor/mod.rs b/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 @@ | |||
| 10 | //! - 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. | 10 | //! - 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. |
| 11 | //! - Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks. | 11 | //! - Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks. |
| 12 | 12 | ||
| 13 | #![deny(missing_docs)] | ||
| 14 | |||
| 15 | cfg_if::cfg_if! { | 13 | cfg_if::cfg_if! { |
| 16 | if #[cfg(cortex_m)] { | 14 | if #[cfg(cortex_m)] { |
| 17 | #[path="arch/cortex_m.rs"] | 15 | #[path="arch/cortex_m.rs"] |
diff --git a/embassy/src/executor/raw/mod.rs b/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 @@ | |||
| 5 | //! ## WARNING: here be dragons! | 5 | //! ## WARNING: here be dragons! |
| 6 | //! | 6 | //! |
| 7 | //! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe | 7 | //! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe |
| 8 | //! executor wrappers in [`executor`](crate::executor) and the [`embassy::task`](embassy_macros::task) macro, which are fully safe. | 8 | //! executor wrappers in [`executor`](crate::executor) and the [`embassy_executor::task`](embassy_macros::task) macro, which are fully safe. |
| 9 | 9 | ||
| 10 | mod run_queue; | 10 | mod run_queue; |
| 11 | #[cfg(feature = "time")] | 11 | #[cfg(feature = "time")] |
| @@ -99,7 +99,7 @@ impl TaskHeader { | |||
| 99 | /// A `TaskStorage` must live forever, it may not be deallocated even after the task has finished | 99 | /// A `TaskStorage` must live forever, it may not be deallocated even after the task has finished |
| 100 | /// running. Hence the relevant methods require `&'static self`. It may be reused, however. | 100 | /// running. Hence the relevant methods require `&'static self`. It may be reused, however. |
| 101 | /// | 101 | /// |
| 102 | /// Internally, the [embassy::task](embassy_macros::task) macro allocates an array of `TaskStorage`s | 102 | /// Internally, the [embassy_executor::task](embassy_macros::task) macro allocates an array of `TaskStorage`s |
| 103 | /// in a `static`. The most common reason to use the raw `Task` is to have control of where | 103 | /// in a `static`. The most common reason to use the raw `Task` is to have control of where |
| 104 | /// the memory for the task is allocated: on the stack, or on the heap with e.g. `Box::leak`, etc. | 104 | /// the memory for the task is allocated: on the stack, or on the heap with e.g. `Box::leak`, etc. |
| 105 | 105 | ||
diff --git a/embassy/src/executor/raw/run_queue.rs b/embassy-executor/src/executor/raw/run_queue.rs index 31615da7e..31615da7e 100644 --- a/embassy/src/executor/raw/run_queue.rs +++ b/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 index 62fcfc531..62fcfc531 100644 --- a/embassy/src/executor/raw/timer_queue.rs +++ b/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 index ed5822188..ed5822188 100644 --- a/embassy/src/executor/raw/util.rs +++ b/embassy-executor/src/executor/raw/util.rs | |||
diff --git a/embassy/src/executor/raw/waker.rs b/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<TaskHeader> { | |||
| 40 | // TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992 | 40 | // TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992 |
| 41 | let hack: &WakerHack = unsafe { mem::transmute(waker) }; | 41 | let hack: &WakerHack = unsafe { mem::transmute(waker) }; |
| 42 | if hack.vtable != &VTABLE { | 42 | if hack.vtable != &VTABLE { |
| 43 | panic!("Found waker not created by the embassy executor. Consider enabling the `executor-agnostic` feature on the `embassy` crate.") | 43 | panic!("Found waker not created by the Embassy executor. `embassy_executor::time::Timer` only works with the Embassy executor.") |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | // safety: we never create a waker with a null data pointer. | 46 | // 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 index c8d036eb8..25a0d7dbb 100644 --- a/embassy/src/executor/spawner.rs +++ b/embassy-executor/src/executor/spawner.rs | |||
| @@ -3,13 +3,13 @@ use core::mem; | |||
| 3 | use core::ptr::NonNull; | 3 | use core::ptr::NonNull; |
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use futures::future::poll_fn; | 6 | use futures_util::future::poll_fn; |
| 7 | 7 | ||
| 8 | use super::raw; | 8 | use super::raw; |
| 9 | 9 | ||
| 10 | /// Token to spawn a newly-created task in an executor. | 10 | /// Token to spawn a newly-created task in an executor. |
| 11 | /// | 11 | /// |
| 12 | /// When calling a task function (like `#[embassy::task] async fn my_task() { ... }`), the returned | 12 | /// When calling a task function (like `#[embassy_executor::task] async fn my_task() { ... }`), the returned |
| 13 | /// value is a `SpawnToken` that represents an instance of the task, ready to spawn. You must | 13 | /// value is a `SpawnToken` that represents an instance of the task, ready to spawn. You must |
| 14 | /// then spawn it into an executor, typically with [`Spawner::spawn()`]. | 14 | /// then spawn it into an executor, typically with [`Spawner::spawn()`]. |
| 15 | /// | 15 | /// |
| @@ -56,9 +56,9 @@ impl<S> Drop for SpawnToken<S> { | |||
| 56 | pub enum SpawnError { | 56 | pub enum SpawnError { |
| 57 | /// Too many instances of this task are already running. | 57 | /// Too many instances of this task are already running. |
| 58 | /// | 58 | /// |
| 59 | /// By default, a task marked with `#[embassy::task]` can only have one instance | 59 | /// By default, a task marked with `#[embassy_executor::task]` can only have one instance |
| 60 | /// running at a time. You may allow multiple instances to run in parallel with | 60 | /// running at a time. You may allow multiple instances to run in parallel with |
| 61 | /// `#[embassy::task(pool_size = 4)]`, at the cost of higher RAM usage. | 61 | /// `#[embassy_executor::task(pool_size = 4)]`, at the cost of higher RAM usage. |
| 62 | Busy, | 62 | Busy, |
| 63 | } | 63 | } |
| 64 | 64 | ||
| @@ -101,7 +101,7 @@ impl Spawner { | |||
| 101 | 101 | ||
| 102 | /// Spawn a task into an executor. | 102 | /// Spawn a task into an executor. |
| 103 | /// | 103 | /// |
| 104 | /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy::task]`). | 104 | /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy_executor::task]`). |
| 105 | pub fn spawn<S>(&self, token: SpawnToken<S>) -> Result<(), SpawnError> { | 105 | pub fn spawn<S>(&self, token: SpawnToken<S>) -> Result<(), SpawnError> { |
| 106 | let task = token.raw_task; | 106 | let task = token.raw_task; |
| 107 | mem::forget(token); | 107 | mem::forget(token); |
| @@ -177,7 +177,7 @@ impl SendSpawner { | |||
| 177 | 177 | ||
| 178 | /// Spawn a task into an executor. | 178 | /// Spawn a task into an executor. |
| 179 | /// | 179 | /// |
| 180 | /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy::task]`). | 180 | /// You obtain the `token` by calling a task function (i.e. one marked with `#[embassy_executor::task]`). |
| 181 | pub fn spawn<S: Send>(&self, token: SpawnToken<S>) -> Result<(), SpawnError> { | 181 | pub fn spawn<S: Send>(&self, token: SpawnToken<S>) -> Result<(), SpawnError> { |
| 182 | let header = token.raw_task; | 182 | let header = token.raw_task; |
| 183 | mem::forget(token); | 183 | mem::forget(token); |
diff --git a/embassy/src/fmt.rs b/embassy-executor/src/fmt.rs index f8bb0a035..f8bb0a035 100644 --- a/embassy/src/fmt.rs +++ b/embassy-executor/src/fmt.rs | |||
diff --git a/embassy/src/lib.rs b/embassy-executor/src/lib.rs index b7be8b34c..69e4aeb4b 100644 --- a/embassy/src/lib.rs +++ b/embassy-executor/src/lib.rs | |||
| @@ -8,14 +8,9 @@ | |||
| 8 | // This mod MUST go first, so that the others see its macros. | 8 | // This mod MUST go first, so that the others see its macros. |
| 9 | pub(crate) mod fmt; | 9 | pub(crate) mod fmt; |
| 10 | 10 | ||
| 11 | pub mod blocking_mutex; | ||
| 12 | pub mod channel; | ||
| 13 | pub mod executor; | 11 | pub mod executor; |
| 14 | pub mod mutex; | ||
| 15 | #[cfg(feature = "time")] | 12 | #[cfg(feature = "time")] |
| 16 | pub mod time; | 13 | pub mod time; |
| 17 | pub mod util; | ||
| 18 | pub mod waitqueue; | ||
| 19 | 14 | ||
| 20 | #[cfg(feature = "nightly")] | 15 | #[cfg(feature = "nightly")] |
| 21 | pub use embassy_macros::{main, task}; | 16 | pub use embassy_macros::{main, task}; |
diff --git a/embassy/src/time/delay.rs b/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! { | |||
| 35 | if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { | 35 | if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { |
| 36 | use crate::time::Timer; | 36 | use crate::time::Timer; |
| 37 | use core::future::Future; | 37 | use core::future::Future; |
| 38 | use futures::FutureExt; | 38 | use futures_util::FutureExt; |
| 39 | 39 | ||
| 40 | impl embedded_hal_async::delay::DelayUs for Delay { | 40 | impl embedded_hal_async::delay::DelayUs for Delay { |
| 41 | type Error = core::convert::Infallible; | 41 | type Error = core::convert::Infallible; |
diff --git a/embassy/src/time/driver.rs b/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 @@ | |||
| 1 | //! Time driver interface | 1 | //! Time driver interface |
| 2 | //! | 2 | //! |
| 3 | //! This module defines the interface a driver needs to implement to power the `embassy::time` module. | 3 | //! This module defines the interface a driver needs to implement to power the `embassy_executor::time` module. |
| 4 | //! | 4 | //! |
| 5 | //! # Implementing a driver | 5 | //! # Implementing a driver |
| 6 | //! | 6 | //! |
| 7 | //! - Define a struct `MyDriver` | 7 | //! - Define a struct `MyDriver` |
| 8 | //! - Implement [`Driver`] for it | 8 | //! - Implement [`Driver`] for it |
| 9 | //! - Register it as the global driver with [`time_driver_impl`]. | 9 | //! - Register it as the global driver with [`time_driver_impl`]. |
| 10 | //! - Enable the Cargo features `embassy/time` and one of `embassy/time-tick-*` corresponding to the | 10 | //! - Enable the Cargo features `embassy-executor/time` and one of `embassy-executor/time-tick-*` corresponding to the |
| 11 | //! tick rate of your driver. | 11 | //! tick rate of your driver. |
| 12 | //! | 12 | //! |
| 13 | //! If you wish to make the tick rate configurable by the end user, you should do so by exposing your own | 13 | //! If you wish to make the tick rate configurable by the end user, you should do so by exposing your own |
| 14 | //! Cargo features and having each enable the corresponding `embassy/time-tick-*`. | 14 | //! Cargo features and having each enable the corresponding `embassy-executor/time-tick-*`. |
| 15 | //! | 15 | //! |
| 16 | //! # Linkage details | 16 | //! # Linkage details |
| 17 | //! | 17 | //! |
| @@ -34,10 +34,10 @@ | |||
| 34 | //! # Example | 34 | //! # Example |
| 35 | //! | 35 | //! |
| 36 | //! ``` | 36 | //! ``` |
| 37 | //! use embassy::time::driver::{Driver, AlarmHandle}; | 37 | //! use embassy_executor::time::driver::{Driver, AlarmHandle}; |
| 38 | //! | 38 | //! |
| 39 | //! struct MyDriver{}; // not public! | 39 | //! struct MyDriver{}; // not public! |
| 40 | //! embassy::time_driver_impl!(static DRIVER: MyDriver = MyDriver{}); | 40 | //! embassy_executor::time_driver_impl!(static DRIVER: MyDriver = MyDriver{}); |
| 41 | //! | 41 | //! |
| 42 | //! impl Driver for MyDriver { | 42 | //! impl Driver for MyDriver { |
| 43 | //! fn now(&self) -> u64 { | 43 | //! fn now(&self) -> u64 { |
diff --git a/embassy/src/time/driver_std.rs b/embassy-executor/src/time/driver_std.rs index cb66f7c19..cb66f7c19 100644 --- a/embassy/src/time/driver_std.rs +++ b/embassy-executor/src/time/driver_std.rs | |||
diff --git a/embassy/src/time/driver_wasm.rs b/embassy-executor/src/time/driver_wasm.rs index 5f585a19a..5f585a19a 100644 --- a/embassy/src/time/driver_wasm.rs +++ b/embassy-executor/src/time/driver_wasm.rs | |||
diff --git a/embassy/src/time/duration.rs b/embassy-executor/src/time/duration.rs index dc4f16bd4..dc4f16bd4 100644 --- a/embassy/src/time/duration.rs +++ b/embassy-executor/src/time/duration.rs | |||
diff --git a/embassy/src/time/instant.rs b/embassy-executor/src/time/instant.rs index 6a4925f47..6a4925f47 100644 --- a/embassy/src/time/instant.rs +++ b/embassy-executor/src/time/instant.rs | |||
diff --git a/embassy/src/time/mod.rs b/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 @@ | |||
| 26 | //! like `2021-08-24 13:33:21`). | 26 | //! like `2021-08-24 13:33:21`). |
| 27 | //! | 27 | //! |
| 28 | //! If persistence across reboots is not needed, support can be built on top of | 28 | //! If persistence across reboots is not needed, support can be built on top of |
| 29 | //! `embassy::time` by storing the offset between "seconds elapsed since boot" | 29 | //! `embassy_executor::time` by storing the offset between "seconds elapsed since boot" |
| 30 | //! and "seconds since unix epoch". | 30 | //! and "seconds since unix epoch". |
| 31 | //! | 31 | //! |
| 32 | //! # Time driver | 32 | //! # Time driver |
| @@ -35,7 +35,7 @@ | |||
| 35 | //! Only one driver can be active in a program. | 35 | //! Only one driver can be active in a program. |
| 36 | //! | 36 | //! |
| 37 | //! All methods and structs transparently call into the active driver. This makes it | 37 | //! All methods and structs transparently call into the active driver. This makes it |
| 38 | //! possible for libraries to use `embassy::time` in a driver-agnostic way without | 38 | //! possible for libraries to use `embassy_executor::time` in a driver-agnostic way without |
| 39 | //! requiring generic parameters. | 39 | //! requiring generic parameters. |
| 40 | //! | 40 | //! |
| 41 | //! For more details, check the [`driver`] module. | 41 | //! For more details, check the [`driver`] module. |
diff --git a/embassy/src/time/timer.rs b/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; | |||
| 2 | use core::pin::Pin; | 2 | use core::pin::Pin; |
| 3 | use core::task::{Context, Poll}; | 3 | use core::task::{Context, Poll}; |
| 4 | 4 | ||
| 5 | use futures::future::{select, Either}; | 5 | use futures_util::future::{select, Either}; |
| 6 | use futures::{pin_mut, Stream}; | 6 | use futures_util::{pin_mut, Stream}; |
| 7 | 7 | ||
| 8 | use crate::executor::raw; | 8 | use crate::executor::raw; |
| 9 | use crate::time::{Duration, Instant}; | 9 | use crate::time::{Duration, Instant}; |
| @@ -49,9 +49,9 @@ impl Timer { | |||
| 49 | /// # #![feature(type_alias_impl_trait)] | 49 | /// # #![feature(type_alias_impl_trait)] |
| 50 | /// # | 50 | /// # |
| 51 | /// # fn foo() {} | 51 | /// # fn foo() {} |
| 52 | /// use embassy::time::{Duration, Timer}; | 52 | /// use embassy_executor::time::{Duration, Timer}; |
| 53 | /// | 53 | /// |
| 54 | /// #[embassy::task] | 54 | /// #[embassy_executor::task] |
| 55 | /// async fn demo_sleep_seconds() { | 55 | /// async fn demo_sleep_seconds() { |
| 56 | /// // suspend this task for one second. | 56 | /// // suspend this task for one second. |
| 57 | /// Timer::after(Duration::from_secs(1)).await; | 57 | /// Timer::after(Duration::from_secs(1)).await; |
| @@ -88,10 +88,10 @@ impl Future for Timer { | |||
| 88 | /// ``` no_run | 88 | /// ``` no_run |
| 89 | /// # #![feature(type_alias_impl_trait)] | 89 | /// # #![feature(type_alias_impl_trait)] |
| 90 | /// # | 90 | /// # |
| 91 | /// use embassy::time::{Duration, Timer}; | 91 | /// use embassy_executor::time::{Duration, Timer}; |
| 92 | /// # fn foo() {} | 92 | /// # fn foo() {} |
| 93 | /// | 93 | /// |
| 94 | /// #[embassy::task] | 94 | /// #[embassy_executor::task] |
| 95 | /// async fn ticker_example_0() { | 95 | /// async fn ticker_example_0() { |
| 96 | /// loop { | 96 | /// loop { |
| 97 | /// foo(); | 97 | /// foo(); |
| @@ -108,11 +108,11 @@ impl Future for Timer { | |||
| 108 | /// ``` no_run | 108 | /// ``` no_run |
| 109 | /// # #![feature(type_alias_impl_trait)] | 109 | /// # #![feature(type_alias_impl_trait)] |
| 110 | /// # | 110 | /// # |
| 111 | /// use embassy::time::{Duration, Ticker}; | 111 | /// use embassy_executor::time::{Duration, Ticker}; |
| 112 | /// use futures::StreamExt; | 112 | /// use futures::StreamExt; |
| 113 | /// # fn foo(){} | 113 | /// # fn foo(){} |
| 114 | /// | 114 | /// |
| 115 | /// #[embassy::task] | 115 | /// #[embassy_executor::task] |
| 116 | /// async fn ticker_example_1() { | 116 | /// async fn ticker_example_1() { |
| 117 | /// let mut ticker = Ticker::every(Duration::from_secs(1)); | 117 | /// let mut ticker = Ticker::every(Duration::from_secs(1)); |
| 118 | /// loop { | 118 | /// 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" | |||
| 6 | [features] | 6 | [features] |
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy = { version = "0.1.0", path = "../embassy" } | ||
| 10 | |||
| 11 | defmt = { version = "0.3", optional = true } | 9 | defmt = { version = "0.3", optional = true } |
| 12 | log = { version = "0.4.14", optional = true } | 10 | log = { version = "0.4.14", optional = true } |
| 13 | cortex-m = "0.7.3" | 11 | |
| 12 | embassy-util = { version = "0.1.0", path = "../embassy-util" } | ||
| 14 | num-traits = { version = "0.2.14", default-features = false } | 13 | 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; | |||
| 10 | pub mod ratio; | 10 | pub mod ratio; |
| 11 | pub mod ring_buffer; | 11 | pub mod ring_buffer; |
| 12 | pub use peripheral::{Peripheral, PeripheralRef}; | 12 | pub use peripheral::{Peripheral, PeripheralRef}; |
| 13 | |||
| 14 | /// Low power blocking wait loop using WFE/SEV. | ||
| 15 | pub fn low_power_wait_until(mut condition: impl FnMut() -> bool) { | ||
| 16 | while !condition() { | ||
| 17 | // WFE might "eat" an event that would have otherwise woken the executor. | ||
| 18 | cortex_m::asm::wfe(); | ||
| 19 | } | ||
| 20 | // Retrigger an event to be transparent to the executor. | ||
| 21 | cortex_m::asm::sev(); | ||
| 22 | } | ||
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 | |||
| 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-lora/src/" | 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-lora/src/" |
| 9 | features = ["time", "defmt"] | 9 | features = ["time", "defmt"] |
| 10 | flavors = [ | 10 | flavors = [ |
| 11 | { name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy/time-tick-32768hz"] }, | 11 | { name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] }, |
| 12 | { name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy/time-tick-32768hz"] }, | 12 | { name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] }, |
| 13 | ] | 13 | ] |
| 14 | 14 | ||
| 15 | [lib] | 15 | [lib] |
| @@ -24,7 +24,8 @@ time = [] | |||
| 24 | defmt = { version = "0.3", optional = true } | 24 | defmt = { version = "0.3", optional = true } |
| 25 | log = { version = "0.4.14", optional = true } | 25 | log = { version = "0.4.14", optional = true } |
| 26 | 26 | ||
| 27 | embassy = { version = "0.1.0", path = "../embassy", default-features = false } | 27 | embassy-executor = { version = "0.1.0", path = "../embassy-executor" } |
| 28 | embassy-util = { version = "0.1.0", path = "../embassy-util" } | ||
| 28 | embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } | 29 | embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } |
| 29 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } | 30 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } |
| 30 | embedded-hal-async = { version = "0.1.0-alpha.1" } | 31 | 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; | |||
| 18 | impl lorawan_device::async_device::radio::Timer for LoraTimer { | 18 | impl lorawan_device::async_device::radio::Timer for LoraTimer { |
| 19 | type DelayFuture<'m> = impl core::future::Future<Output = ()> + 'm; | 19 | type DelayFuture<'m> = impl core::future::Future<Output = ()> + 'm; |
| 20 | fn delay_ms<'m>(&'m mut self, millis: u64) -> Self::DelayFuture<'m> { | 20 | fn delay_ms<'m>(&'m mut self, millis: u64) -> Self::DelayFuture<'m> { |
| 21 | embassy::time::Timer::after(embassy::time::Duration::from_millis(millis)) | 21 | embassy_executor::time::Timer::after(embassy_executor::time::Duration::from_millis(millis)) |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
diff --git a/embassy-lora/src/stm32wl/mod.rs b/embassy-lora/src/stm32wl/mod.rs index b0d101b77..4a4c5cfb7 100644 --- a/embassy-lora/src/stm32wl/mod.rs +++ b/embassy-lora/src/stm32wl/mod.rs | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | use core::future::Future; | 2 | use core::future::Future; |
| 3 | use core::mem::MaybeUninit; | 3 | use core::mem::MaybeUninit; |
| 4 | 4 | ||
| 5 | use embassy::channel::signal::Signal; | ||
| 6 | use embassy_hal_common::{into_ref, PeripheralRef}; | 5 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 7 | use embassy_stm32::dma::NoDma; | 6 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::gpio::{AnyPin, Output}; | 7 | use embassy_stm32::gpio::{AnyPin, Output}; |
| @@ -13,6 +12,7 @@ use embassy_stm32::subghz::{ | |||
| 13 | Status, SubGhz, TcxoMode, TcxoTrim, Timeout, TxParams, | 12 | Status, SubGhz, TcxoMode, TcxoTrim, Timeout, TxParams, |
| 14 | }; | 13 | }; |
| 15 | use embassy_stm32::Peripheral; | 14 | use embassy_stm32::Peripheral; |
| 15 | use embassy_util::channel::signal::Signal; | ||
| 16 | use lorawan_device::async_device::radio::{Bandwidth, PhyRxTx, RfConfig, RxQuality, SpreadingFactor, TxConfig}; | 16 | use lorawan_device::async_device::radio::{Bandwidth, PhyRxTx, RfConfig, RxQuality, SpreadingFactor, TxConfig}; |
| 17 | use lorawan_device::async_device::Timings; | 17 | use lorawan_device::async_device::Timings; |
| 18 | 18 | ||
diff --git a/embassy-lora/src/sx127x/sx127x_lora/mod.rs b/embassy-lora/src/sx127x/sx127x_lora/mod.rs index 8b937ec2f..b3636d097 100644 --- a/embassy-lora/src/sx127x/sx127x_lora/mod.rs +++ b/embassy-lora/src/sx127x/sx127x_lora/mod.rs | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #![allow(dead_code)] | 6 | #![allow(dead_code)] |
| 7 | 7 | ||
| 8 | use bit_field::BitField; | 8 | use bit_field::BitField; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_executor::time::{Duration, Timer}; |
| 10 | use embedded_hal::digital::v2::OutputPin; | 10 | use embedded_hal::digital::v2::OutputPin; |
| 11 | use embedded_hal_async::spi::SpiBus; | 11 | use embedded_hal_async::spi::SpiBus; |
| 12 | 12 | ||
diff --git a/embassy-macros/src/macros/cortex_m_interrupt_take.rs b/embassy-macros/src/macros/cortex_m_interrupt_take.rs index 29dca12fd..133eb5c26 100644 --- a/embassy-macros/src/macros/cortex_m_interrupt_take.rs +++ b/embassy-macros/src/macros/cortex_m_interrupt_take.rs | |||
| @@ -16,15 +16,15 @@ pub fn run(name: syn::Ident) -> Result<TokenStream, TokenStream> { | |||
| 16 | static HANDLER: interrupt::Handler; | 16 | static HANDLER: interrupt::Handler; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | let func = HANDLER.func.load(::embassy::export::atomic::Ordering::Relaxed); | 19 | let func = HANDLER.func.load(::embassy_executor::export::atomic::Ordering::Relaxed); |
| 20 | let ctx = HANDLER.ctx.load(::embassy::export::atomic::Ordering::Relaxed); | 20 | let ctx = HANDLER.ctx.load(::embassy_executor::export::atomic::Ordering::Relaxed); |
| 21 | let func: fn(*mut ()) = ::core::mem::transmute(func); | 21 | let func: fn(*mut ()) = ::core::mem::transmute(func); |
| 22 | func(ctx) | 22 | func(ctx) |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | static TAKEN: ::embassy::export::atomic::AtomicBool = ::embassy::export::atomic::AtomicBool::new(false); | 25 | static TAKEN: ::embassy_executor::export::atomic::AtomicBool = ::embassy_executor::export::atomic::AtomicBool::new(false); |
| 26 | 26 | ||
| 27 | if TAKEN.compare_exchange(false, true, ::embassy::export::atomic::Ordering::AcqRel, ::embassy::export::atomic::Ordering::Acquire).is_err() { | 27 | if TAKEN.compare_exchange(false, true, ::embassy_executor::export::atomic::Ordering::AcqRel, ::embassy_executor::export::atomic::Ordering::Acquire).is_err() { |
| 28 | core::panic!("IRQ Already taken"); | 28 | core::panic!("IRQ Already taken"); |
| 29 | } | 29 | } |
| 30 | 30 | ||
diff --git a/embassy-macros/src/macros/main.rs b/embassy-macros/src/macros/main.rs index 5638276b2..a8c8bb0d7 100644 --- a/embassy-macros/src/macros/main.rs +++ b/embassy-macros/src/macros/main.rs | |||
| @@ -49,14 +49,14 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, Toke | |||
| 49 | 49 | ||
| 50 | let embassy_prefix = args.embassy_prefix; | 50 | let embassy_prefix = args.embassy_prefix; |
| 51 | let embassy_prefix_lit = embassy_prefix.literal(); | 51 | let embassy_prefix_lit = embassy_prefix.literal(); |
| 52 | let embassy_path = embassy_prefix.append("embassy").path(); | 52 | let embassy_path = embassy_prefix.append("embassy_executor").path(); |
| 53 | let f_body = f.block; | 53 | let f_body = f.block; |
| 54 | 54 | ||
| 55 | #[cfg(feature = "wasm")] | 55 | #[cfg(feature = "wasm")] |
| 56 | let main = quote! { | 56 | let main = quote! { |
| 57 | #[wasm_bindgen::prelude::wasm_bindgen(start)] | 57 | #[wasm_bindgen::prelude::wasm_bindgen(start)] |
| 58 | pub fn main() -> Result<(), wasm_bindgen::JsValue> { | 58 | pub fn main() -> Result<(), wasm_bindgen::JsValue> { |
| 59 | static EXECUTOR: #embassy_path::util::Forever<#embassy_path::executor::Executor> = #embassy_path::util::Forever::new(); | 59 | static EXECUTOR: ::embassy_util::Forever<#embassy_path::executor::Executor> = ::embassy_util::Forever::new(); |
| 60 | let executor = EXECUTOR.put(#embassy_path::executor::Executor::new()); | 60 | let executor = EXECUTOR.put(#embassy_path::executor::Executor::new()); |
| 61 | 61 | ||
| 62 | executor.start(|spawner| { | 62 | executor.start(|spawner| { |
diff --git a/embassy-macros/src/macros/task.rs b/embassy-macros/src/macros/task.rs index 53c9af546..57087c81c 100644 --- a/embassy-macros/src/macros/task.rs +++ b/embassy-macros/src/macros/task.rs | |||
| @@ -16,7 +16,7 @@ struct Args { | |||
| 16 | pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, TokenStream> { | 16 | pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, TokenStream> { |
| 17 | let args = Args::from_list(&args).map_err(|e| e.write_errors())?; | 17 | let args = Args::from_list(&args).map_err(|e| e.write_errors())?; |
| 18 | 18 | ||
| 19 | let embassy_prefix = args.embassy_prefix.append("embassy"); | 19 | let embassy_prefix = args.embassy_prefix.append("embassy_executor"); |
| 20 | let embassy_path = embassy_prefix.path(); | 20 | let embassy_path = embassy_prefix.path(); |
| 21 | 21 | ||
| 22 | let pool_size: usize = args.pool_size.unwrap_or(1); | 22 | let pool_size: usize = args.pool_size.unwrap_or(1); |
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml index 70acc7e4e..64cb5bd8f 100644 --- a/embassy-net/Cargo.toml +++ b/embassy-net/Cargo.toml | |||
| @@ -7,7 +7,7 @@ edition = "2021" | |||
| 7 | [package.metadata.embassy_docs] | 7 | [package.metadata.embassy_docs] |
| 8 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-net-v$VERSION/embassy-net/src/" | 8 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-net-v$VERSION/embassy-net/src/" |
| 9 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-net/src/" | 9 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-net/src/" |
| 10 | features = [ "pool-4", "defmt", "tcp", "dns", "dhcpv4", "proto-ipv6", "medium-ethernet", "medium-ip", "embassy/time", "embassy/time-tick-1mhz"] | 10 | features = [ "pool-4", "defmt", "tcp", "dns", "dhcpv4", "proto-ipv6", "medium-ethernet", "medium-ip", "embassy-executor/time", "embassy-executor/time-tick-1mhz"] |
| 11 | flavors = [ | 11 | flavors = [ |
| 12 | { name = "default", target = "thumbv7em-none-eabihf" }, | 12 | { name = "default", target = "thumbv7em-none-eabihf" }, |
| 13 | ] | 13 | ] |
| @@ -37,7 +37,8 @@ pool-128 = [] | |||
| 37 | defmt = { version = "0.3", optional = true } | 37 | defmt = { version = "0.3", optional = true } |
| 38 | log = { version = "0.4.14", optional = true } | 38 | log = { version = "0.4.14", optional = true } |
| 39 | 39 | ||
| 40 | embassy = { version = "0.1.0", path = "../embassy" } | 40 | embassy-executor = { version = "0.1.0", path = "../embassy-executor" } |
| 41 | embassy-util = { version = "0.1.0", path = "../embassy-util" } | ||
| 41 | embedded-io = { version = "0.3.0", features = [ "async" ] } | 42 | embedded-io = { version = "0.3.0", features = [ "async" ] } |
| 42 | 43 | ||
| 43 | managed = { version = "0.8.0", default-features = false, features = [ "map" ] } | 44 | managed = { version = "0.8.0", default-features = false, features = [ "map" ] } |
diff --git a/embassy-net/src/stack.rs b/embassy-net/src/stack.rs index f3b1ff9d4..06bb732ff 100644 --- a/embassy-net/src/stack.rs +++ b/embassy-net/src/stack.rs | |||
| @@ -2,8 +2,8 @@ use core::cell::UnsafeCell; | |||
| 2 | use core::future::Future; | 2 | use core::future::Future; |
| 3 | use core::task::{Context, Poll}; | 3 | use core::task::{Context, Poll}; |
| 4 | 4 | ||
| 5 | use embassy::time::{Instant, Timer}; | 5 | use embassy_executor::time::{Instant, Timer}; |
| 6 | use embassy::waitqueue::WakerRegistration; | 6 | use embassy_util::waitqueue::WakerRegistration; |
| 7 | use futures::future::poll_fn; | 7 | use futures::future::poll_fn; |
| 8 | use futures::pin_mut; | 8 | use futures::pin_mut; |
| 9 | use heapless::Vec; | 9 | use heapless::Vec; |
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index b2b6db1cd..75780d417 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml | |||
| @@ -16,12 +16,12 @@ flavors = [ | |||
| 16 | 16 | ||
| 17 | [features] | 17 | [features] |
| 18 | 18 | ||
| 19 | time = ["embassy/time"] | 19 | time = ["embassy-executor/time"] |
| 20 | 20 | ||
| 21 | defmt = ["dep:defmt", "embassy/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"] | 21 | defmt = ["dep:defmt", "embassy-executor/defmt", "embassy-util/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"] |
| 22 | 22 | ||
| 23 | # Enable nightly-only features | 23 | # Enable nightly-only features |
| 24 | nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"] | 24 | nightly = ["embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"] |
| 25 | 25 | ||
| 26 | # Reexport the PAC for the currently enabled chip at `embassy_nrf::pac`. | 26 | # Reexport the PAC for the currently enabled chip at `embassy_nrf::pac`. |
| 27 | # This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version. | 27 | # This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version. |
| @@ -57,14 +57,15 @@ _nrf5340-net = ["_nrf5340", "nrf5340-net-pac"] | |||
| 57 | _nrf5340 = ["_gpio-p1", "_dppi"] | 57 | _nrf5340 = ["_gpio-p1", "_dppi"] |
| 58 | _nrf9160 = ["nrf9160-pac", "_dppi"] | 58 | _nrf9160 = ["nrf9160-pac", "_dppi"] |
| 59 | 59 | ||
| 60 | _time-driver = ["embassy/time-tick-32768hz", "time"] | 60 | _time-driver = ["embassy-executor/time-tick-32768hz", "time"] |
| 61 | 61 | ||
| 62 | _ppi = [] | 62 | _ppi = [] |
| 63 | _dppi = [] | 63 | _dppi = [] |
| 64 | _gpio-p1 = [] | 64 | _gpio-p1 = [] |
| 65 | 65 | ||
| 66 | [dependencies] | 66 | [dependencies] |
| 67 | embassy = { version = "0.1.0", path = "../embassy" } | 67 | embassy-executor = { version = "0.1.0", path = "../embassy-executor", optional = true } |
| 68 | embassy-util = { version = "0.1.0", path = "../embassy-util" } | ||
| 68 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} | 69 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} |
| 69 | embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["nrf"]} | 70 | embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["nrf"]} |
| 70 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } | 71 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } |
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 89c1ba908..21ff1d73b 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs | |||
| @@ -18,10 +18,10 @@ use core::future::Future; | |||
| 18 | use core::sync::atomic::{compiler_fence, Ordering}; | 18 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 19 | use core::task::Poll; | 19 | use core::task::Poll; |
| 20 | 20 | ||
| 21 | use embassy::waitqueue::WakerRegistration; | ||
| 22 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; | 21 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; |
| 23 | use embassy_hal_common::ring_buffer::RingBuffer; | 22 | use embassy_hal_common::ring_buffer::RingBuffer; |
| 24 | use embassy_hal_common::{into_ref, low_power_wait_until, PeripheralRef}; | 23 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 24 | use embassy_util::waitqueue::WakerRegistration; | ||
| 25 | use futures::future::poll_fn; | 25 | use futures::future::poll_fn; |
| 26 | // Re-export SVD variants to allow user to directly set values | 26 | // Re-export SVD variants to allow user to directly set values |
| 27 | pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity}; | 27 | pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity}; |
| @@ -450,3 +450,13 @@ impl<'a, U: UarteInstance, T: TimerInstance> PeripheralState for StateInner<'a, | |||
| 450 | trace!("irq: end"); | 450 | trace!("irq: end"); |
| 451 | } | 451 | } |
| 452 | } | 452 | } |
| 453 | |||
| 454 | /// Low power blocking wait loop using WFE/SEV. | ||
| 455 | fn low_power_wait_until(mut condition: impl FnMut() -> bool) { | ||
| 456 | while !condition() { | ||
| 457 | // WFE might "eat" an event that would have otherwise woken the executor. | ||
| 458 | cortex_m::asm::wfe(); | ||
| 459 | } | ||
| 460 | // Retrigger an event to be transparent to the executor. | ||
| 461 | cortex_m::asm::sev(); | ||
| 462 | } | ||
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index cef80ae0a..cf49b0db0 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -2,8 +2,8 @@ use core::convert::Infallible; | |||
| 2 | use core::future::Future; | 2 | use core::future::Future; |
| 3 | use core::task::{Context, Poll}; | 3 | use core::task::{Context, Poll}; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_hal_common::{impl_peripheral, Peripheral, PeripheralRef}; | 5 | use embassy_hal_common::{impl_peripheral, Peripheral, PeripheralRef}; |
| 6 | use embassy_util::waitqueue::AtomicWaker; | ||
| 7 | use futures::future::poll_fn; | 7 | use futures::future::poll_fn; |
| 8 | 8 | ||
| 9 | use crate::gpio::sealed::Pin as _; | 9 | use crate::gpio::sealed::Pin as _; |
diff --git a/embassy-nrf/src/qdec.rs b/embassy-nrf/src/qdec.rs index f6daec252..83f2916b9 100644 --- a/embassy-nrf/src/qdec.rs +++ b/embassy-nrf/src/qdec.rs | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_hal_common::{into_ref, PeripheralRef}; | 5 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 6 | use embassy_util::waitqueue::AtomicWaker; | ||
| 7 | use futures::future::poll_fn; | 7 | use futures::future::poll_fn; |
| 8 | 8 | ||
| 9 | use crate::gpio::sealed::Pin as _; | 9 | use crate::gpio::sealed::Pin as _; |
diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index 67634b5b7..cedf88de5 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs | |||
| @@ -512,7 +512,7 @@ cfg_if::cfg_if! { | |||
| 512 | } | 512 | } |
| 513 | 513 | ||
| 514 | pub(crate) mod sealed { | 514 | pub(crate) mod sealed { |
| 515 | use embassy::waitqueue::AtomicWaker; | 515 | use embassy_util::waitqueue::AtomicWaker; |
| 516 | 516 | ||
| 517 | use super::*; | 517 | use super::*; |
| 518 | 518 | ||
diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs index 9bebd6fa3..7aad561b6 100644 --- a/embassy-nrf/src/rng.rs +++ b/embassy-nrf/src/rng.rs | |||
| @@ -2,9 +2,9 @@ use core::ptr; | |||
| 2 | use core::sync::atomic::{AtomicPtr, Ordering}; | 2 | use core::sync::atomic::{AtomicPtr, Ordering}; |
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_hal_common::drop::OnDrop; | 5 | use embassy_hal_common::drop::OnDrop; |
| 7 | use embassy_hal_common::{into_ref, PeripheralRef}; | 6 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 7 | use embassy_util::waitqueue::AtomicWaker; | ||
| 8 | use futures::future::poll_fn; | 8 | use futures::future::poll_fn; |
| 9 | 9 | ||
| 10 | use crate::interrupt::InterruptExt; | 10 | use crate::interrupt::InterruptExt; |
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 6ddc70e52..f2ef46d8d 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | use core::sync::atomic::{compiler_fence, Ordering}; | 3 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | ||
| 7 | use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; | 6 | use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; |
| 7 | use embassy_util::waitqueue::AtomicWaker; | ||
| 8 | use futures::future::poll_fn; | 8 | use futures::future::poll_fn; |
| 9 | use pac::{saadc, SAADC}; | 9 | use pac::{saadc, SAADC}; |
| 10 | use saadc::ch::config::{GAIN_A, REFSEL_A, RESP_A, TACQ_A}; | 10 | use saadc::ch::config::{GAIN_A, REFSEL_A, RESP_A, TACQ_A}; |
diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index a512b4813..57c0c14c7 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs | |||
| @@ -363,7 +363,7 @@ impl<'d, T: Instance> Drop for Spim<'d, T> { | |||
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | pub(crate) mod sealed { | 365 | pub(crate) mod sealed { |
| 366 | use embassy::waitqueue::AtomicWaker; | 366 | use embassy_util::waitqueue::AtomicWaker; |
| 367 | 367 | ||
| 368 | use super::*; | 368 | use super::*; |
| 369 | 369 | ||
diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs index a3b25ce05..1491e4268 100644 --- a/embassy-nrf/src/temp.rs +++ b/embassy-nrf/src/temp.rs | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_hal_common::drop::OnDrop; | 5 | use embassy_hal_common::drop::OnDrop; |
| 7 | use embassy_hal_common::{into_ref, PeripheralRef}; | 6 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 7 | use embassy_util::waitqueue::AtomicWaker; | ||
| 8 | use fixed::types::I30F2; | 8 | use fixed::types::I30F2; |
| 9 | use futures::future::poll_fn; | 9 | use futures::future::poll_fn; |
| 10 | 10 | ||
diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs index f7b3345b2..05fa0aea8 100644 --- a/embassy-nrf/src/time_driver.rs +++ b/embassy-nrf/src/time_driver.rs | |||
| @@ -3,9 +3,9 @@ use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering}; | |||
| 3 | use core::{mem, ptr}; | 3 | use core::{mem, ptr}; |
| 4 | 4 | ||
| 5 | use critical_section::CriticalSection; | 5 | use critical_section::CriticalSection; |
| 6 | use embassy::blocking_mutex::raw::CriticalSectionRawMutex; | 6 | use embassy_executor::time::driver::{AlarmHandle, Driver}; |
| 7 | use embassy::blocking_mutex::CriticalSectionMutex as Mutex; | 7 | use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; |
| 8 | use embassy::time::driver::{AlarmHandle, Driver}; | 8 | use embassy_util::blocking_mutex::CriticalSectionMutex as Mutex; |
| 9 | 9 | ||
| 10 | use crate::interrupt::{Interrupt, InterruptExt}; | 10 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 11 | use crate::{interrupt, pac}; | 11 | use crate::{interrupt, pac}; |
| @@ -119,7 +119,7 @@ struct RtcDriver { | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | const ALARM_STATE_NEW: AlarmState = AlarmState::new(); | 121 | const ALARM_STATE_NEW: AlarmState = AlarmState::new(); |
| 122 | embassy::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { | 122 | embassy_executor::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { |
| 123 | period: AtomicU32::new(0), | 123 | period: AtomicU32::new(0), |
| 124 | alarm_count: AtomicU8::new(0), | 124 | alarm_count: AtomicU8::new(0), |
| 125 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), | 125 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), |
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index 8deecdc03..b3b613db2 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | use core::marker::PhantomData; | 3 | use core::marker::PhantomData; |
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | ||
| 7 | use embassy_hal_common::drop::OnDrop; | 6 | use embassy_hal_common::drop::OnDrop; |
| 8 | use embassy_hal_common::{into_ref, PeripheralRef}; | 7 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 8 | use embassy_util::waitqueue::AtomicWaker; | ||
| 9 | use futures::future::poll_fn; | 9 | use futures::future::poll_fn; |
| 10 | 10 | ||
| 11 | use crate::interrupt::{Interrupt, InterruptExt}; | 11 | use crate::interrupt::{Interrupt, InterruptExt}; |
| @@ -40,8 +40,8 @@ macro_rules! impl_timer { | |||
| 40 | fn regs() -> &'static pac::timer0::RegisterBlock { | 40 | fn regs() -> &'static pac::timer0::RegisterBlock { |
| 41 | unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } | 41 | unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } |
| 42 | } | 42 | } |
| 43 | fn waker(n: usize) -> &'static ::embassy::waitqueue::AtomicWaker { | 43 | fn waker(n: usize) -> &'static ::embassy_util::waitqueue::AtomicWaker { |
| 44 | use ::embassy::waitqueue::AtomicWaker; | 44 | use ::embassy_util::waitqueue::AtomicWaker; |
| 45 | const NEW_AW: AtomicWaker = AtomicWaker::new(); | 45 | const NEW_AW: AtomicWaker = AtomicWaker::new(); |
| 46 | static WAKERS: [AtomicWaker; $ccs] = [NEW_AW; $ccs]; | 46 | static WAKERS: [AtomicWaker; $ccs] = [NEW_AW; $ccs]; |
| 47 | &WAKERS[n] | 47 | &WAKERS[n] |
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 6d6eb84e7..494abe0cc 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs | |||
| @@ -11,11 +11,11 @@ use core::sync::atomic::compiler_fence; | |||
| 11 | use core::sync::atomic::Ordering::SeqCst; | 11 | use core::sync::atomic::Ordering::SeqCst; |
| 12 | use core::task::Poll; | 12 | use core::task::Poll; |
| 13 | 13 | ||
| 14 | #[cfg(feature = "time")] | ||
| 15 | use embassy::time::{Duration, Instant}; | ||
| 16 | use embassy::waitqueue::AtomicWaker; | ||
| 17 | use embassy_embedded_hal::SetConfig; | 14 | use embassy_embedded_hal::SetConfig; |
| 15 | #[cfg(feature = "time")] | ||
| 16 | use embassy_executor::time::{Duration, Instant}; | ||
| 18 | use embassy_hal_common::{into_ref, PeripheralRef}; | 17 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 18 | use embassy_util::waitqueue::AtomicWaker; | ||
| 19 | use futures::future::poll_fn; | 19 | use futures::future::poll_fn; |
| 20 | 20 | ||
| 21 | use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; | 21 | use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; |
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 792b8ecca..0d24cf65f 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs | |||
| @@ -932,7 +932,7 @@ impl<'d, U: Instance, T: TimerInstance> UarteRxWithIdle<'d, U, T> { | |||
| 932 | pub(crate) mod sealed { | 932 | pub(crate) mod sealed { |
| 933 | use core::sync::atomic::AtomicU8; | 933 | use core::sync::atomic::AtomicU8; |
| 934 | 934 | ||
| 935 | use embassy::waitqueue::AtomicWaker; | 935 | use embassy_util::waitqueue::AtomicWaker; |
| 936 | 936 | ||
| 937 | use super::*; | 937 | use super::*; |
| 938 | 938 | ||
diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index 378492859..ee99a9a6a 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs | |||
| @@ -6,11 +6,11 @@ use core::sync::atomic::{compiler_fence, AtomicBool, AtomicU32, Ordering}; | |||
| 6 | use core::task::Poll; | 6 | use core::task::Poll; |
| 7 | 7 | ||
| 8 | use cortex_m::peripheral::NVIC; | 8 | use cortex_m::peripheral::NVIC; |
| 9 | use embassy::waitqueue::AtomicWaker; | ||
| 10 | use embassy_hal_common::{into_ref, PeripheralRef}; | 9 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 11 | pub use embassy_usb; | 10 | pub use embassy_usb; |
| 12 | use embassy_usb::driver::{self, EndpointError, Event, Unsupported}; | 11 | use embassy_usb::driver::{self, EndpointError, Event, Unsupported}; |
| 13 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; | 12 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; |
| 13 | use embassy_util::waitqueue::AtomicWaker; | ||
| 14 | use futures::future::poll_fn; | 14 | use futures::future::poll_fn; |
| 15 | use futures::Future; | 15 | use futures::Future; |
| 16 | use pac::usbd::RegisterBlock; | 16 | use pac::usbd::RegisterBlock; |
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index 6529e1a37..303617ffc 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -20,14 +20,15 @@ flavors = [ | |||
| 20 | unstable-pac = [] | 20 | unstable-pac = [] |
| 21 | 21 | ||
| 22 | # Enable nightly-only features | 22 | # Enable nightly-only features |
| 23 | nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly"] | 23 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly"] |
| 24 | 24 | ||
| 25 | # Implement embedded-hal 1.0 alpha traits. | 25 | # Implement embedded-hal 1.0 alpha traits. |
| 26 | # Implement embedded-hal-async traits if `nightly` is set as well. | 26 | # Implement embedded-hal-async traits if `nightly` is set as well. |
| 27 | unstable-traits = ["embedded-hal-1"] | 27 | unstable-traits = ["embedded-hal-1"] |
| 28 | 28 | ||
| 29 | [dependencies] | 29 | [dependencies] |
| 30 | embassy = { version = "0.1.0", path = "../embassy", features = [ "time-tick-1mhz" ] } | 30 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 31 | embassy-executor = { version = "0.1.0", path = "../embassy-executor", features = [ "time-tick-1mhz" ] } | ||
| 31 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} | 32 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} |
| 32 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } | 33 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } |
| 33 | embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } | 34 | embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 5db1a690b..9779f1378 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -3,9 +3,9 @@ use core::future::Future; | |||
| 3 | use core::pin::Pin as FuturePin; | 3 | use core::pin::Pin as FuturePin; |
| 4 | use core::task::{Context, Poll}; | 4 | use core::task::{Context, Poll}; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | ||
| 7 | use embassy_cortex_m::interrupt::{Interrupt, InterruptExt}; | 6 | use embassy_cortex_m::interrupt::{Interrupt, InterruptExt}; |
| 8 | use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; | 7 | use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; |
| 8 | use embassy_util::waitqueue::AtomicWaker; | ||
| 9 | 9 | ||
| 10 | use crate::pac::common::{Reg, RW}; | 10 | use crate::pac::common::{Reg, RW}; |
| 11 | use crate::pac::SIO; | 11 | use crate::pac::SIO; |
diff --git a/embassy-rp/src/timer.rs b/embassy-rp/src/timer.rs index 6c4c258b1..142fd410d 100644 --- a/embassy-rp/src/timer.rs +++ b/embassy-rp/src/timer.rs | |||
| @@ -2,9 +2,9 @@ use core::cell::Cell; | |||
| 2 | 2 | ||
| 3 | use atomic_polyfill::{AtomicU8, Ordering}; | 3 | use atomic_polyfill::{AtomicU8, Ordering}; |
| 4 | use critical_section::CriticalSection; | 4 | use critical_section::CriticalSection; |
| 5 | use embassy::blocking_mutex::raw::CriticalSectionRawMutex; | 5 | use embassy_executor::time::driver::{AlarmHandle, Driver}; |
| 6 | use embassy::blocking_mutex::Mutex; | 6 | use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; |
| 7 | use embassy::time::driver::{AlarmHandle, Driver}; | 7 | use embassy_util::blocking_mutex::Mutex; |
| 8 | 8 | ||
| 9 | use crate::interrupt::{Interrupt, InterruptExt}; | 9 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 10 | use crate::{interrupt, pac}; | 10 | use crate::{interrupt, pac}; |
| @@ -26,7 +26,7 @@ struct TimerDriver { | |||
| 26 | next_alarm: AtomicU8, | 26 | next_alarm: AtomicU8, |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | embassy::time_driver_impl!(static DRIVER: TimerDriver = TimerDriver{ | 29 | embassy_executor::time_driver_impl!(static DRIVER: TimerDriver = TimerDriver{ |
| 30 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [DUMMY_ALARM; ALARM_COUNT]), | 30 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [DUMMY_ALARM; ALARM_COUNT]), |
| 31 | next_alarm: AtomicU8::new(0), | 31 | next_alarm: AtomicU8::new(0), |
| 32 | }); | 32 | }); |
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index e9c3fdf45..ff228cc85 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -10,7 +10,7 @@ src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-stm32 | |||
| 10 | # TODO: sdmmc | 10 | # TODO: sdmmc |
| 11 | # TODO: net | 11 | # TODO: net |
| 12 | # TODO: subghz | 12 | # TODO: subghz |
| 13 | features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "exti", "time-driver-any", "embassy/time-tick-32768hz"] | 13 | features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "exti", "time-driver-any", "embassy-executor/time-tick-32768hz"] |
| 14 | flavors = [ | 14 | flavors = [ |
| 15 | { regex_feature = "stm32f0.*", target = "thumbv6m-none-eabi" }, | 15 | { regex_feature = "stm32f0.*", target = "thumbv6m-none-eabi" }, |
| 16 | { regex_feature = "stm32f1.*", target = "thumbv7m-none-eabi" }, | 16 | { regex_feature = "stm32f1.*", target = "thumbv7m-none-eabi" }, |
| @@ -31,7 +31,8 @@ flavors = [ | |||
| 31 | ] | 31 | ] |
| 32 | 32 | ||
| 33 | [dependencies] | 33 | [dependencies] |
| 34 | embassy = { version = "0.1.0", path = "../embassy" } | 34 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 35 | embassy-executor = { version = "0.1.0", path = "../embassy-executor" } | ||
| 35 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-4"]} | 36 | embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-4"]} |
| 36 | embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["stm32"] } | 37 | embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["stm32"] } |
| 37 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } | 38 | embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } |
| @@ -72,7 +73,7 @@ quote = "1.0.15" | |||
| 72 | stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]} | 73 | stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]} |
| 73 | 74 | ||
| 74 | [features] | 75 | [features] |
| 75 | defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy/defmt", "embassy-embedded-hal/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"] | 76 | defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-util/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"] |
| 76 | sdmmc-rs = ["embedded-sdmmc"] | 77 | sdmmc-rs = ["embedded-sdmmc"] |
| 77 | net = ["embassy-net" ] | 78 | net = ["embassy-net" ] |
| 78 | memory-x = ["stm32-metapac/memory-x"] | 79 | memory-x = ["stm32-metapac/memory-x"] |
| @@ -81,7 +82,7 @@ exti = [] | |||
| 81 | 82 | ||
| 82 | # Features starting with `_` are for internal use only. They're not intended | 83 | # Features starting with `_` are for internal use only. They're not intended |
| 83 | # to be enabled by other crates, and are not covered by semver guarantees. | 84 | # to be enabled by other crates, and are not covered by semver guarantees. |
| 84 | _time-driver = ["embassy/time"] | 85 | _time-driver = ["embassy-executor/time"] |
| 85 | time-driver-any = ["_time-driver"] | 86 | time-driver-any = ["_time-driver"] |
| 86 | time-driver-tim2 = ["_time-driver"] | 87 | time-driver-tim2 = ["_time-driver"] |
| 87 | time-driver-tim3 = ["_time-driver"] | 88 | time-driver-tim3 = ["_time-driver"] |
| @@ -91,7 +92,7 @@ time-driver-tim12 = ["_time-driver"] | |||
| 91 | time-driver-tim15 = ["_time-driver"] | 92 | time-driver-tim15 = ["_time-driver"] |
| 92 | 93 | ||
| 93 | # Enable nightly-only features | 94 | # Enable nightly-only features |
| 94 | nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb", "embassy-embedded-hal/nightly"] | 95 | nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb", "embassy-embedded-hal/nightly"] |
| 95 | 96 | ||
| 96 | # Reexport stm32-metapac at `embassy_stm32::pac`. | 97 | # Reexport stm32-metapac at `embassy_stm32::pac`. |
| 97 | # This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version. | 98 | # This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version. |
diff --git a/embassy-stm32/src/dcmi.rs b/embassy-stm32/src/dcmi.rs index e28225426..bbb9a12cb 100644 --- a/embassy-stm32/src/dcmi.rs +++ b/embassy-stm32/src/dcmi.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use core::task::Poll; | 1 | use core::task::Poll; |
| 2 | 2 | ||
| 3 | use embassy::waitqueue::AtomicWaker; | ||
| 4 | use embassy_hal_common::{into_ref, PeripheralRef}; | 3 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 4 | use embassy_util::waitqueue::AtomicWaker; | ||
| 5 | use futures::future::poll_fn; | 5 | use futures::future::poll_fn; |
| 6 | 6 | ||
| 7 | use crate::gpio::sealed::AFType; | 7 | use crate::gpio::sealed::AFType; |
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index c87f3ac49..bd2cd5b57 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | use core::sync::atomic::{fence, Ordering}; | 3 | use core::sync::atomic::{fence, Ordering}; |
| 4 | use core::task::Waker; | 4 | use core::task::Waker; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | 6 | use embassy_util::waitqueue::AtomicWaker; |
| 7 | 7 | ||
| 8 | use super::{TransferOptions, Word, WordSize}; | 8 | use super::{TransferOptions, Word, WordSize}; |
| 9 | use crate::_generated::BDMA_CHANNEL_COUNT; | 9 | use crate::_generated::BDMA_CHANNEL_COUNT; |
diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index e8e589de8..0c66005c7 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use core::sync::atomic::{fence, Ordering}; | 1 | use core::sync::atomic::{fence, Ordering}; |
| 2 | use core::task::Waker; | 2 | use core::task::Waker; |
| 3 | 3 | ||
| 4 | use embassy::waitqueue::AtomicWaker; | 4 | use embassy_util::waitqueue::AtomicWaker; |
| 5 | 5 | ||
| 6 | use super::{Burst, FlowControl, Request, TransferOptions, Word, WordSize}; | 6 | use super::{Burst, FlowControl, Request, TransferOptions, Word, WordSize}; |
| 7 | use crate::_generated::DMA_CHANNEL_COUNT; | 7 | use crate::_generated::DMA_CHANNEL_COUNT; |
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index 8e901d725..1aea6c65d 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use core::sync::atomic::{fence, Ordering}; | 1 | use core::sync::atomic::{fence, Ordering}; |
| 2 | use core::task::Waker; | 2 | use core::task::Waker; |
| 3 | 3 | ||
| 4 | use embassy::waitqueue::AtomicWaker; | 4 | use embassy_util::waitqueue::AtomicWaker; |
| 5 | 5 | ||
| 6 | use super::{Request, TransferOptions, Word, WordSize}; | 6 | use super::{Request, TransferOptions, Word, WordSize}; |
| 7 | use crate::_generated::GPDMA_CHANNEL_COUNT; | 7 | use crate::_generated::GPDMA_CHANNEL_COUNT; |
diff --git a/embassy-stm32/src/eth/v1/mod.rs b/embassy-stm32/src/eth/v1/mod.rs index 5e31c32b5..37593914f 100644 --- a/embassy-stm32/src/eth/v1/mod.rs +++ b/embassy-stm32/src/eth/v1/mod.rs | |||
| @@ -4,10 +4,10 @@ use core::marker::PhantomData; | |||
| 4 | use core::sync::atomic::{fence, Ordering}; | 4 | use core::sync::atomic::{fence, Ordering}; |
| 5 | use core::task::Waker; | 5 | use core::task::Waker; |
| 6 | 6 | ||
| 7 | use embassy::waitqueue::AtomicWaker; | ||
| 8 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; | 7 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; |
| 9 | use embassy_hal_common::{into_ref, PeripheralRef}; | 8 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 10 | use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; | 9 | use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; |
| 10 | use embassy_util::waitqueue::AtomicWaker; | ||
| 11 | 11 | ||
| 12 | use crate::gpio::sealed::{AFType, Pin as __GpioPin}; | 12 | use crate::gpio::sealed::{AFType, Pin as __GpioPin}; |
| 13 | use crate::gpio::{AnyPin, Speed}; | 13 | use crate::gpio::{AnyPin, Speed}; |
diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs index 2b4a9367b..1bc1fb72e 100644 --- a/embassy-stm32/src/eth/v2/mod.rs +++ b/embassy-stm32/src/eth/v2/mod.rs | |||
| @@ -2,10 +2,10 @@ use core::marker::PhantomData; | |||
| 2 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 3 | use core::task::Waker; | 3 | use core::task::Waker; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; | 5 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; |
| 7 | use embassy_hal_common::{into_ref, PeripheralRef}; | 6 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 8 | use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; | 7 | use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; |
| 8 | use embassy_util::waitqueue::AtomicWaker; | ||
| 9 | 9 | ||
| 10 | use crate::gpio::sealed::{AFType, Pin as _}; | 10 | use crate::gpio::sealed::{AFType, Pin as _}; |
| 11 | use crate::gpio::{AnyPin, Speed}; | 11 | use crate::gpio::{AnyPin, Speed}; |
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index 3b8d9390f..ecb180bbe 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs | |||
| @@ -3,8 +3,8 @@ use core::marker::PhantomData; | |||
| 3 | use core::pin::Pin; | 3 | use core::pin::Pin; |
| 4 | use core::task::{Context, Poll}; | 4 | use core::task::{Context, Poll}; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | ||
| 7 | use embassy_hal_common::impl_peripheral; | 6 | use embassy_hal_common::impl_peripheral; |
| 7 | use embassy_util::waitqueue::AtomicWaker; | ||
| 8 | 8 | ||
| 9 | use crate::gpio::{AnyPin, Input, Pin as GpioPin}; | 9 | use crate::gpio::{AnyPin, Input, Pin as GpioPin}; |
| 10 | use crate::pac::exti::regs::Lines; | 10 | use crate::pac::exti::regs::Lines; |
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index dec92cc88..f8067e8b3 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs | |||
| @@ -2,10 +2,10 @@ use core::cmp; | |||
| 2 | use core::task::Poll; | 2 | use core::task::Poll; |
| 3 | 3 | ||
| 4 | use atomic_polyfill::{AtomicUsize, Ordering}; | 4 | use atomic_polyfill::{AtomicUsize, Ordering}; |
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_embedded_hal::SetConfig; | 5 | use embassy_embedded_hal::SetConfig; |
| 7 | use embassy_hal_common::drop::OnDrop; | 6 | use embassy_hal_common::drop::OnDrop; |
| 8 | use embassy_hal_common::{into_ref, PeripheralRef}; | 7 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 8 | use embassy_util::waitqueue::AtomicWaker; | ||
| 9 | use futures::future::poll_fn; | 9 | use futures::future::poll_fn; |
| 10 | 10 | ||
| 11 | use crate::dma::NoDma; | 11 | use crate::dma::NoDma; |
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 2b0ee7131..81e28f355 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use embassy::waitqueue::AtomicWaker; | ||
| 6 | use embassy_hal_common::{into_ref, PeripheralRef}; | 5 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 6 | use embassy_util::waitqueue::AtomicWaker; | ||
| 7 | use futures::future::poll_fn; | 7 | use futures::future::poll_fn; |
| 8 | use rand_core::{CryptoRng, RngCore}; | 8 | use rand_core::{CryptoRng, RngCore}; |
| 9 | 9 | ||
diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index b9dff8faf..1de4b2aa6 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | use core::default::Default; | 3 | use core::default::Default; |
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use embassy::waitqueue::AtomicWaker; | ||
| 7 | use embassy_hal_common::drop::OnDrop; | 6 | use embassy_hal_common::drop::OnDrop; |
| 8 | use embassy_hal_common::{into_ref, PeripheralRef}; | 7 | use embassy_hal_common::{into_ref, PeripheralRef}; |
| 8 | use embassy_util::waitqueue::AtomicWaker; | ||
| 9 | use futures::future::poll_fn; | 9 | use futures::future::poll_fn; |
| 10 | use sdio_host::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CID, CSD, OCR, SCR}; | 10 | use sdio_host::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CID, CSD, OCR, SCR}; |
| 11 | 11 | ||
| @@ -1507,8 +1507,8 @@ foreach_peripheral!( | |||
| 1507 | INNER | 1507 | INNER |
| 1508 | } | 1508 | } |
| 1509 | 1509 | ||
| 1510 | fn state() -> &'static ::embassy::waitqueue::AtomicWaker { | 1510 | fn state() -> &'static ::embassy_util::waitqueue::AtomicWaker { |
| 1511 | static WAKER: ::embassy::waitqueue::AtomicWaker = ::embassy::waitqueue::AtomicWaker::new(); | 1511 | static WAKER: ::embassy_util::waitqueue::AtomicWaker = ::embassy_util::waitqueue::AtomicWaker::new(); |
| 1512 | &WAKER | 1512 | &WAKER |
| 1513 | } | 1513 | } |
| 1514 | } | 1514 | } |
diff --git a/embassy-stm32/src/subghz/mod.rs b/embassy-stm32/src/subghz/mod.rs index f02fc140f..4e53efed5 100644 --- a/embassy-stm32/src/subghz/mod.rs +++ b/embassy-stm32/src/subghz/mod.rs | |||
| @@ -504,7 +504,7 @@ impl<'d> SubGhz<'d, NoDma, NoDma> { | |||
| 504 | /// | 504 | /// |
| 505 | /// sg.set_standby(StandbyClk::Rc)?; | 505 | /// sg.set_standby(StandbyClk::Rc)?; |
| 506 | /// unsafe { sg.set_sleep(SleepCfg::default())? }; | 506 | /// unsafe { sg.set_sleep(SleepCfg::default())? }; |
| 507 | /// embassy::time::Timer::after(embassy::time::Duration::from_micros(500)).await; | 507 | /// embassy_executor::time::Timer::after(embassy_executor::time::Duration::from_micros(500)).await; |
| 508 | /// unsafe { wakeup() }; | 508 | /// unsafe { wakeup() }; |
| 509 | /// # Ok::<(), embassy_stm32::subghz::Error>(()) | 509 | /// # Ok::<(), embassy_stm32::subghz::Error>(()) |
| 510 | /// ``` | 510 | /// ``` |
diff --git a/embassy-stm32/src/subghz/timeout.rs b/embassy-stm32/src/subghz/timeout.rs index 9dbdc6374..b8d6ad8f9 100644 --- a/embassy-stm32/src/subghz/timeout.rs +++ b/embassy-stm32/src/subghz/timeout.rs | |||
| @@ -439,9 +439,9 @@ impl From<Timeout> for [u8; 3] { | |||
| 439 | } | 439 | } |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | impl From<Timeout> for embassy::time::Duration { | 442 | impl From<Timeout> for embassy_executor::time::Duration { |
| 443 | fn from(to: Timeout) -> Self { | 443 | fn from(to: Timeout) -> Self { |
| 444 | embassy::time::Duration::from_micros(to.as_micros().into()) | 444 | embassy_executor::time::Duration::from_micros(to.as_micros().into()) |
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| 447 | 447 | ||
diff --git a/embassy-stm32/src/subghz/tx_params.rs b/embassy-stm32/src/subghz/tx_params.rs index 5194a8379..a72c060f3 100644 --- a/embassy-stm32/src/subghz/tx_params.rs +++ b/embassy-stm32/src/subghz/tx_params.rs | |||
| @@ -44,17 +44,17 @@ impl From<RampTime> for core::time::Duration { | |||
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | impl From<RampTime> for embassy::time::Duration { | 47 | impl From<RampTime> for embassy_executor::time::Duration { |
| 48 | fn from(rt: RampTime) -> Self { | 48 | fn from(rt: RampTime) -> Self { |
| 49 | match rt { | 49 | match rt { |
| 50 | RampTime::Micros10 => embassy::time::Duration::from_micros(10), | 50 | RampTime::Micros10 => embassy_executor::time::Duration::from_micros(10), |
| 51 | RampTime::Micros20 => embassy::time::Duration::from_micros(20), | 51 | RampTime::Micros20 => embassy_executor::time::Duration::from_micros(20), |
| 52 | RampTime::Micros40 => embassy::time::Duration::from_micros(40), | 52 | RampTime::Micros40 => embassy_executor::time::Duration::from_micros(40), |
| 53 | RampTime::Micros80 => embassy::time::Duration::from_micros(80), | 53 | RampTime::Micros80 => embassy_executor::time::Duration::from_micros(80), |
| 54 | RampTime::Micros200 => embassy::time::Duration::from_micros(200), | 54 | RampTime::Micros200 => embassy_executor::time::Duration::from_micros(200), |
| 55 | RampTime::Micros800 => embassy::time::Duration::from_micros(800), | 55 | RampTime::Micros800 => embassy_executor::time::Duration::from_micros(800), |
| 56 | RampTime::Micros1700 => embassy::time::Duration::from_micros(1700), | 56 | RampTime::Micros1700 => embassy_executor::time::Duration::from_micros(1700), |
| 57 | RampTime::Micros3400 => embassy::time::Duration::from_micros(3400), | 57 | RampTime::Micros3400 => embassy_executor::time::Duration::from_micros(3400), |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 38a4adc1d..6cea43f18 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -4,10 +4,10 @@ use core::sync::atomic::{compiler_fence, Ordering}; | |||
| 4 | use core::{mem, ptr}; | 4 | use core::{mem, ptr}; |
| 5 | 5 | ||
| 6 | use atomic_polyfill::{AtomicU32, AtomicU8}; | 6 | use atomic_polyfill::{AtomicU32, AtomicU8}; |
| 7 | use embassy::blocking_mutex::raw::CriticalSectionRawMutex; | 7 | use embassy_executor::time::driver::{AlarmHandle, Driver}; |
| 8 | use embassy::blocking_mutex::Mutex; | 8 | use embassy_executor::time::TICKS_PER_SECOND; |
| 9 | use embassy::time::driver::{AlarmHandle, Driver}; | 9 | use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; |
| 10 | use embassy::time::TICKS_PER_SECOND; | 10 | use embassy_util::blocking_mutex::Mutex; |
| 11 | use stm32_metapac::timer::regs; | 11 | use stm32_metapac::timer::regs; |
| 12 | 12 | ||
| 13 | use crate::interrupt::{CriticalSection, InterruptExt}; | 13 | use crate::interrupt::{CriticalSection, InterruptExt}; |
| @@ -133,7 +133,7 @@ struct RtcDriver { | |||
| 133 | 133 | ||
| 134 | const ALARM_STATE_NEW: AlarmState = AlarmState::new(); | 134 | const ALARM_STATE_NEW: AlarmState = AlarmState::new(); |
| 135 | 135 | ||
| 136 | embassy::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { | 136 | embassy_executor::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { |
| 137 | period: AtomicU32::new(0), | 137 | period: AtomicU32::new(0), |
| 138 | alarm_count: AtomicU8::new(0), | 138 | alarm_count: AtomicU8::new(0), |
| 139 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), | 139 | alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), |
diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs index 4e47ef73d..0e8d0d682 100644 --- a/embassy-stm32/src/usart/buffered.rs +++ b/embassy-stm32/src/usart/buffered.rs | |||
| @@ -2,9 +2,9 @@ use core::future::Future; | |||
| 2 | use core::task::Poll; | 2 | use core::task::Poll; |
| 3 | 3 | ||
| 4 | use atomic_polyfill::{compiler_fence, Ordering}; | 4 | use atomic_polyfill::{compiler_fence, Ordering}; |
| 5 | use embassy::waitqueue::WakerRegistration; | ||
| 6 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; | 5 | use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; |
| 7 | use embassy_hal_common::ring_buffer::RingBuffer; | 6 | use embassy_hal_common::ring_buffer::RingBuffer; |
| 7 | use embassy_util::waitqueue::WakerRegistration; | ||
| 8 | use futures::future::poll_fn; | 8 | use futures::future::poll_fn; |
| 9 | 9 | ||
| 10 | use super::*; | 10 | use super::*; |
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 11ef75954..764b21461 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs | |||
| @@ -5,11 +5,11 @@ use core::sync::atomic::Ordering; | |||
| 5 | use core::task::Poll; | 5 | use core::task::Poll; |
| 6 | 6 | ||
| 7 | use atomic_polyfill::{AtomicBool, AtomicU8}; | 7 | use atomic_polyfill::{AtomicBool, AtomicU8}; |
| 8 | use embassy::time::{block_for, Duration}; | 8 | use embassy_executor::time::{block_for, Duration}; |
| 9 | use embassy::waitqueue::AtomicWaker; | ||
| 10 | use embassy_hal_common::into_ref; | 9 | use embassy_hal_common::into_ref; |
| 11 | use embassy_usb::driver::{self, EndpointAllocError, EndpointError, Event, Unsupported}; | 10 | use embassy_usb::driver::{self, EndpointAllocError, EndpointError, Event, Unsupported}; |
| 12 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; | 11 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; |
| 12 | use embassy_util::waitqueue::AtomicWaker; | ||
| 13 | use futures::future::poll_fn; | 13 | use futures::future::poll_fn; |
| 14 | use futures::Future; | 14 | use futures::Future; |
| 15 | use pac::common::{Reg, RW}; | 15 | use pac::common::{Reg, RW}; |
diff --git a/embassy-usb-hid/Cargo.toml b/embassy-usb-hid/Cargo.toml index b8185fa5a..53b6db3da 100644 --- a/embassy-usb-hid/Cargo.toml +++ b/embassy-usb-hid/Cargo.toml | |||
| @@ -6,7 +6,7 @@ edition = "2021" | |||
| 6 | [package.metadata.embassy_docs] | 6 | [package.metadata.embassy_docs] |
| 7 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-hid-v$VERSION/embassy-usb-hid/src/" | 7 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-hid-v$VERSION/embassy-usb-hid/src/" |
| 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-hid/src/" | 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-hid/src/" |
| 9 | features = ["defmt", "embassy/time-tick-1mhz"] | 9 | features = ["defmt", "embassy-executor/time-tick-1mhz"] |
| 10 | flavors = [ | 10 | flavors = [ |
| 11 | { name = "default", target = "thumbv7em-none-eabihf" }, | 11 | { name = "default", target = "thumbv7em-none-eabihf" }, |
| 12 | ] | 12 | ] |
| @@ -16,7 +16,7 @@ default = ["usbd-hid"] | |||
| 16 | usbd-hid = ["dep:usbd-hid", "ssmarshal"] | 16 | usbd-hid = ["dep:usbd-hid", "ssmarshal"] |
| 17 | 17 | ||
| 18 | [dependencies] | 18 | [dependencies] |
| 19 | embassy = { version = "0.1.0", path = "../embassy" } | 19 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 20 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } | 20 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } |
| 21 | 21 | ||
| 22 | defmt = { version = "0.3", optional = true } | 22 | defmt = { version = "0.3", optional = true } |
diff --git a/embassy-usb-hid/src/lib.rs b/embassy-usb-hid/src/lib.rs index b87f57481..5fee60bbc 100644 --- a/embassy-usb-hid/src/lib.rs +++ b/embassy-usb-hid/src/lib.rs | |||
| @@ -11,7 +11,6 @@ use core::mem::MaybeUninit; | |||
| 11 | use core::ops::Range; | 11 | use core::ops::Range; |
| 12 | use core::sync::atomic::{AtomicUsize, Ordering}; | 12 | use core::sync::atomic::{AtomicUsize, Ordering}; |
| 13 | 13 | ||
| 14 | use embassy::time::Duration; | ||
| 15 | use embassy_usb::control::{ControlHandler, InResponse, OutResponse, Request, RequestType}; | 14 | use embassy_usb::control::{ControlHandler, InResponse, OutResponse, Request, RequestType}; |
| 16 | use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; | 15 | use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; |
| 17 | use embassy_usb::Builder; | 16 | use embassy_usb::Builder; |
| @@ -373,7 +372,7 @@ pub trait RequestHandler { | |||
| 373 | /// If `id` is `None`, get the idle rate for all reports. Returning `None` | 372 | /// If `id` is `None`, get the idle rate for all reports. Returning `None` |
| 374 | /// will reject the control request. Any duration at or above 1.024 seconds | 373 | /// will reject the control request. Any duration at or above 1.024 seconds |
| 375 | /// or below 4ms will be returned as an indefinite idle rate. | 374 | /// or below 4ms will be returned as an indefinite idle rate. |
| 376 | fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { | 375 | fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> { |
| 377 | let _ = id; | 376 | let _ = id; |
| 378 | None | 377 | None |
| 379 | } | 378 | } |
| @@ -381,9 +380,9 @@ pub trait RequestHandler { | |||
| 381 | /// Set the idle rate for `id` to `dur`. | 380 | /// Set the idle rate for `id` to `dur`. |
| 382 | /// | 381 | /// |
| 383 | /// If `id` is `None`, set the idle rate of all input reports to `dur`. If | 382 | /// If `id` is `None`, set the idle rate of all input reports to `dur`. If |
| 384 | /// an indefinite duration is requested, `dur` will be set to `Duration::MAX`. | 383 | /// an indefinite duration is requested, `dur` will be set to `u32::MAX`. |
| 385 | fn set_idle(&self, id: Option<ReportId>, dur: Duration) { | 384 | fn set_idle_ms(&self, id: Option<ReportId>, duration_ms: u32) { |
| 386 | let _ = (id, dur); | 385 | let _ = (id, duration_ms); |
| 387 | } | 386 | } |
| 388 | } | 387 | } |
| 389 | 388 | ||
| @@ -447,13 +446,9 @@ impl<'d> ControlHandler for Control<'d> { | |||
| 447 | if let Some(handler) = self.request_handler { | 446 | if let Some(handler) = self.request_handler { |
| 448 | let id = req.value as u8; | 447 | let id = req.value as u8; |
| 449 | let id = (id != 0).then(|| ReportId::In(id)); | 448 | let id = (id != 0).then(|| ReportId::In(id)); |
| 450 | let dur = u64::from(req.value >> 8); | 449 | let dur = u32::from(req.value >> 8); |
| 451 | let dur = if dur == 0 { | 450 | let dur = if dur == 0 { u32::MAX } else { 4 * dur }; |
| 452 | Duration::MAX | 451 | handler.set_idle_ms(id, dur); |
| 453 | } else { | ||
| 454 | Duration::from_millis(4 * dur) | ||
| 455 | }; | ||
| 456 | handler.set_idle(id, dur); | ||
| 457 | } | 452 | } |
| 458 | OutResponse::Accepted | 453 | OutResponse::Accepted |
| 459 | } | 454 | } |
| @@ -495,8 +490,8 @@ impl<'d> ControlHandler for Control<'d> { | |||
| 495 | if let Some(handler) = self.request_handler { | 490 | if let Some(handler) = self.request_handler { |
| 496 | let id = req.value as u8; | 491 | let id = req.value as u8; |
| 497 | let id = (id != 0).then(|| ReportId::In(id)); | 492 | let id = (id != 0).then(|| ReportId::In(id)); |
| 498 | if let Some(dur) = handler.get_idle(id) { | 493 | if let Some(dur) = handler.get_idle_ms(id) { |
| 499 | let dur = u8::try_from(dur.as_millis() / 4).unwrap_or(0); | 494 | let dur = u8::try_from(dur / 4).unwrap_or(0); |
| 500 | buf[0] = dur; | 495 | buf[0] = dur; |
| 501 | InResponse::Accepted(&buf[0..1]) | 496 | InResponse::Accepted(&buf[0..1]) |
| 502 | } else { | 497 | } else { |
diff --git a/embassy-usb-ncm/Cargo.toml b/embassy-usb-ncm/Cargo.toml index 636a81c2c..fa6fa0176 100644 --- a/embassy-usb-ncm/Cargo.toml +++ b/embassy-usb-ncm/Cargo.toml | |||
| @@ -12,7 +12,7 @@ flavors = [ | |||
| 12 | ] | 12 | ] |
| 13 | 13 | ||
| 14 | [dependencies] | 14 | [dependencies] |
| 15 | embassy = { version = "0.1.0", path = "../embassy" } | 15 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 16 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } | 16 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } |
| 17 | 17 | ||
| 18 | defmt = { version = "0.3", optional = true } | 18 | defmt = { version = "0.3", optional = true } |
diff --git a/embassy-usb-serial/Cargo.toml b/embassy-usb-serial/Cargo.toml index 682707afe..495dd9fea 100644 --- a/embassy-usb-serial/Cargo.toml +++ b/embassy-usb-serial/Cargo.toml | |||
| @@ -12,7 +12,7 @@ flavors = [ | |||
| 12 | ] | 12 | ] |
| 13 | 13 | ||
| 14 | [dependencies] | 14 | [dependencies] |
| 15 | embassy = { version = "0.1.0", path = "../embassy" } | 15 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 16 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } | 16 | embassy-usb = { version = "0.1.0", path = "../embassy-usb" } |
| 17 | 17 | ||
| 18 | defmt = { version = "0.3", optional = true } | 18 | defmt = { version = "0.3", optional = true } |
diff --git a/embassy-usb-serial/src/lib.rs b/embassy-usb-serial/src/lib.rs index a23d62e65..e561be9df 100644 --- a/embassy-usb-serial/src/lib.rs +++ b/embassy-usb-serial/src/lib.rs | |||
| @@ -9,11 +9,11 @@ use core::cell::Cell; | |||
| 9 | use core::mem::{self, MaybeUninit}; | 9 | use core::mem::{self, MaybeUninit}; |
| 10 | use core::sync::atomic::{AtomicBool, Ordering}; | 10 | use core::sync::atomic::{AtomicBool, Ordering}; |
| 11 | 11 | ||
| 12 | use embassy::blocking_mutex::CriticalSectionMutex; | ||
| 13 | use embassy_usb::control::{self, ControlHandler, InResponse, OutResponse, Request}; | 12 | use embassy_usb::control::{self, ControlHandler, InResponse, OutResponse, Request}; |
| 14 | use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; | 13 | use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; |
| 15 | use embassy_usb::types::*; | 14 | use embassy_usb::types::*; |
| 16 | use embassy_usb::Builder; | 15 | use embassy_usb::Builder; |
| 16 | use embassy_util::blocking_mutex::CriticalSectionMutex; | ||
| 17 | 17 | ||
| 18 | /// This should be used as `device_class` when building the `UsbDevice`. | 18 | /// This should be used as `device_class` when building the `UsbDevice`. |
| 19 | pub const USB_CLASS_CDC: u8 = 0x02; | 19 | pub const USB_CLASS_CDC: u8 = 0x02; |
diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml index 513dc8c1f..98734e98f 100644 --- a/embassy-usb/Cargo.toml +++ b/embassy-usb/Cargo.toml | |||
| @@ -12,7 +12,7 @@ flavors = [ | |||
| 12 | ] | 12 | ] |
| 13 | 13 | ||
| 14 | [dependencies] | 14 | [dependencies] |
| 15 | embassy = { version = "0.1.0", path = "../embassy" } | 15 | embassy-util = { version = "0.1.0", path = "../embassy-util" } |
| 16 | 16 | ||
| 17 | defmt = { version = "0.3", optional = true } | 17 | defmt = { version = "0.3", optional = true } |
| 18 | log = { version = "0.4.14", optional = true } | 18 | log = { version = "0.4.14", optional = true } |
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index 82ff4e32f..3f6e13472 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs | |||
| @@ -12,7 +12,7 @@ mod descriptor_reader; | |||
| 12 | pub mod driver; | 12 | pub mod driver; |
| 13 | pub mod types; | 13 | pub mod types; |
| 14 | 14 | ||
| 15 | use embassy::util::{select, Either}; | 15 | use embassy_util::{select, Either}; |
| 16 | use heapless::Vec; | 16 | use heapless::Vec; |
| 17 | 17 | ||
| 18 | pub use self::builder::{Builder, Config}; | 18 | pub use self::builder::{Builder, Config}; |
diff --git a/embassy-util/Cargo.toml b/embassy-util/Cargo.toml new file mode 100644 index 000000000..32b796c0a --- /dev/null +++ b/embassy-util/Cargo.toml | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | [package] | ||
| 2 | name = "embassy-util" | ||
| 3 | version = "0.1.0" | ||
| 4 | edition = "2021" | ||
| 5 | |||
| 6 | [package.metadata.embassy_docs] | ||
| 7 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-util-v$VERSION/embassy-util/src/" | ||
| 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-util/src/" | ||
| 9 | features = ["nightly", "defmt", "unstable-traits", "time", "time-tick-1mhz"] | ||
| 10 | flavors = [ | ||
| 11 | { name = "default", target = "x86_64-unknown-linux-gnu" }, | ||
| 12 | ] | ||
| 13 | |||
| 14 | [dependencies] | ||
| 15 | defmt = { version = "0.3", optional = true } | ||
| 16 | log = { version = "0.4.14", optional = true } | ||
| 17 | |||
| 18 | futures-util = { version = "0.3.17", default-features = false } | ||
| 19 | atomic-polyfill = "0.1.5" | ||
| 20 | critical-section = "0.2.5" | ||
| 21 | heapless = "0.7.5" | ||
| 22 | cfg-if = "1.0.0" | ||
| 23 | |||
| 24 | [dev-dependencies] | ||
| 25 | futures-executor = { version = "0.3.17", features = [ "thread-pool" ] } | ||
| 26 | futures-test = "0.3.17" | ||
| 27 | futures-timer = "3.0.2" | ||
| 28 | futures-util = { version = "0.3.17", features = [ "channel" ] } | ||
diff --git a/embassy-util/build.rs b/embassy-util/build.rs new file mode 100644 index 000000000..6fe82b44f --- /dev/null +++ b/embassy-util/build.rs | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | use std::env; | ||
| 2 | |||
| 3 | fn main() { | ||
| 4 | let target = env::var("TARGET").unwrap(); | ||
| 5 | |||
| 6 | if target.starts_with("thumbv6m-") { | ||
| 7 | println!("cargo:rustc-cfg=cortex_m"); | ||
| 8 | println!("cargo:rustc-cfg=armv6m"); | ||
| 9 | } else if target.starts_with("thumbv7m-") { | ||
| 10 | println!("cargo:rustc-cfg=cortex_m"); | ||
| 11 | println!("cargo:rustc-cfg=armv7m"); | ||
| 12 | } else if target.starts_with("thumbv7em-") { | ||
| 13 | println!("cargo:rustc-cfg=cortex_m"); | ||
| 14 | println!("cargo:rustc-cfg=armv7m"); | ||
| 15 | println!("cargo:rustc-cfg=armv7em"); // (not currently used) | ||
| 16 | } else if target.starts_with("thumbv8m.base") { | ||
| 17 | println!("cargo:rustc-cfg=cortex_m"); | ||
| 18 | println!("cargo:rustc-cfg=armv8m"); | ||
| 19 | println!("cargo:rustc-cfg=armv8m_base"); | ||
| 20 | } else if target.starts_with("thumbv8m.main") { | ||
| 21 | println!("cargo:rustc-cfg=cortex_m"); | ||
| 22 | println!("cargo:rustc-cfg=armv8m"); | ||
| 23 | println!("cargo:rustc-cfg=armv8m_main"); | ||
| 24 | } | ||
| 25 | |||
| 26 | if target.ends_with("-eabihf") { | ||
| 27 | println!("cargo:rustc-cfg=has_fpu"); | ||
| 28 | } | ||
| 29 | } | ||
diff --git a/embassy/src/blocking_mutex/mod.rs b/embassy-util/src/blocking_mutex/mod.rs index c9db89f01..8a4a4c642 100644 --- a/embassy/src/blocking_mutex/mod.rs +++ b/embassy-util/src/blocking_mutex/mod.rs | |||
| @@ -34,7 +34,6 @@ unsafe impl<R: RawMutex + Sync, T: ?Sized + Send> Sync for Mutex<R, T> {} | |||
| 34 | 34 | ||
| 35 | impl<R: RawMutex, T> Mutex<R, T> { | 35 | impl<R: RawMutex, T> Mutex<R, T> { |
| 36 | /// Creates a new mutex in an unlocked state ready for use. | 36 | /// Creates a new mutex in an unlocked state ready for use. |
| 37 | #[cfg(feature = "nightly")] | ||
| 38 | #[inline] | 37 | #[inline] |
| 39 | pub const fn new(val: T) -> Mutex<R, T> { | 38 | pub const fn new(val: T) -> Mutex<R, T> { |
| 40 | Mutex { | 39 | Mutex { |
| @@ -43,16 +42,6 @@ impl<R: RawMutex, T> Mutex<R, T> { | |||
| 43 | } | 42 | } |
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | /// Creates a new mutex in an unlocked state ready for use. | ||
| 47 | #[cfg(not(feature = "nightly"))] | ||
| 48 | #[inline] | ||
| 49 | pub fn new(val: T) -> Mutex<R, T> { | ||
| 50 | Mutex { | ||
| 51 | raw: R::INIT, | ||
| 52 | data: UnsafeCell::new(val), | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | /// Creates a critical section and grants temporary access to the protected data. | 45 | /// Creates a critical section and grants temporary access to the protected data. |
| 57 | pub fn lock<U>(&self, f: impl FnOnce(&T) -> U) -> U { | 46 | pub fn lock<U>(&self, f: impl FnOnce(&T) -> U) -> U { |
| 58 | self.raw.lock(|| { | 47 | self.raw.lock(|| { |
diff --git a/embassy/src/blocking_mutex/raw.rs b/embassy-util/src/blocking_mutex/raw.rs index 669a23e31..15796f1b2 100644 --- a/embassy/src/blocking_mutex/raw.rs +++ b/embassy-util/src/blocking_mutex/raw.rs | |||
| @@ -141,7 +141,8 @@ mod thread_mode { | |||
| 141 | return Some("main") == std::thread::current().name(); | 141 | return Some("main") == std::thread::current().name(); |
| 142 | 142 | ||
| 143 | #[cfg(not(feature = "std"))] | 143 | #[cfg(not(feature = "std"))] |
| 144 | return cortex_m::peripheral::SCB::vect_active() == cortex_m::peripheral::scb::VectActive::ThreadMode; | 144 | // ICSR.VECTACTIVE == 0 |
| 145 | return unsafe { (0xE000ED04 as *const u32).read_volatile() } & 0x1FF == 0; | ||
| 145 | } | 146 | } |
| 146 | } | 147 | } |
| 147 | #[cfg(any(cortex_m, feature = "std"))] | 148 | #[cfg(any(cortex_m, feature = "std"))] |
diff --git a/embassy/src/channel/mod.rs b/embassy-util/src/channel/mod.rs index 5df1f5c5c..5df1f5c5c 100644 --- a/embassy/src/channel/mod.rs +++ b/embassy-util/src/channel/mod.rs | |||
diff --git a/embassy/src/channel/mpmc.rs b/embassy-util/src/channel/mpmc.rs index ca2214bb5..535f77e6f 100644 --- a/embassy/src/channel/mpmc.rs +++ b/embassy-util/src/channel/mpmc.rs | |||
| @@ -19,10 +19,10 @@ | |||
| 19 | //! | 19 | //! |
| 20 | 20 | ||
| 21 | use core::cell::RefCell; | 21 | use core::cell::RefCell; |
| 22 | use core::future::Future; | ||
| 22 | use core::pin::Pin; | 23 | use core::pin::Pin; |
| 23 | use core::task::{Context, Poll}; | 24 | use core::task::{Context, Poll}; |
| 24 | 25 | ||
| 25 | use futures::Future; | ||
| 26 | use heapless::Deque; | 26 | use heapless::Deque; |
| 27 | 27 | ||
| 28 | use crate::blocking_mutex::raw::RawMutex; | 28 | use crate::blocking_mutex::raw::RawMutex; |
| @@ -373,35 +373,18 @@ where | |||
| 373 | /// Establish a new bounded channel. For example, to create one with a NoopMutex: | 373 | /// Establish a new bounded channel. For example, to create one with a NoopMutex: |
| 374 | /// | 374 | /// |
| 375 | /// ``` | 375 | /// ``` |
| 376 | /// use embassy::channel::mpmc::Channel; | 376 | /// use embassy_util::channel::mpmc::Channel; |
| 377 | /// use embassy::blocking_mutex::raw::NoopRawMutex; | 377 | /// use embassy_util::blocking_mutex::raw::NoopRawMutex; |
| 378 | /// | 378 | /// |
| 379 | /// // Declare a bounded channel of 3 u32s. | 379 | /// // Declare a bounded channel of 3 u32s. |
| 380 | /// let mut channel = Channel::<NoopRawMutex, u32, 3>::new(); | 380 | /// let mut channel = Channel::<NoopRawMutex, u32, 3>::new(); |
| 381 | /// ``` | 381 | /// ``` |
| 382 | #[cfg(feature = "nightly")] | ||
| 383 | pub const fn new() -> Self { | 382 | pub const fn new() -> Self { |
| 384 | Self { | 383 | Self { |
| 385 | inner: Mutex::new(RefCell::new(ChannelState::new())), | 384 | inner: Mutex::new(RefCell::new(ChannelState::new())), |
| 386 | } | 385 | } |
| 387 | } | 386 | } |
| 388 | 387 | ||
| 389 | /// Establish a new bounded channel. For example, to create one with a NoopMutex: | ||
| 390 | /// | ||
| 391 | /// ``` | ||
| 392 | /// use embassy::channel::mpmc::Channel; | ||
| 393 | /// use embassy::blocking_mutex::raw::NoopRawMutex; | ||
| 394 | /// | ||
| 395 | /// // Declare a bounded channel of 3 u32s. | ||
| 396 | /// let mut channel = Channel::<NoopRawMutex, u32, 3>::new(); | ||
| 397 | /// ``` | ||
| 398 | #[cfg(not(feature = "nightly"))] | ||
| 399 | pub fn new() -> Self { | ||
| 400 | Self { | ||
| 401 | inner: Mutex::new(RefCell::new(ChannelState::new())), | ||
| 402 | } | ||
| 403 | } | ||
| 404 | |||
| 405 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { | 388 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { |
| 406 | self.inner.lock(|rc| f(&mut *rc.borrow_mut())) | 389 | self.inner.lock(|rc| f(&mut *rc.borrow_mut())) |
| 407 | } | 390 | } |
| @@ -485,13 +468,13 @@ where | |||
| 485 | mod tests { | 468 | mod tests { |
| 486 | use core::time::Duration; | 469 | use core::time::Duration; |
| 487 | 470 | ||
| 488 | use futures::task::SpawnExt; | ||
| 489 | use futures_executor::ThreadPool; | 471 | use futures_executor::ThreadPool; |
| 490 | use futures_timer::Delay; | 472 | use futures_timer::Delay; |
| 473 | use futures_util::task::SpawnExt; | ||
| 491 | 474 | ||
| 492 | use super::*; | 475 | use super::*; |
| 493 | use crate::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; | 476 | use crate::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex}; |
| 494 | use crate::util::Forever; | 477 | use crate::Forever; |
| 495 | 478 | ||
| 496 | fn capacity<T, const N: usize>(c: &ChannelState<T, N>) -> usize { | 479 | fn capacity<T, const N: usize>(c: &ChannelState<T, N>) -> usize { |
| 497 | c.queue.capacity() - c.queue.len() | 480 | c.queue.capacity() - c.queue.len() |
diff --git a/embassy/src/channel/pubsub/mod.rs b/embassy-util/src/channel/pubsub/mod.rs index 64a72a52c..ecc8fbd8f 100644 --- a/embassy/src/channel/pubsub/mod.rs +++ b/embassy-util/src/channel/pubsub/mod.rs | |||
| @@ -33,9 +33,9 @@ pub use subscriber::{DynSubscriber, Subscriber}; | |||
| 33 | /// ## Example | 33 | /// ## Example |
| 34 | /// | 34 | /// |
| 35 | /// ``` | 35 | /// ``` |
| 36 | /// # use embassy::blocking_mutex::raw::NoopRawMutex; | 36 | /// # use embassy_util::blocking_mutex::raw::NoopRawMutex; |
| 37 | /// # use embassy::channel::pubsub::WaitResult; | 37 | /// # use embassy_util::channel::pubsub::WaitResult; |
| 38 | /// # use embassy::channel::pubsub::PubSubChannel; | 38 | /// # use embassy_util::channel::pubsub::PubSubChannel; |
| 39 | /// # use futures_executor::block_on; | 39 | /// # use futures_executor::block_on; |
| 40 | /// # let test = async { | 40 | /// # let test = async { |
| 41 | /// // Create the channel. This can be static as well | 41 | /// // Create the channel. This can be static as well |
diff --git a/embassy/src/channel/pubsub/publisher.rs b/embassy-util/src/channel/pubsub/publisher.rs index 53b0d43ba..705797f60 100644 --- a/embassy/src/channel/pubsub/publisher.rs +++ b/embassy-util/src/channel/pubsub/publisher.rs | |||
| @@ -1,12 +1,11 @@ | |||
| 1 | //! Implementation of anything directly publisher related | 1 | //! Implementation of anything directly publisher related |
| 2 | 2 | ||
| 3 | use core::future::Future; | ||
| 3 | use core::marker::PhantomData; | 4 | use core::marker::PhantomData; |
| 4 | use core::ops::{Deref, DerefMut}; | 5 | use core::ops::{Deref, DerefMut}; |
| 5 | use core::pin::Pin; | 6 | use core::pin::Pin; |
| 6 | use core::task::{Context, Poll}; | 7 | use core::task::{Context, Poll}; |
| 7 | 8 | ||
| 8 | use futures::Future; | ||
| 9 | |||
| 10 | use super::{PubSubBehavior, PubSubChannel}; | 9 | use super::{PubSubBehavior, PubSubChannel}; |
| 11 | use crate::blocking_mutex::raw::RawMutex; | 10 | use crate::blocking_mutex::raw::RawMutex; |
| 12 | 11 | ||
diff --git a/embassy/src/channel/pubsub/subscriber.rs b/embassy-util/src/channel/pubsub/subscriber.rs index 23c4938d9..b9a2cbe18 100644 --- a/embassy/src/channel/pubsub/subscriber.rs +++ b/embassy-util/src/channel/pubsub/subscriber.rs | |||
| @@ -1,12 +1,11 @@ | |||
| 1 | //! Implementation of anything directly subscriber related | 1 | //! Implementation of anything directly subscriber related |
| 2 | 2 | ||
| 3 | use core::future::Future; | ||
| 3 | use core::marker::PhantomData; | 4 | use core::marker::PhantomData; |
| 4 | use core::ops::{Deref, DerefMut}; | 5 | use core::ops::{Deref, DerefMut}; |
| 5 | use core::pin::Pin; | 6 | use core::pin::Pin; |
| 6 | use core::task::{Context, Poll}; | 7 | use core::task::{Context, Poll}; |
| 7 | 8 | ||
| 8 | use futures::Future; | ||
| 9 | |||
| 10 | use super::{PubSubBehavior, PubSubChannel, WaitResult}; | 9 | use super::{PubSubBehavior, PubSubChannel, WaitResult}; |
| 11 | use crate::blocking_mutex::raw::RawMutex; | 10 | use crate::blocking_mutex::raw::RawMutex; |
| 12 | 11 | ||
| @@ -77,7 +76,7 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Unpin for Sub<'a, PSB, T> {} | |||
| 77 | 76 | ||
| 78 | /// Warning: The stream implementation ignores lag results and returns all messages. | 77 | /// Warning: The stream implementation ignores lag results and returns all messages. |
| 79 | /// This might miss some messages without you knowing it. | 78 | /// This might miss some messages without you knowing it. |
| 80 | impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> futures::Stream for Sub<'a, PSB, T> { | 79 | impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> futures_util::Stream for Sub<'a, PSB, T> { |
| 81 | type Item = T; | 80 | type Item = T; |
| 82 | 81 | ||
| 83 | fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { | 82 | fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { |
diff --git a/embassy/src/channel/signal.rs b/embassy-util/src/channel/signal.rs index 3f3c482fb..a58469c4f 100644 --- a/embassy/src/channel/signal.rs +++ b/embassy-util/src/channel/signal.rs | |||
| @@ -19,7 +19,7 @@ use core::task::{Context, Poll, Waker}; | |||
| 19 | /// Signals are generally declared as `static`s and then borrowed as required. | 19 | /// Signals are generally declared as `static`s and then borrowed as required. |
| 20 | /// | 20 | /// |
| 21 | /// ``` | 21 | /// ``` |
| 22 | /// use embassy::channel::signal::Signal; | 22 | /// use embassy_util::channel::signal::Signal; |
| 23 | /// | 23 | /// |
| 24 | /// enum SomeCommand { | 24 | /// enum SomeCommand { |
| 25 | /// On, | 25 | /// On, |
| @@ -89,7 +89,7 @@ impl<T: Send> Signal<T> { | |||
| 89 | 89 | ||
| 90 | /// Future that completes when this Signal has been signaled. | 90 | /// Future that completes when this Signal has been signaled. |
| 91 | pub fn wait(&self) -> impl Future<Output = T> + '_ { | 91 | pub fn wait(&self) -> impl Future<Output = T> + '_ { |
| 92 | futures::future::poll_fn(move |cx| self.poll_wait(cx)) | 92 | futures_util::future::poll_fn(move |cx| self.poll_wait(cx)) |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /// non-blocking method to check whether this signal has been signaled. | 95 | /// non-blocking method to check whether this signal has been signaled. |
diff --git a/embassy-util/src/fmt.rs b/embassy-util/src/fmt.rs new file mode 100644 index 000000000..f8bb0a035 --- /dev/null +++ b/embassy-util/src/fmt.rs | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | #![macro_use] | ||
| 2 | #![allow(unused_macros)] | ||
| 3 | |||
| 4 | #[cfg(all(feature = "defmt", feature = "log"))] | ||
| 5 | compile_error!("You may not enable both `defmt` and `log` features."); | ||
| 6 | |||
| 7 | macro_rules! assert { | ||
| 8 | ($($x:tt)*) => { | ||
| 9 | { | ||
| 10 | #[cfg(not(feature = "defmt"))] | ||
| 11 | ::core::assert!($($x)*); | ||
| 12 | #[cfg(feature = "defmt")] | ||
| 13 | ::defmt::assert!($($x)*); | ||
| 14 | } | ||
| 15 | }; | ||
| 16 | } | ||
| 17 | |||
| 18 | macro_rules! assert_eq { | ||
| 19 | ($($x:tt)*) => { | ||
| 20 | { | ||
| 21 | #[cfg(not(feature = "defmt"))] | ||
| 22 | ::core::assert_eq!($($x)*); | ||
| 23 | #[cfg(feature = "defmt")] | ||
| 24 | ::defmt::assert_eq!($($x)*); | ||
| 25 | } | ||
| 26 | }; | ||
| 27 | } | ||
| 28 | |||
| 29 | macro_rules! assert_ne { | ||
| 30 | ($($x:tt)*) => { | ||
| 31 | { | ||
| 32 | #[cfg(not(feature = "defmt"))] | ||
| 33 | ::core::assert_ne!($($x)*); | ||
| 34 | #[cfg(feature = "defmt")] | ||
| 35 | ::defmt::assert_ne!($($x)*); | ||
| 36 | } | ||
| 37 | }; | ||
| 38 | } | ||
| 39 | |||
| 40 | macro_rules! debug_assert { | ||
| 41 | ($($x:tt)*) => { | ||
| 42 | { | ||
| 43 | #[cfg(not(feature = "defmt"))] | ||
| 44 | ::core::debug_assert!($($x)*); | ||
| 45 | #[cfg(feature = "defmt")] | ||
| 46 | ::defmt::debug_assert!($($x)*); | ||
| 47 | } | ||
| 48 | }; | ||
| 49 | } | ||
| 50 | |||
| 51 | macro_rules! debug_assert_eq { | ||
| 52 | ($($x:tt)*) => { | ||
| 53 | { | ||
| 54 | #[cfg(not(feature = "defmt"))] | ||
| 55 | ::core::debug_assert_eq!($($x)*); | ||
| 56 | #[cfg(feature = "defmt")] | ||
| 57 | ::defmt::debug_assert_eq!($($x)*); | ||
| 58 | } | ||
| 59 | }; | ||
| 60 | } | ||
| 61 | |||
| 62 | macro_rules! debug_assert_ne { | ||
| 63 | ($($x:tt)*) => { | ||
| 64 | { | ||
| 65 | #[cfg(not(feature = "defmt"))] | ||
| 66 | ::core::debug_assert_ne!($($x)*); | ||
| 67 | #[cfg(feature = "defmt")] | ||
| 68 | ::defmt::debug_assert_ne!($($x)*); | ||
| 69 | } | ||
| 70 | }; | ||
| 71 | } | ||
| 72 | |||
| 73 | macro_rules! todo { | ||
| 74 | ($($x:tt)*) => { | ||
| 75 | { | ||
| 76 | #[cfg(not(feature = "defmt"))] | ||
| 77 | ::core::todo!($($x)*); | ||
| 78 | #[cfg(feature = "defmt")] | ||
| 79 | ::defmt::todo!($($x)*); | ||
| 80 | } | ||
| 81 | }; | ||
| 82 | } | ||
| 83 | |||
| 84 | macro_rules! unreachable { | ||
| 85 | ($($x:tt)*) => { | ||
| 86 | { | ||
| 87 | #[cfg(not(feature = "defmt"))] | ||
| 88 | ::core::unreachable!($($x)*); | ||
| 89 | #[cfg(feature = "defmt")] | ||
| 90 | ::defmt::unreachable!($($x)*); | ||
| 91 | } | ||
| 92 | }; | ||
| 93 | } | ||
| 94 | |||
| 95 | macro_rules! panic { | ||
| 96 | ($($x:tt)*) => { | ||
| 97 | { | ||
| 98 | #[cfg(not(feature = "defmt"))] | ||
| 99 | ::core::panic!($($x)*); | ||
| 100 | #[cfg(feature = "defmt")] | ||
| 101 | ::defmt::panic!($($x)*); | ||
| 102 | } | ||
| 103 | }; | ||
| 104 | } | ||
| 105 | |||
| 106 | macro_rules! trace { | ||
| 107 | ($s:literal $(, $x:expr)* $(,)?) => { | ||
| 108 | { | ||
| 109 | #[cfg(feature = "log")] | ||
| 110 | ::log::trace!($s $(, $x)*); | ||
| 111 | #[cfg(feature = "defmt")] | ||
| 112 | ::defmt::trace!($s $(, $x)*); | ||
| 113 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 114 | let _ = ($( & $x ),*); | ||
| 115 | } | ||
| 116 | }; | ||
| 117 | } | ||
| 118 | |||
| 119 | macro_rules! debug { | ||
| 120 | ($s:literal $(, $x:expr)* $(,)?) => { | ||
| 121 | { | ||
| 122 | #[cfg(feature = "log")] | ||
| 123 | ::log::debug!($s $(, $x)*); | ||
| 124 | #[cfg(feature = "defmt")] | ||
| 125 | ::defmt::debug!($s $(, $x)*); | ||
| 126 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 127 | let _ = ($( & $x ),*); | ||
| 128 | } | ||
| 129 | }; | ||
| 130 | } | ||
| 131 | |||
| 132 | macro_rules! info { | ||
| 133 | ($s:literal $(, $x:expr)* $(,)?) => { | ||
| 134 | { | ||
| 135 | #[cfg(feature = "log")] | ||
| 136 | ::log::info!($s $(, $x)*); | ||
| 137 | #[cfg(feature = "defmt")] | ||
| 138 | ::defmt::info!($s $(, $x)*); | ||
| 139 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 140 | let _ = ($( & $x ),*); | ||
| 141 | } | ||
| 142 | }; | ||
| 143 | } | ||
| 144 | |||
| 145 | macro_rules! warn { | ||
| 146 | ($s:literal $(, $x:expr)* $(,)?) => { | ||
| 147 | { | ||
| 148 | #[cfg(feature = "log")] | ||
| 149 | ::log::warn!($s $(, $x)*); | ||
| 150 | #[cfg(feature = "defmt")] | ||
| 151 | ::defmt::warn!($s $(, $x)*); | ||
| 152 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 153 | let _ = ($( & $x ),*); | ||
| 154 | } | ||
| 155 | }; | ||
| 156 | } | ||
| 157 | |||
| 158 | macro_rules! error { | ||
| 159 | ($s:literal $(, $x:expr)* $(,)?) => { | ||
| 160 | { | ||
| 161 | #[cfg(feature = "log")] | ||
| 162 | ::log::error!($s $(, $x)*); | ||
| 163 | #[cfg(feature = "defmt")] | ||
| 164 | ::defmt::error!($s $(, $x)*); | ||
| 165 | #[cfg(not(any(feature = "log", feature="defmt")))] | ||
| 166 | let _ = ($( & $x ),*); | ||
| 167 | } | ||
| 168 | }; | ||
| 169 | } | ||
| 170 | |||
| 171 | #[cfg(feature = "defmt")] | ||
| 172 | macro_rules! unwrap { | ||
| 173 | ($($x:tt)*) => { | ||
| 174 | ::defmt::unwrap!($($x)*) | ||
| 175 | }; | ||
| 176 | } | ||
| 177 | |||
| 178 | #[cfg(not(feature = "defmt"))] | ||
| 179 | macro_rules! unwrap { | ||
| 180 | ($arg:expr) => { | ||
| 181 | match $crate::fmt::Try::into_result($arg) { | ||
| 182 | ::core::result::Result::Ok(t) => t, | ||
| 183 | ::core::result::Result::Err(e) => { | ||
| 184 | ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | }; | ||
| 188 | ($arg:expr, $($msg:expr),+ $(,)? ) => { | ||
| 189 | match $crate::fmt::Try::into_result($arg) { | ||
| 190 | ::core::result::Result::Ok(t) => t, | ||
| 191 | ::core::result::Result::Err(e) => { | ||
| 192 | ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e); | ||
| 193 | } | ||
| 194 | } | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | #[cfg(feature = "defmt-timestamp-uptime")] | ||
| 199 | defmt::timestamp! {"{=u64:us}", crate::time::Instant::now().as_micros() } | ||
| 200 | |||
| 201 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] | ||
| 202 | pub struct NoneError; | ||
| 203 | |||
| 204 | pub trait Try { | ||
| 205 | type Ok; | ||
| 206 | type Error; | ||
| 207 | fn into_result(self) -> Result<Self::Ok, Self::Error>; | ||
| 208 | } | ||
| 209 | |||
| 210 | impl<T> Try for Option<T> { | ||
| 211 | type Ok = T; | ||
| 212 | type Error = NoneError; | ||
| 213 | |||
| 214 | #[inline] | ||
| 215 | fn into_result(self) -> Result<T, NoneError> { | ||
| 216 | self.ok_or(NoneError) | ||
| 217 | } | ||
| 218 | } | ||
| 219 | |||
| 220 | impl<T, E> Try for Result<T, E> { | ||
| 221 | type Ok = T; | ||
| 222 | type Error = E; | ||
| 223 | |||
| 224 | #[inline] | ||
| 225 | fn into_result(self) -> Self { | ||
| 226 | self | ||
| 227 | } | ||
| 228 | } | ||
diff --git a/embassy/src/util/forever.rs b/embassy-util/src/forever.rs index 3d2af38b1..4f3698211 100644 --- a/embassy/src/util/forever.rs +++ b/embassy-util/src/forever.rs | |||
| @@ -12,7 +12,7 @@ use atomic_polyfill::{AtomicBool, Ordering}; | |||
| 12 | /// Note: IF a global mutable variable is desired, use a CriticalSectionMutex or ThreadModeMutex instead. | 12 | /// Note: IF a global mutable variable is desired, use a CriticalSectionMutex or ThreadModeMutex instead. |
| 13 | /// | 13 | /// |
| 14 | /// ``` | 14 | /// ``` |
| 15 | /// use embassy::util::Forever; | 15 | /// use embassy_util::Forever; |
| 16 | /// // Using an integer for the sake of keeping this example self-contained, | 16 | /// // Using an integer for the sake of keeping this example self-contained, |
| 17 | /// // see https://github.com/embassy-rs/embassy/wiki/Getting-Started for a more "proper" example. | 17 | /// // see https://github.com/embassy-rs/embassy/wiki/Getting-Started for a more "proper" example. |
| 18 | /// static SOME_INT: Forever<u32> =Forever::new(); | 18 | /// static SOME_INT: Forever<u32> =Forever::new(); |
diff --git a/embassy-util/src/lib.rs b/embassy-util/src/lib.rs new file mode 100644 index 000000000..07b1633ea --- /dev/null +++ b/embassy-util/src/lib.rs | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)] | ||
| 2 | #![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))] | ||
| 3 | #![cfg_attr(all(feature = "nightly", target_arch = "xtensa"), feature(asm_experimental_arch))] | ||
| 4 | #![allow(clippy::new_without_default)] | ||
| 5 | #![doc = include_str!("../../README.md")] | ||
| 6 | #![warn(missing_docs)] | ||
| 7 | |||
| 8 | // This mod MUST go first, so that the others see its macros. | ||
| 9 | pub(crate) mod fmt; | ||
| 10 | |||
| 11 | pub mod blocking_mutex; | ||
| 12 | pub mod channel; | ||
| 13 | pub mod mutex; | ||
| 14 | pub mod waitqueue; | ||
| 15 | |||
| 16 | mod forever; | ||
| 17 | mod select; | ||
| 18 | mod yield_now; | ||
| 19 | |||
| 20 | pub use forever::*; | ||
| 21 | pub use select::*; | ||
| 22 | pub use yield_now::*; | ||
diff --git a/embassy/src/mutex.rs b/embassy-util/src/mutex.rs index 9cfaaa845..75a6e8dd3 100644 --- a/embassy/src/mutex.rs +++ b/embassy-util/src/mutex.rs | |||
| @@ -5,7 +5,7 @@ use core::cell::{RefCell, UnsafeCell}; | |||
| 5 | use core::ops::{Deref, DerefMut}; | 5 | use core::ops::{Deref, DerefMut}; |
| 6 | use core::task::Poll; | 6 | use core::task::Poll; |
| 7 | 7 | ||
| 8 | use futures::future::poll_fn; | 8 | use futures_util::future::poll_fn; |
| 9 | 9 | ||
| 10 | use crate::blocking_mutex::raw::RawMutex; | 10 | use crate::blocking_mutex::raw::RawMutex; |
| 11 | use crate::blocking_mutex::Mutex as BlockingMutex; | 11 | use crate::blocking_mutex::Mutex as BlockingMutex; |
| @@ -54,7 +54,6 @@ where | |||
| 54 | M: RawMutex, | 54 | M: RawMutex, |
| 55 | { | 55 | { |
| 56 | /// Create a new mutex with the given value. | 56 | /// Create a new mutex with the given value. |
| 57 | #[cfg(feature = "nightly")] | ||
| 58 | pub const fn new(value: T) -> Self { | 57 | pub const fn new(value: T) -> Self { |
| 59 | Self { | 58 | Self { |
| 60 | inner: UnsafeCell::new(value), | 59 | inner: UnsafeCell::new(value), |
| @@ -64,18 +63,6 @@ where | |||
| 64 | })), | 63 | })), |
| 65 | } | 64 | } |
| 66 | } | 65 | } |
| 67 | |||
| 68 | /// Create a new mutex with the given value. | ||
| 69 | #[cfg(not(feature = "nightly"))] | ||
| 70 | pub fn new(value: T) -> Self { | ||
| 71 | Self { | ||
| 72 | inner: UnsafeCell::new(value), | ||
| 73 | state: BlockingMutex::new(RefCell::new(State { | ||
| 74 | locked: false, | ||
| 75 | waker: WakerRegistration::new(), | ||
| 76 | })), | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | 66 | } |
| 80 | 67 | ||
| 81 | impl<M, T> Mutex<M, T> | 68 | impl<M, T> Mutex<M, T> |
diff --git a/embassy/src/util/select.rs b/embassy-util/src/select.rs index 8cecb7fa0..8cecb7fa0 100644 --- a/embassy/src/util/select.rs +++ b/embassy-util/src/select.rs | |||
diff --git a/embassy/src/waitqueue/mod.rs b/embassy-util/src/waitqueue/mod.rs index 5c4e1bc3b..6661a6b61 100644 --- a/embassy/src/waitqueue/mod.rs +++ b/embassy-util/src/waitqueue/mod.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | //! Async low-level wait queues | 1 | //! Async low-level wait queues |
| 2 | 2 | ||
| 3 | #[cfg_attr(feature = "executor-agnostic", path = "waker_agnostic.rs")] | ||
| 4 | mod waker; | 3 | mod waker; |
| 5 | pub use waker::*; | 4 | pub use waker::*; |
| 6 | 5 | ||
diff --git a/embassy/src/waitqueue/multi_waker.rs b/embassy-util/src/waitqueue/multi_waker.rs index 325d2cb3a..325d2cb3a 100644 --- a/embassy/src/waitqueue/multi_waker.rs +++ b/embassy-util/src/waitqueue/multi_waker.rs | |||
diff --git a/embassy/src/waitqueue/waker_agnostic.rs b/embassy-util/src/waitqueue/waker.rs index 64e300eb8..64e300eb8 100644 --- a/embassy/src/waitqueue/waker_agnostic.rs +++ b/embassy-util/src/waitqueue/waker.rs | |||
diff --git a/embassy/src/util/yield_now.rs b/embassy-util/src/yield_now.rs index 1ebecb916..1ebecb916 100644 --- a/embassy/src/util/yield_now.rs +++ b/embassy-util/src/yield_now.rs | |||
diff --git a/embassy/src/util/mod.rs b/embassy/src/util/mod.rs deleted file mode 100644 index 3ad760cd4..000000000 --- a/embassy/src/util/mod.rs +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | //! Misc utilities | ||
| 2 | |||
| 3 | mod forever; | ||
| 4 | mod select; | ||
| 5 | mod yield_now; | ||
| 6 | |||
| 7 | pub use forever::*; | ||
| 8 | pub use select::*; | ||
| 9 | pub use yield_now::*; | ||
diff --git a/embassy/src/waitqueue/waker.rs b/embassy/src/waitqueue/waker.rs deleted file mode 100644 index cdc96507f..000000000 --- a/embassy/src/waitqueue/waker.rs +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | use core::ptr::{self, NonNull}; | ||
| 2 | use core::task::Waker; | ||
| 3 | |||
| 4 | use atomic_polyfill::{compiler_fence, AtomicPtr, Ordering}; | ||
| 5 | |||
| 6 | use crate::executor::raw::{task_from_waker, wake_task, TaskHeader}; | ||
| 7 | |||
| 8 | /// Utility struct to register and wake a waker. | ||
| 9 | /// | ||
| 10 | /// # Safety | ||
| 11 | /// | ||
| 12 | /// This type is optimized for (and only works with) embassy tasks. | ||
| 13 | #[derive(Debug)] | ||
| 14 | pub struct WakerRegistration { | ||
| 15 | waker: Option<NonNull<TaskHeader>>, | ||
| 16 | } | ||
| 17 | |||
| 18 | impl WakerRegistration { | ||
| 19 | /// Create a new `WakerRegistration`. | ||
| 20 | pub const fn new() -> Self { | ||
| 21 | Self { waker: None } | ||
| 22 | } | ||
| 23 | |||
| 24 | /// Register a waker. Overwrites the previous waker, if any. | ||
| 25 | pub fn register(&mut self, w: &Waker) { | ||
| 26 | let w = task_from_waker(w); | ||
| 27 | match self.waker { | ||
| 28 | // Optimization: If both the old and new Wakers wake the same task, do nothing. | ||
| 29 | Some(w2) if w == w2 => {} | ||
| 30 | Some(w2) => { | ||
| 31 | // We had a waker registered for another task. Wake it, so the other task can | ||
| 32 | // reregister itself if it's still interested. | ||
| 33 | // | ||
| 34 | // If two tasks are waiting on the same thing concurrently, this will cause them | ||
| 35 | // to wake each other in a loop fighting over this WakerRegistration. This wastes | ||
| 36 | // CPU but things will still work. | ||
| 37 | // | ||
| 38 | // If the user wants to have two tasks waiting on the same thing they should use | ||
| 39 | // a more appropriate primitive that can store multiple wakers. | ||
| 40 | |||
| 41 | unsafe { wake_task(w2) } | ||
| 42 | self.waker = Some(w); | ||
| 43 | } | ||
| 44 | None => self.waker = Some(w), | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | /// Wake the registered waker, if any. | ||
| 49 | pub fn wake(&mut self) { | ||
| 50 | if let Some(w) = self.waker.take() { | ||
| 51 | unsafe { wake_task(w) } | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | /// Returns true if a waker is currently registered | ||
| 56 | pub fn occupied(&self) -> bool { | ||
| 57 | self.waker.is_some() | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | // SAFETY: `WakerRegistration` effectively contains an `Option<Waker>`, | ||
| 62 | // which is `Send` and `Sync`. | ||
| 63 | unsafe impl Send for WakerRegistration {} | ||
| 64 | unsafe impl Sync for WakerRegistration {} | ||
| 65 | |||
| 66 | /// Utility struct to atomically register and wake a waker. | ||
| 67 | /// | ||
| 68 | /// # Safety | ||
| 69 | /// | ||
| 70 | /// This type is optimized for (and only works with) embassy tasks. | ||
| 71 | pub struct AtomicWaker { | ||
| 72 | waker: AtomicPtr<TaskHeader>, | ||
| 73 | } | ||
| 74 | |||
| 75 | impl AtomicWaker { | ||
| 76 | /// Create a new `AtomicWaker`. | ||
| 77 | pub const fn new() -> Self { | ||
| 78 | Self { | ||
| 79 | waker: AtomicPtr::new(ptr::null_mut()), | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | /// Register a waker. Overwrites the previous waker, if any. | ||
| 84 | pub fn register(&self, w: &Waker) { | ||
| 85 | let w = task_from_waker(w); | ||
| 86 | self.waker.store(w.as_ptr(), Ordering::Relaxed); | ||
| 87 | compiler_fence(Ordering::SeqCst); | ||
| 88 | } | ||
| 89 | |||
| 90 | /// Wake the registered waker, if any. | ||
| 91 | pub fn wake(&self) { | ||
| 92 | let w2 = self.waker.load(Ordering::Relaxed); | ||
| 93 | if let Some(w2) = NonNull::new(w2) { | ||
| 94 | unsafe { wake_task(w2) }; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | } | ||
diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml index 0ae7163c3..dd9bcc093 100644 --- a/examples/boot/application/nrf/Cargo.toml +++ b/examples/boot/application/nrf/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-nrf-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util" } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly"] } | ||
| 8 | embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] } | 9 | embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] } |
| 9 | embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" } | 10 | embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs index 0b9715e49..3044645a8 100644 --- a/examples/boot/application/nrf/src/bin/a.rs +++ b/examples/boot/application/nrf/src/bin/a.rs | |||
| @@ -13,8 +13,8 @@ use panic_reset as _; | |||
| 13 | 13 | ||
| 14 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 14 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 17 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 18 | let mut button = Input::new(p.P0_11, Pull::Up); | 18 | let mut button = Input::new(p.P0_11, Pull::Up); |
| 19 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 19 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 20 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | 20 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); |
diff --git a/examples/boot/application/nrf/src/bin/b.rs b/examples/boot/application/nrf/src/bin/b.rs index a06c20f8b..2f76d20c6 100644 --- a/examples/boot/application/nrf/src/bin/b.rs +++ b/examples/boot/application/nrf/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | #![feature(generic_associated_types)] | 4 | #![feature(generic_associated_types)] |
| 5 | #![feature(type_alias_impl_trait)] | 5 | #![feature(type_alias_impl_trait)] |
| 6 | 6 | ||
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use panic_reset as _; | 10 | use panic_reset as _; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 13 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 14 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 14 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 15 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | 15 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); |
| 16 | 16 | ||
diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml index 36fc135fe..313808a0d 100644 --- a/examples/boot/application/stm32f3/Cargo.toml +++ b/examples/boot/application/stm32f3/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32f3-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs index 4ff18d7c7..fd18e9373 100644 --- a/examples/boot/application/stm32f3/src/bin/a.rs +++ b/examples/boot/application/stm32f3/src/bin/a.rs | |||
| @@ -14,8 +14,8 @@ use panic_reset as _; | |||
| 14 | 14 | ||
| 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 18 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 19 | let flash = Flash::unlock(p.FLASH); | 19 | let flash = Flash::unlock(p.FLASH); |
| 20 | let mut flash = BlockingAsync::new(flash); | 20 | let mut flash = BlockingAsync::new(flash); |
| 21 | 21 | ||
diff --git a/examples/boot/application/stm32f3/src/bin/b.rs b/examples/boot/application/stm32f3/src/bin/b.rs index 4487e586e..934f862d9 100644 --- a/examples/boot/application/stm32f3/src/bin/b.rs +++ b/examples/boot/application/stm32f3/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); |
| 16 | 16 | ||
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml index ad4a6fa76..2a4741dc7 100644 --- a/examples/boot/application/stm32f7/Cargo.toml +++ b/examples/boot/application/stm32f7/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32f7-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32f7/src/bin/a.rs b/examples/boot/application/stm32f7/src/bin/a.rs index 9c7921a1a..10d709cfd 100644 --- a/examples/boot/application/stm32f7/src/bin/a.rs +++ b/examples/boot/application/stm32f7/src/bin/a.rs | |||
| @@ -14,8 +14,8 @@ use panic_reset as _; | |||
| 14 | 14 | ||
| 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 18 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 19 | let flash = Flash::unlock(p.FLASH); | 19 | let flash = Flash::unlock(p.FLASH); |
| 20 | let mut flash = BlockingAsync::new(flash); | 20 | let mut flash = BlockingAsync::new(flash); |
| 21 | 21 | ||
diff --git a/examples/boot/application/stm32f7/src/bin/b.rs b/examples/boot/application/stm32f7/src/bin/b.rs index aa05bbcdd..c89e8a310 100644 --- a/examples/boot/application/stm32f7/src/bin/b.rs +++ b/examples/boot/application/stm32f7/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | Timer::after(Duration::from_millis(300)).await; | 15 | Timer::after(Duration::from_millis(300)).await; |
| 16 | let mut led = Output::new(p.PB7, Level::High, Speed::Low); | 16 | let mut led = Output::new(p.PB7, Level::High, Speed::Low); |
diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml index 5dff770a8..c6420e8ad 100644 --- a/examples/boot/application/stm32h7/Cargo.toml +++ b/examples/boot/application/stm32h7/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32h7-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs index 704979dba..cc363bb32 100644 --- a/examples/boot/application/stm32h7/src/bin/a.rs +++ b/examples/boot/application/stm32h7/src/bin/a.rs | |||
| @@ -14,8 +14,8 @@ use panic_reset as _; | |||
| 14 | 14 | ||
| 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 18 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 19 | let flash = Flash::unlock(p.FLASH); | 19 | let flash = Flash::unlock(p.FLASH); |
| 20 | let mut flash = BlockingAsync::new(flash); | 20 | let mut flash = BlockingAsync::new(flash); |
| 21 | 21 | ||
diff --git a/examples/boot/application/stm32h7/src/bin/b.rs b/examples/boot/application/stm32h7/src/bin/b.rs index ea0140253..3fa63bdcf 100644 --- a/examples/boot/application/stm32h7/src/bin/b.rs +++ b/examples/boot/application/stm32h7/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | Timer::after(Duration::from_millis(300)).await; | 15 | Timer::after(Duration::from_millis(300)).await; |
| 16 | let mut led = Output::new(p.PB14, Level::High, Speed::Low); | 16 | let mut led = Output::new(p.PB14, Level::High, Speed::Low); |
diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml index de7bea47b..a6936419c 100644 --- a/examples/boot/application/stm32l0/Cargo.toml +++ b/examples/boot/application/stm32l0/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32l0-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32l0/src/bin/a.rs b/examples/boot/application/stm32l0/src/bin/a.rs index ce620347b..fcf3f2ef1 100644 --- a/examples/boot/application/stm32l0/src/bin/a.rs +++ b/examples/boot/application/stm32l0/src/bin/a.rs | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::time::{Duration, Timer}; | ||
| 8 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 9 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 9 | use embassy_executor::time::{Duration, Timer}; | ||
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::flash::Flash; | 11 | use embassy_stm32::flash::Flash; |
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| @@ -15,8 +15,8 @@ use panic_reset as _; | |||
| 15 | 15 | ||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 19 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 20 | let flash = Flash::unlock(p.FLASH); | 20 | let flash = Flash::unlock(p.FLASH); |
| 21 | let mut flash = BlockingAsync::new(flash); | 21 | let mut flash = BlockingAsync::new(flash); |
| 22 | 22 | ||
diff --git a/examples/boot/application/stm32l0/src/bin/b.rs b/examples/boot/application/stm32l0/src/bin/b.rs index 0b585a14c..46e394c4c 100644 --- a/examples/boot/application/stm32l0/src/bin/b.rs +++ b/examples/boot/application/stm32l0/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); |
| 16 | 16 | ||
diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml index 3fd6f639a..5e53cd5f6 100644 --- a/examples/boot/application/stm32l1/Cargo.toml +++ b/examples/boot/application/stm32l1/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32l1-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs index ce620347b..fcf3f2ef1 100644 --- a/examples/boot/application/stm32l1/src/bin/a.rs +++ b/examples/boot/application/stm32l1/src/bin/a.rs | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::time::{Duration, Timer}; | ||
| 8 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 9 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 9 | use embassy_executor::time::{Duration, Timer}; | ||
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::flash::Flash; | 11 | use embassy_stm32::flash::Flash; |
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| @@ -15,8 +15,8 @@ use panic_reset as _; | |||
| 15 | 15 | ||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 19 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 20 | let flash = Flash::unlock(p.FLASH); | 20 | let flash = Flash::unlock(p.FLASH); |
| 21 | let mut flash = BlockingAsync::new(flash); | 21 | let mut flash = BlockingAsync::new(flash); |
| 22 | 22 | ||
diff --git a/examples/boot/application/stm32l1/src/bin/b.rs b/examples/boot/application/stm32l1/src/bin/b.rs index 0b585a14c..46e394c4c 100644 --- a/examples/boot/application/stm32l1/src/bin/b.rs +++ b/examples/boot/application/stm32l1/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); |
| 16 | 16 | ||
diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml index 7284af662..bbb5e7e1d 100644 --- a/examples/boot/application/stm32l4/Cargo.toml +++ b/examples/boot/application/stm32l4/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32l4-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32l4/src/bin/a.rs b/examples/boot/application/stm32l4/src/bin/a.rs index bf6099355..f092f0239 100644 --- a/examples/boot/application/stm32l4/src/bin/a.rs +++ b/examples/boot/application/stm32l4/src/bin/a.rs | |||
| @@ -14,8 +14,8 @@ use panic_reset as _; | |||
| 14 | 14 | ||
| 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 18 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 19 | let flash = Flash::unlock(p.FLASH); | 19 | let flash = Flash::unlock(p.FLASH); |
| 20 | let mut flash = BlockingAsync::new(flash); | 20 | let mut flash = BlockingAsync::new(flash); |
| 21 | 21 | ||
diff --git a/examples/boot/application/stm32l4/src/bin/b.rs b/examples/boot/application/stm32l4/src/bin/b.rs index 4487e586e..934f862d9 100644 --- a/examples/boot/application/stm32l4/src/bin/b.rs +++ b/examples/boot/application/stm32l4/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); |
| 16 | 16 | ||
diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml index ca22e6134..62123a870 100644 --- a/examples/boot/application/stm32wl/Cargo.toml +++ b/examples/boot/application/stm32wl/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-boot-stm32wl-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../../../embassy", features = ["nightly", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] } |
| 9 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } | 10 | embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } |
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } |
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs index dc1eb9bed..14408a90a 100644 --- a/examples/boot/application/stm32wl/src/bin/a.rs +++ b/examples/boot/application/stm32wl/src/bin/a.rs | |||
| @@ -14,8 +14,8 @@ use panic_reset as _; | |||
| 14 | 14 | ||
| 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | 18 | async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) { |
| 19 | let flash = Flash::unlock(p.FLASH); | 19 | let flash = Flash::unlock(p.FLASH); |
| 20 | let mut flash = BlockingAsync::new(flash); | 20 | let mut flash = BlockingAsync::new(flash); |
| 21 | 21 | ||
diff --git a/examples/boot/application/stm32wl/src/bin/b.rs b/examples/boot/application/stm32wl/src/bin/b.rs index f2344bd53..e565fd7c6 100644 --- a/examples/boot/application/stm32wl/src/bin/b.rs +++ b/examples/boot/application/stm32wl/src/bin/b.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | 5 | #[cfg(feature = "defmt-rtt")] |
| 6 | use defmt_rtt::*; | 6 | use defmt_rtt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 11 | use panic_reset as _; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); |
| 16 | 16 | ||
diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml index 8eb98623c..9683bff19 100644 --- a/examples/boot/bootloader/nrf/Cargo.toml +++ b/examples/boot/bootloader/nrf/Cargo.toml | |||
| @@ -8,7 +8,6 @@ description = "Bootloader for nRF chips" | |||
| 8 | defmt = { version = "0.3", optional = true } | 8 | defmt = { version = "0.3", optional = true } |
| 9 | defmt-rtt = { version = "0.3", optional = true } | 9 | defmt-rtt = { version = "0.3", optional = true } |
| 10 | 10 | ||
| 11 | embassy = { path = "../../../../embassy", default-features = false } | ||
| 12 | embassy-nrf = { path = "../../../../embassy-nrf", default-features = false, features = ["nightly"] } | 11 | embassy-nrf = { path = "../../../../embassy-nrf", default-features = false, features = ["nightly"] } |
| 13 | embassy-boot-nrf = { path = "../../../../embassy-boot/nrf", default-features = false } | 12 | embassy-boot-nrf = { path = "../../../../embassy-boot/nrf", default-features = false } |
| 14 | cortex-m = { version = "0.7" } | 13 | cortex-m = { version = "0.7" } |
diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml index b99a8fbcd..4a3319528 100644 --- a/examples/boot/bootloader/stm32/Cargo.toml +++ b/examples/boot/bootloader/stm32/Cargo.toml | |||
| @@ -8,7 +8,6 @@ description = "Example bootloader for STM32 chips" | |||
| 8 | defmt = { version = "0.3", optional = true } | 8 | defmt = { version = "0.3", optional = true } |
| 9 | defmt-rtt = { version = "0.3", optional = true } | 9 | defmt-rtt = { version = "0.3", optional = true } |
| 10 | 10 | ||
| 11 | embassy = { path = "../../../../embassy", default-features = false } | ||
| 12 | embassy-stm32 = { path = "../../../../embassy-stm32", default-features = false, features = ["nightly"] } | 11 | embassy-stm32 = { path = "../../../../embassy-stm32", default-features = false, features = ["nightly"] } |
| 13 | embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32", default-features = false } | 12 | embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32", default-features = false } |
| 14 | cortex-m = { version = "0.7" } | 13 | cortex-m = { version = "0.7" } |
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml index 0cba77694..91edbd36d 100644 --- a/examples/nrf/Cargo.toml +++ b/examples/nrf/Cargo.toml | |||
| @@ -5,10 +5,11 @@ version = "0.1.0" | |||
| 5 | 5 | ||
| 6 | [features] | 6 | [features] |
| 7 | default = ["nightly"] | 7 | default = ["nightly"] |
| 8 | nightly = ["embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"] | 8 | nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"] |
| 9 | 9 | ||
| 10 | [dependencies] | 10 | [dependencies] |
| 11 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 12 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime"] } | ||
| 12 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } | 13 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } |
| 13 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true } | 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true } |
| 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true } | 15 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true } |
diff --git a/examples/nrf/src/bin/awaitable_timer.rs b/examples/nrf/src/bin/awaitable_timer.rs index 34a657cb9..f2c1d9fa4 100644 --- a/examples/nrf/src/bin/awaitable_timer.rs +++ b/examples/nrf/src/bin/awaitable_timer.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::timer::Timer; | 7 | use embassy_nrf::timer::Timer; |
| 8 | use embassy_nrf::{interrupt, Peripherals}; | 8 | use embassy_nrf::{interrupt, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut t = Timer::new_awaitable(p.TIMER0, interrupt::take!(TIMER0)); | 13 | let mut t = Timer::new_awaitable(p.TIMER0, interrupt::take!(TIMER0)); |
| 14 | // default frequency is 1MHz, so this triggers every second | 14 | // default frequency is 1MHz, so this triggers every second |
diff --git a/examples/nrf/src/bin/blinky.rs b/examples/nrf/src/bin/blinky.rs index 23d16f796..98db6546c 100644 --- a/examples/nrf/src/bin/blinky.rs +++ b/examples/nrf/src/bin/blinky.rs | |||
| @@ -2,13 +2,13 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 6 | use embassy_executor::time::{Duration, Timer}; |
| 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/buffered_uart.rs b/examples/nrf/src/bin/buffered_uart.rs index 18dd698bf..f02b7d845 100644 --- a/examples/nrf/src/bin/buffered_uart.rs +++ b/examples/nrf/src/bin/buffered_uart.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::buffered_uarte::{BufferedUarte, State}; | 7 | use embassy_nrf::buffered_uarte::{BufferedUarte, State}; |
| 8 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 8 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 9 | use embedded_io::asynch::{BufRead, Write}; | 9 | use embedded_io::asynch::{BufRead, Write}; |
| 10 | use futures::pin_mut; | 10 | use futures::pin_mut; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | let mut config = uarte::Config::default(); | 15 | let mut config = uarte::Config::default(); |
| 16 | config.parity = uarte::Parity::EXCLUDED; | 16 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/channel.rs b/examples/nrf/src/bin/channel.rs index c57b91a42..e97c6c5ee 100644 --- a/examples/nrf/src/bin/channel.rs +++ b/examples/nrf/src/bin/channel.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::Channel; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 11 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::Channel; | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | enum LedState { | 14 | enum LedState { |
| @@ -18,7 +18,7 @@ enum LedState { | |||
| 18 | 18 | ||
| 19 | static CHANNEL: Channel<ThreadModeRawMutex, LedState, 1> = Channel::new(); | 19 | static CHANNEL: Channel<ThreadModeRawMutex, LedState, 1> = Channel::new(); |
| 20 | 20 | ||
| 21 | #[embassy::task] | 21 | #[embassy_executor::task] |
| 22 | async fn my_task() { | 22 | async fn my_task() { |
| 23 | loop { | 23 | loop { |
| 24 | CHANNEL.send(LedState::On).await; | 24 | CHANNEL.send(LedState::On).await; |
| @@ -28,7 +28,7 @@ async fn my_task() { | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | #[embassy::main] | 31 | #[embassy_executor::main] |
| 32 | async fn main(spawner: Spawner, p: Peripherals) { | 32 | async fn main(spawner: Spawner, p: Peripherals) { |
| 33 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 33 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 34 | 34 | ||
diff --git a/examples/nrf/src/bin/channel_sender_receiver.rs b/examples/nrf/src/bin/channel_sender_receiver.rs index 847ce2382..bca7bb248 100644 --- a/examples/nrf/src/bin/channel_sender_receiver.rs +++ b/examples/nrf/src/bin/channel_sender_receiver.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::NoopRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::{Channel, Receiver, Sender}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy::util::Forever; | ||
| 11 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; | 8 | use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; |
| 12 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embassy_util::blocking_mutex::raw::NoopRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::{Channel, Receiver, Sender}; | ||
| 12 | use embassy_util::Forever; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | enum LedState { | 15 | enum LedState { |
| @@ -19,7 +19,7 @@ enum LedState { | |||
| 19 | 19 | ||
| 20 | static CHANNEL: Forever<Channel<NoopRawMutex, LedState, 1>> = Forever::new(); | 20 | static CHANNEL: Forever<Channel<NoopRawMutex, LedState, 1>> = Forever::new(); |
| 21 | 21 | ||
| 22 | #[embassy::task] | 22 | #[embassy_executor::task] |
| 23 | async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { | 23 | async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { |
| 24 | loop { | 24 | loop { |
| 25 | sender.send(LedState::On).await; | 25 | sender.send(LedState::On).await; |
| @@ -29,7 +29,7 @@ async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) { | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #[embassy::task] | 32 | #[embassy_executor::task] |
| 33 | async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { | 33 | async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedState, 1>) { |
| 34 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); | 34 | let mut led = Output::new(led, Level::Low, OutputDrive::Standard); |
| 35 | 35 | ||
| @@ -41,7 +41,7 @@ async fn recv_task(led: AnyPin, receiver: Receiver<'static, NoopRawMutex, LedSta | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | #[embassy::main] | 44 | #[embassy_executor::main] |
| 45 | async fn main(spawner: Spawner, p: Peripherals) { | 45 | async fn main(spawner: Spawner, p: Peripherals) { |
| 46 | let channel = CHANNEL.put(Channel::new()); | 46 | let channel = CHANNEL.put(Channel::new()); |
| 47 | 47 | ||
diff --git a/examples/nrf/src/bin/executor_fairness_test.rs b/examples/nrf/src/bin/executor_fairness_test.rs index 5a4221519..b98454936 100644 --- a/examples/nrf/src/bin/executor_fairness_test.rs +++ b/examples/nrf/src/bin/executor_fairness_test.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | use core::task::Poll; | 5 | use core::task::Poll; |
| 6 | 6 | ||
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Instant, Timer}; | 9 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 10 | use embassy_nrf::Peripherals; | 10 | use embassy_nrf::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::task] | 13 | #[embassy_executor::task] |
| 14 | async fn run1() { | 14 | async fn run1() { |
| 15 | loop { | 15 | loop { |
| 16 | info!("DING DONG"); | 16 | info!("DING DONG"); |
| @@ -18,14 +18,14 @@ async fn run1() { | |||
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::task] | 21 | #[embassy_executor::task] |
| 22 | async fn run2() { | 22 | async fn run2() { |
| 23 | loop { | 23 | loop { |
| 24 | Timer::at(Instant::from_ticks(0)).await; | 24 | Timer::at(Instant::from_ticks(0)).await; |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | #[embassy::task] | 28 | #[embassy_executor::task] |
| 29 | async fn run3() { | 29 | async fn run3() { |
| 30 | futures::future::poll_fn(|cx| { | 30 | futures::future::poll_fn(|cx| { |
| 31 | cx.waker().wake_by_ref(); | 31 | cx.waker().wake_by_ref(); |
| @@ -34,7 +34,7 @@ async fn run3() { | |||
| 34 | .await; | 34 | .await; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy::main] | 37 | #[embassy_executor::main] |
| 38 | async fn main(spawner: Spawner, _p: Peripherals) { | 38 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 39 | unwrap!(spawner.spawn(run1())); | 39 | unwrap!(spawner.spawn(run1())); |
| 40 | unwrap!(spawner.spawn(run2())); | 40 | unwrap!(spawner.spawn(run2())); |
diff --git a/examples/nrf/src/bin/gpiote_channel.rs b/examples/nrf/src/bin/gpiote_channel.rs index ad8f37c6e..65c7b4df7 100644 --- a/examples/nrf/src/bin/gpiote_channel.rs +++ b/examples/nrf/src/bin/gpiote_channel.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Input, Pull}; | 7 | use embassy_nrf::gpio::{Input, Pull}; |
| 8 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; | 8 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Starting!"); | 14 | info!("Starting!"); |
| 15 | 15 | ||
diff --git a/examples/nrf/src/bin/gpiote_port.rs b/examples/nrf/src/bin/gpiote_port.rs index 30b87b3a7..7746a7f96 100644 --- a/examples/nrf/src/bin/gpiote_port.rs +++ b/examples/nrf/src/bin/gpiote_port.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; | 7 | use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 4)] | 11 | #[embassy_executor::task(pool_size = 4)] |
| 12 | async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { | 12 | async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { |
| 13 | loop { | 13 | loop { |
| 14 | pin.wait_for_low().await; | 14 | pin.wait_for_low().await; |
| @@ -18,7 +18,7 @@ async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { | |||
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::main] | 21 | #[embassy_executor::main] |
| 22 | async fn main(spawner: Spawner, p: Peripherals) { | 22 | async fn main(spawner: Spawner, p: Peripherals) { |
| 23 | info!("Starting!"); | 23 | info!("Starting!"); |
| 24 | 24 | ||
diff --git a/examples/nrf/src/bin/multiprio.rs b/examples/nrf/src/bin/multiprio.rs index 1a4598e21..7050da378 100644 --- a/examples/nrf/src/bin/multiprio.rs +++ b/examples/nrf/src/bin/multiprio.rs | |||
| @@ -59,14 +59,14 @@ | |||
| 59 | 59 | ||
| 60 | use cortex_m_rt::entry; | 60 | use cortex_m_rt::entry; |
| 61 | use defmt::{info, unwrap}; | 61 | use defmt::{info, unwrap}; |
| 62 | use embassy::time::{Duration, Instant, Timer}; | 62 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 63 | use embassy::util::Forever; | ||
| 64 | use embassy_nrf::executor::{Executor, InterruptExecutor}; | 63 | use embassy_nrf::executor::{Executor, InterruptExecutor}; |
| 65 | use embassy_nrf::interrupt; | 64 | use embassy_nrf::interrupt; |
| 66 | use embassy_nrf::interrupt::InterruptExt; | 65 | use embassy_nrf::interrupt::InterruptExt; |
| 66 | use embassy_util::Forever; | ||
| 67 | use {defmt_rtt as _, panic_probe as _}; | 67 | use {defmt_rtt as _, panic_probe as _}; |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn run_high() { | 70 | async fn run_high() { |
| 71 | loop { | 71 | loop { |
| 72 | info!(" [high] tick!"); | 72 | info!(" [high] tick!"); |
| @@ -74,7 +74,7 @@ async fn run_high() { | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #[embassy::task] | 77 | #[embassy_executor::task] |
| 78 | async fn run_med() { | 78 | async fn run_med() { |
| 79 | loop { | 79 | loop { |
| 80 | let start = Instant::now(); | 80 | let start = Instant::now(); |
| @@ -91,7 +91,7 @@ async fn run_med() { | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | #[embassy::task] | 94 | #[embassy_executor::task] |
| 95 | async fn run_low() { | 95 | async fn run_low() { |
| 96 | loop { | 96 | loop { |
| 97 | let start = Instant::now(); | 97 | let start = Instant::now(); |
diff --git a/examples/nrf/src/bin/mutex.rs b/examples/nrf/src/bin/mutex.rs index 92e01976c..5fe7eadb9 100644 --- a/examples/nrf/src/bin/mutex.rs +++ b/examples/nrf/src/bin/mutex.rs | |||
| @@ -3,16 +3,16 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::mutex::Mutex; | ||
| 9 | use embassy::time::{Duration, Timer}; | ||
| 10 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 10 | use embassy_util::mutex::Mutex; | ||
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | static MUTEX: Mutex<ThreadModeRawMutex, u32> = Mutex::new(0); | 13 | static MUTEX: Mutex<ThreadModeRawMutex, u32> = Mutex::new(0); |
| 14 | 14 | ||
| 15 | #[embassy::task] | 15 | #[embassy_executor::task] |
| 16 | async fn my_task() { | 16 | async fn my_task() { |
| 17 | loop { | 17 | loop { |
| 18 | { | 18 | { |
| @@ -29,7 +29,7 @@ async fn my_task() { | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | #[embassy::main] | 32 | #[embassy_executor::main] |
| 33 | async fn main(spawner: Spawner, _p: Peripherals) { | 33 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 34 | unwrap!(spawner.spawn(my_task())); | 34 | unwrap!(spawner.spawn(my_task())); |
| 35 | 35 | ||
diff --git a/examples/nrf/src/bin/nvmc.rs b/examples/nrf/src/bin/nvmc.rs index b55ef1f6c..1d4387de7 100644 --- a/examples/nrf/src/bin/nvmc.rs +++ b/examples/nrf/src/bin/nvmc.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::nvmc::Nvmc; | 8 | use embassy_nrf::nvmc::Nvmc; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello NVMC!"); | 15 | info!("Hello NVMC!"); |
| 16 | 16 | ||
diff --git a/examples/nrf/src/bin/ppi.rs b/examples/nrf/src/bin/ppi.rs index 004a1bfa4..9a60cc0a0 100644 --- a/examples/nrf/src/bin/ppi.rs +++ b/examples/nrf/src/bin/ppi.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | use core::future::pending; | 5 | use core::future::pending; |
| 6 | 6 | ||
| 7 | use defmt::info; | 7 | use defmt::info; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; | 9 | use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; |
| 10 | use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity}; | 10 | use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity}; |
| 11 | use embassy_nrf::ppi::Ppi; | 11 | use embassy_nrf::ppi::Ppi; |
| @@ -13,7 +13,7 @@ use embassy_nrf::Peripherals; | |||
| 13 | use gpiote::{OutputChannel, OutputChannelPolarity}; | 13 | use gpiote::{OutputChannel, OutputChannelPolarity}; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | info!("Starting!"); | 18 | info!("Starting!"); |
| 19 | 19 | ||
diff --git a/examples/nrf/src/bin/pubsub.rs b/examples/nrf/src/bin/pubsub.rs index 2c3a355c2..5f33f3e0b 100644 --- a/examples/nrf/src/bin/pubsub.rs +++ b/examples/nrf/src/bin/pubsub.rs | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::unwrap; | 5 | use defmt::unwrap; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_util::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | /// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher | 12 | /// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher |
| @@ -19,7 +19,7 @@ enum Message { | |||
| 19 | C, | 19 | C, |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | #[embassy::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { | 23 | async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { |
| 24 | defmt::info!("Hello World!"); | 24 | defmt::info!("Hello World!"); |
| 25 | 25 | ||
| @@ -64,7 +64,7 @@ async fn main(spawner: Spawner, _p: embassy_nrf::Peripherals) { | |||
| 64 | /// A logger task that just awaits the messages it receives | 64 | /// A logger task that just awaits the messages it receives |
| 65 | /// | 65 | /// |
| 66 | /// This takes the generic `Subscriber`. This is most performant, but requires you to write down all of the generics | 66 | /// This takes the generic `Subscriber`. This is most performant, but requires you to write down all of the generics |
| 67 | #[embassy::task] | 67 | #[embassy_executor::task] |
| 68 | async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Message, 4, 3, 1>) { | 68 | async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Message, 4, 3, 1>) { |
| 69 | loop { | 69 | loop { |
| 70 | let message = messages.next_message().await; | 70 | let message = messages.next_message().await; |
| @@ -76,7 +76,7 @@ async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Messa | |||
| 76 | /// Because of this, depeding on how the messages were published, the subscriber might miss some messages | 76 | /// Because of this, depeding on how the messages were published, the subscriber might miss some messages |
| 77 | /// | 77 | /// |
| 78 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics | 78 | /// This takes the dynamic `DynSubscriber`. This is not as performant as the generic version, but let's you ignore some of the generics |
| 79 | #[embassy::task] | 79 | #[embassy_executor::task] |
| 80 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { | 80 | async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { |
| 81 | loop { | 81 | loop { |
| 82 | // Do some work | 82 | // Do some work |
| @@ -93,7 +93,7 @@ async fn slow_logger(mut messages: DynSubscriber<'static, Message>) { | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /// Same as `slow_logger` but it ignores lag results | 95 | /// Same as `slow_logger` but it ignores lag results |
| 96 | #[embassy::task] | 96 | #[embassy_executor::task] |
| 97 | async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) { | 97 | async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) { |
| 98 | loop { | 98 | loop { |
| 99 | // Do some work | 99 | // Do some work |
diff --git a/examples/nrf/src/bin/pwm.rs b/examples/nrf/src/bin/pwm.rs index aec5dd73a..c8a083294 100644 --- a/examples/nrf/src/bin/pwm.rs +++ b/examples/nrf/src/bin/pwm.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; | 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -70,7 +70,7 @@ static DUTY: [u16; 1024] = [ | |||
| 70 | 7255, 7331, 7407, 7484, 7561, 7638, 7716, 7794, 7873, 7952, 8031, 8111, | 70 | 7255, 7331, 7407, 7484, 7561, 7638, 7716, 7794, 7873, 7952, 8031, 8111, |
| 71 | ]; | 71 | ]; |
| 72 | 72 | ||
| 73 | #[embassy::main] | 73 | #[embassy_executor::main] |
| 74 | async fn main(_spawner: Spawner, p: Peripherals) { | 74 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 75 | let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); | 75 | let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); |
| 76 | pwm.set_prescaler(Prescaler::Div1); | 76 | pwm.set_prescaler(Prescaler::Div1); |
diff --git a/examples/nrf/src/bin/pwm_double_sequence.rs b/examples/nrf/src/bin/pwm_double_sequence.rs index facafa775..cfd8db86b 100644 --- a/examples/nrf/src/bin/pwm_double_sequence.rs +++ b/examples/nrf/src/bin/pwm_double_sequence.rs | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{ | 8 | use embassy_nrf::pwm::{ |
| 9 | Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence, | 9 | Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence, |
| 10 | }; | 10 | }; |
| 11 | use embassy_nrf::Peripherals; | 11 | use embassy_nrf::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let seq_words_0: [u16; 5] = [1000, 250, 100, 50, 0]; | 16 | let seq_words_0: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 17 | let seq_words_1: [u16; 4] = [50, 100, 250, 1000]; | 17 | let seq_words_1: [u16; 4] = [50, 100, 250, 1000]; |
diff --git a/examples/nrf/src/bin/pwm_sequence.rs b/examples/nrf/src/bin/pwm_sequence.rs index b7cb385c7..b7a04c036 100644 --- a/examples/nrf/src/bin/pwm_sequence.rs +++ b/examples/nrf/src/bin/pwm_sequence.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer}; | 8 | use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; | 14 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 15 | 15 | ||
diff --git a/examples/nrf/src/bin/pwm_sequence_ppi.rs b/examples/nrf/src/bin/pwm_sequence_ppi.rs index d98e2ca76..f5c587c35 100644 --- a/examples/nrf/src/bin/pwm_sequence_ppi.rs +++ b/examples/nrf/src/bin/pwm_sequence_ppi.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | use core::future::pending; | 5 | use core::future::pending; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_nrf::gpio::{Input, Pull}; | 9 | use embassy_nrf::gpio::{Input, Pull}; |
| 10 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; | 10 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; |
| 11 | use embassy_nrf::ppi::Ppi; | 11 | use embassy_nrf::ppi::Ppi; |
| @@ -13,7 +13,7 @@ use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSeq | |||
| 13 | use embassy_nrf::Peripherals; | 13 | use embassy_nrf::Peripherals; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; | 18 | let seq_words: [u16; 5] = [1000, 250, 100, 50, 0]; |
| 19 | 19 | ||
diff --git a/examples/nrf/src/bin/pwm_sequence_ws2812b.rs b/examples/nrf/src/bin/pwm_sequence_ws2812b.rs index 0dee8c949..d6b3f005c 100644 --- a/examples/nrf/src/bin/pwm_sequence_ws2812b.rs +++ b/examples/nrf/src/bin/pwm_sequence_ws2812b.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{ | 8 | use embassy_nrf::pwm::{ |
| 9 | Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer, | 9 | Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer, |
| 10 | }; | 10 | }; |
| @@ -26,7 +26,7 @@ const RES: u16 = 0x8000; | |||
| 26 | 26 | ||
| 27 | // Provides data to a WS2812b (Neopixel) LED and makes it go blue. The data | 27 | // Provides data to a WS2812b (Neopixel) LED and makes it go blue. The data |
| 28 | // line is assumed to be P1_05. | 28 | // line is assumed to be P1_05. |
| 29 | #[embassy::main] | 29 | #[embassy_executor::main] |
| 30 | async fn main(_spawner: Spawner, p: Peripherals) { | 30 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 31 | let mut config = Config::default(); | 31 | let mut config = Config::default(); |
| 32 | config.sequence_load = SequenceLoad::Common; | 32 | config.sequence_load = SequenceLoad::Common; |
diff --git a/examples/nrf/src/bin/pwm_servo.rs b/examples/nrf/src/bin/pwm_servo.rs index 71a90a948..d28a5a17e 100644 --- a/examples/nrf/src/bin/pwm_servo.rs +++ b/examples/nrf/src/bin/pwm_servo.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; | 8 | use embassy_nrf::pwm::{Prescaler, SimplePwm}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let mut pwm = SimplePwm::new_1ch(p.PWM0, p.P0_05); | 14 | let mut pwm = SimplePwm::new_1ch(p.PWM0, p.P0_05); |
| 15 | // sg90 microervo requires 50hz or 20ms period | 15 | // sg90 microervo requires 50hz or 20ms period |
diff --git a/examples/nrf/src/bin/qdec.rs b/examples/nrf/src/bin/qdec.rs index 9529c7bb6..6bda82f78 100644 --- a/examples/nrf/src/bin/qdec.rs +++ b/examples/nrf/src/bin/qdec.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::qdec::{self, Qdec}; | 7 | use embassy_nrf::qdec::{self, Qdec}; |
| 8 | use embassy_nrf::{interrupt, Peripherals}; | 8 | use embassy_nrf::{interrupt, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let irq = interrupt::take!(QDEC); | 13 | let irq = interrupt::take!(QDEC); |
| 14 | let config = qdec::Config::default(); | 14 | let config = qdec::Config::default(); |
diff --git a/examples/nrf/src/bin/qspi.rs b/examples/nrf/src/bin/qspi.rs index 96c90f9c8..57e0fdbe2 100644 --- a/examples/nrf/src/bin/qspi.rs +++ b/examples/nrf/src/bin/qspi.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{assert_eq, info, unwrap}; | 5 | use defmt::{assert_eq, info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, qspi, Peripherals}; | 7 | use embassy_nrf::{interrupt, qspi, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| @@ -14,7 +14,7 @@ const PAGE_SIZE: usize = 4096; | |||
| 14 | #[repr(C, align(4))] | 14 | #[repr(C, align(4))] |
| 15 | struct AlignedBuf([u8; 4096]); | 15 | struct AlignedBuf([u8; 4096]); |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_spawner: Spawner, p: Peripherals) { | 18 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 19 | // Config for the MX25R64 present in the nRF52840 DK | 19 | // Config for the MX25R64 present in the nRF52840 DK |
| 20 | let mut config = qspi::Config::default(); | 20 | let mut config = qspi::Config::default(); |
diff --git a/examples/nrf/src/bin/qspi_lowpower.rs b/examples/nrf/src/bin/qspi_lowpower.rs index ce2e40b23..080b27a16 100644 --- a/examples/nrf/src/bin/qspi_lowpower.rs +++ b/examples/nrf/src/bin/qspi_lowpower.rs | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | use core::mem; | 5 | use core::mem; |
| 6 | 6 | ||
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_executor::time::{Duration, Timer}; |
| 10 | use embassy_nrf::{interrupt, qspi, Peripherals}; | 10 | use embassy_nrf::{interrupt, qspi, Peripherals}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| @@ -15,7 +15,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 15 | #[repr(C, align(4))] | 15 | #[repr(C, align(4))] |
| 16 | struct AlignedBuf([u8; 64]); | 16 | struct AlignedBuf([u8; 64]); |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 19 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 20 | let mut irq = interrupt::take!(QSPI); | 20 | let mut irq = interrupt::take!(QSPI); |
| 21 | 21 | ||
diff --git a/examples/nrf/src/bin/raw_spawn.rs b/examples/nrf/src/bin/raw_spawn.rs index d564b6b26..9199d3aeb 100644 --- a/examples/nrf/src/bin/raw_spawn.rs +++ b/examples/nrf/src/bin/raw_spawn.rs | |||
| @@ -5,10 +5,10 @@ use core::mem; | |||
| 5 | 5 | ||
| 6 | use cortex_m_rt::entry; | 6 | use cortex_m_rt::entry; |
| 7 | use defmt::{info, unwrap}; | 7 | use defmt::{info, unwrap}; |
| 8 | use embassy::executor::raw::TaskStorage; | 8 | use embassy_executor::executor::raw::TaskStorage; |
| 9 | use embassy::executor::Executor; | 9 | use embassy_executor::executor::Executor; |
| 10 | use embassy::time::{Duration, Timer}; | 10 | use embassy_executor::time::{Duration, Timer}; |
| 11 | use embassy::util::Forever; | 11 | use embassy_util::Forever; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | async fn run1() { | 14 | async fn run1() { |
diff --git a/examples/nrf/src/bin/rng.rs b/examples/nrf/src/bin/rng.rs index 08d3abe10..a4314e8b9 100644 --- a/examples/nrf/src/bin/rng.rs +++ b/examples/nrf/src/bin/rng.rs | |||
| @@ -2,13 +2,13 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_nrf::rng::Rng; | 6 | use embassy_nrf::rng::Rng; |
| 7 | use embassy_nrf::{interrupt, Peripherals}; | 7 | use embassy_nrf::{interrupt, Peripherals}; |
| 8 | use rand::Rng as _; | 8 | use rand::Rng as _; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut rng = Rng::new(p.RNG, interrupt::take!(RNG)); | 13 | let mut rng = Rng::new(p.RNG, interrupt::take!(RNG)); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/saadc.rs b/examples/nrf/src/bin/saadc.rs index cb9289784..65c78d842 100644 --- a/examples/nrf/src/bin/saadc.rs +++ b/examples/nrf/src/bin/saadc.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc}; | 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc}; |
| 9 | use embassy_nrf::{interrupt, Peripherals}; | 9 | use embassy_nrf::{interrupt, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 13 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 14 | let config = Config::default(); | 14 | let config = Config::default(); |
| 15 | let channel_config = ChannelConfig::single_ended(&mut p.P0_02); | 15 | let channel_config = ChannelConfig::single_ended(&mut p.P0_02); |
diff --git a/examples/nrf/src/bin/saadc_continuous.rs b/examples/nrf/src/bin/saadc_continuous.rs index 234294eae..d0305736f 100644 --- a/examples/nrf/src/bin/saadc_continuous.rs +++ b/examples/nrf/src/bin/saadc_continuous.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::Duration; | 7 | use embassy_executor::time::Duration; |
| 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState}; | 8 | use embassy_nrf::saadc::{ChannelConfig, Config, Saadc, SamplerState}; |
| 9 | use embassy_nrf::timer::Frequency; | 9 | use embassy_nrf::timer::Frequency; |
| 10 | use embassy_nrf::{interrupt, Peripherals}; | 10 | use embassy_nrf::{interrupt, Peripherals}; |
| @@ -12,7 +12,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 12 | 12 | ||
| 13 | // Demonstrates both continuous sampling and scanning multiple channels driven by a PPI linked timer | 13 | // Demonstrates both continuous sampling and scanning multiple channels driven by a PPI linked timer |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 16 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 17 | let config = Config::default(); | 17 | let config = Config::default(); |
| 18 | let channel_1_config = ChannelConfig::single_ended(&mut p.P0_02); | 18 | let channel_1_config = ChannelConfig::single_ended(&mut p.P0_02); |
| @@ -27,7 +27,7 @@ async fn main(_spawner: Spawner, mut p: Peripherals) { | |||
| 27 | 27 | ||
| 28 | // This delay demonstrates that starting the timer prior to running | 28 | // This delay demonstrates that starting the timer prior to running |
| 29 | // the task sampler is benign given the calibration that follows. | 29 | // the task sampler is benign given the calibration that follows. |
| 30 | embassy::time::Timer::after(Duration::from_millis(500)).await; | 30 | embassy_executor::time::Timer::after(Duration::from_millis(500)).await; |
| 31 | saadc.calibrate().await; | 31 | saadc.calibrate().await; |
| 32 | 32 | ||
| 33 | let mut bufs = [[[0; 3]; 500]; 2]; | 33 | let mut bufs = [[[0; 3]; 500]; 2]; |
diff --git a/examples/nrf/src/bin/self_spawn.rs b/examples/nrf/src/bin/self_spawn.rs index 4b8ac04bc..e0152802e 100644 --- a/examples/nrf/src/bin/self_spawn.rs +++ b/examples/nrf/src/bin/self_spawn.rs | |||
| @@ -3,19 +3,19 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 2)] | 11 | #[embassy_executor::task(pool_size = 2)] |
| 12 | async fn my_task(spawner: Spawner, n: u32) { | 12 | async fn my_task(spawner: Spawner, n: u32) { |
| 13 | Timer::after(Duration::from_secs(1)).await; | 13 | Timer::after(Duration::from_secs(1)).await; |
| 14 | info!("Spawning self! {}", n); | 14 | info!("Spawning self! {}", n); |
| 15 | unwrap!(spawner.spawn(my_task(spawner, n + 1))); | 15 | unwrap!(spawner.spawn(my_task(spawner, n + 1))); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(spawner: Spawner, _p: Peripherals) { | 19 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | unwrap!(spawner.spawn(my_task(spawner, 0))); | 21 | unwrap!(spawner.spawn(my_task(spawner, 0))); |
diff --git a/examples/nrf/src/bin/self_spawn_current_executor.rs b/examples/nrf/src/bin/self_spawn_current_executor.rs index 3c3379ce6..1d8309d77 100644 --- a/examples/nrf/src/bin/self_spawn_current_executor.rs +++ b/examples/nrf/src/bin/self_spawn_current_executor.rs | |||
| @@ -3,19 +3,19 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task(pool_size = 2)] | 11 | #[embassy_executor::task(pool_size = 2)] |
| 12 | async fn my_task(n: u32) { | 12 | async fn my_task(n: u32) { |
| 13 | Timer::after(Duration::from_secs(1)).await; | 13 | Timer::after(Duration::from_secs(1)).await; |
| 14 | info!("Spawning self! {}", n); | 14 | info!("Spawning self! {}", n); |
| 15 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); | 15 | unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(spawner: Spawner, _p: Peripherals) { | 19 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | unwrap!(spawner.spawn(my_task(0))); | 21 | unwrap!(spawner.spawn(my_task(0))); |
diff --git a/examples/nrf/src/bin/spim.rs b/examples/nrf/src/bin/spim.rs index 62040168a..fd741b21c 100644 --- a/examples/nrf/src/bin/spim.rs +++ b/examples/nrf/src/bin/spim.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 7 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 8 | use embassy_nrf::{interrupt, spim, Peripherals}; | 8 | use embassy_nrf::{interrupt, spim, Peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | info!("running!"); | 13 | info!("running!"); |
| 14 | 14 | ||
diff --git a/examples/nrf/src/bin/temp.rs b/examples/nrf/src/bin/temp.rs index 939cb39e7..654098e0b 100644 --- a/examples/nrf/src/bin/temp.rs +++ b/examples/nrf/src/bin/temp.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::temp::Temp; | 8 | use embassy_nrf::temp::Temp; |
| 9 | use embassy_nrf::{interrupt, Peripherals}; | 9 | use embassy_nrf::{interrupt, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let irq = interrupt::take!(TEMP); | 14 | let irq = interrupt::take!(TEMP); |
| 15 | let mut temp = Temp::new(p.TEMP, irq); | 15 | let mut temp = Temp::new(p.TEMP, irq); |
diff --git a/examples/nrf/src/bin/timer.rs b/examples/nrf/src/bin/timer.rs index 64376dd78..61ff1d6db 100644 --- a/examples/nrf/src/bin/timer.rs +++ b/examples/nrf/src/bin/timer.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::Peripherals; | 8 | use embassy_nrf::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::task] | 11 | #[embassy_executor::task] |
| 12 | async fn run1() { | 12 | async fn run1() { |
| 13 | loop { | 13 | loop { |
| 14 | info!("BIG INFREQUENT TICK"); | 14 | info!("BIG INFREQUENT TICK"); |
| @@ -16,7 +16,7 @@ async fn run1() { | |||
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #[embassy::task] | 19 | #[embassy_executor::task] |
| 20 | async fn run2() { | 20 | async fn run2() { |
| 21 | loop { | 21 | loop { |
| 22 | info!("tick"); | 22 | info!("tick"); |
| @@ -24,7 +24,7 @@ async fn run2() { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main] | 27 | #[embassy_executor::main] |
| 28 | async fn main(spawner: Spawner, _p: Peripherals) { | 28 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 29 | unwrap!(spawner.spawn(run1())); | 29 | unwrap!(spawner.spawn(run1())); |
| 30 | unwrap!(spawner.spawn(run2())); | 30 | unwrap!(spawner.spawn(run2())); |
diff --git a/examples/nrf/src/bin/twim.rs b/examples/nrf/src/bin/twim.rs index fb8372a12..bb7ee9db4 100644 --- a/examples/nrf/src/bin/twim.rs +++ b/examples/nrf/src/bin/twim.rs | |||
| @@ -7,14 +7,14 @@ | |||
| 7 | #![feature(type_alias_impl_trait)] | 7 | #![feature(type_alias_impl_trait)] |
| 8 | 8 | ||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::executor::Spawner; | 10 | use embassy_executor::executor::Spawner; |
| 11 | use embassy_nrf::twim::{self, Twim}; | 11 | use embassy_nrf::twim::{self, Twim}; |
| 12 | use embassy_nrf::{interrupt, Peripherals}; | 12 | use embassy_nrf::{interrupt, Peripherals}; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | const ADDRESS: u8 = 0x50; | 15 | const ADDRESS: u8 = 0x50; |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy_executor::main] |
| 18 | async fn main(_spawner: Spawner, p: Peripherals) { | 18 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 19 | info!("Initializing TWI..."); | 19 | info!("Initializing TWI..."); |
| 20 | let config = twim::Config::default(); | 20 | let config = twim::Config::default(); |
diff --git a/examples/nrf/src/bin/twim_lowpower.rs b/examples/nrf/src/bin/twim_lowpower.rs index c9c2d503e..ebf3d7109 100644 --- a/examples/nrf/src/bin/twim_lowpower.rs +++ b/examples/nrf/src/bin/twim_lowpower.rs | |||
| @@ -11,15 +11,15 @@ | |||
| 11 | use core::mem; | 11 | use core::mem; |
| 12 | 12 | ||
| 13 | use defmt::*; | 13 | use defmt::*; |
| 14 | use embassy::executor::Spawner; | 14 | use embassy_executor::executor::Spawner; |
| 15 | use embassy::time::{Duration, Timer}; | 15 | use embassy_executor::time::{Duration, Timer}; |
| 16 | use embassy_nrf::twim::{self, Twim}; | 16 | use embassy_nrf::twim::{self, Twim}; |
| 17 | use embassy_nrf::{interrupt, Peripherals}; | 17 | use embassy_nrf::{interrupt, Peripherals}; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 19 | ||
| 20 | const ADDRESS: u8 = 0x50; | 20 | const ADDRESS: u8 = 0x50; |
| 21 | 21 | ||
| 22 | #[embassy::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 23 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 24 | info!("Started!"); | 24 | info!("Started!"); |
| 25 | let mut irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); | 25 | let mut irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); |
diff --git a/examples/nrf/src/bin/uart.rs b/examples/nrf/src/bin/uart.rs index c8c4a67a5..5f363b69e 100644 --- a/examples/nrf/src/bin/uart.rs +++ b/examples/nrf/src/bin/uart.rs | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 12 | let mut config = uarte::Config::default(); | 12 | let mut config = uarte::Config::default(); |
| 13 | config.parity = uarte::Parity::EXCLUDED; | 13 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/uart_idle.rs b/examples/nrf/src/bin/uart_idle.rs index 6679b28da..0f455dffd 100644 --- a/examples/nrf/src/bin/uart_idle.rs +++ b/examples/nrf/src/bin/uart_idle.rs | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 7 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 12 | let mut config = uarte::Config::default(); | 12 | let mut config = uarte::Config::default(); |
| 13 | config.parity = uarte::Parity::EXCLUDED; | 13 | config.parity = uarte::Parity::EXCLUDED; |
diff --git a/examples/nrf/src/bin/uart_split.rs b/examples/nrf/src/bin/uart_split.rs index 1ffb63706..2de5f90c1 100644 --- a/examples/nrf/src/bin/uart_split.rs +++ b/examples/nrf/src/bin/uart_split.rs | |||
| @@ -3,17 +3,17 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::Channel; | ||
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy_nrf::peripherals::UARTE0; | 7 | use embassy_nrf::peripherals::UARTE0; |
| 10 | use embassy_nrf::uarte::UarteRx; | 8 | use embassy_nrf::uarte::UarteRx; |
| 11 | use embassy_nrf::{interrupt, uarte, Peripherals}; | 9 | use embassy_nrf::{interrupt, uarte, Peripherals}; |
| 10 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 11 | use embassy_util::channel::mpmc::Channel; | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); | 14 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(spawner: Spawner, p: Peripherals) { | 17 | async fn main(spawner: Spawner, p: Peripherals) { |
| 18 | let mut config = uarte::Config::default(); | 18 | let mut config = uarte::Config::default(); |
| 19 | config.parity = uarte::Parity::EXCLUDED; | 19 | config.parity = uarte::Parity::EXCLUDED; |
| @@ -48,7 +48,7 @@ async fn main(spawner: Spawner, p: Peripherals) { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | #[embassy::task] | 51 | #[embassy_executor::task] |
| 52 | async fn reader(mut rx: UarteRx<'static, UARTE0>) { | 52 | async fn reader(mut rx: UarteRx<'static, UARTE0>) { |
| 53 | let mut buf = [0; 8]; | 53 | let mut buf = [0; 8]; |
| 54 | loop { | 54 | loop { |
diff --git a/examples/nrf/src/bin/usb_ethernet.rs b/examples/nrf/src/bin/usb_ethernet.rs index e57cdaf63..93cb05907 100644 --- a/examples/nrf/src/bin/usb_ethernet.rs +++ b/examples/nrf/src/bin/usb_ethernet.rs | |||
| @@ -8,10 +8,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; | |||
| 8 | use core::task::Waker; | 8 | use core::task::Waker; |
| 9 | 9 | ||
| 10 | use defmt::*; | 10 | use defmt::*; |
| 11 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 11 | use embassy_executor::executor::Spawner; |
| 12 | use embassy::channel::mpmc::Channel; | ||
| 13 | use embassy::executor::Spawner; | ||
| 14 | use embassy::util::Forever; | ||
| 15 | use embassy_net::tcp::TcpSocket; | 12 | use embassy_net::tcp::TcpSocket; |
| 16 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; | 13 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; |
| 17 | use embassy_nrf::rng::Rng; | 14 | use embassy_nrf::rng::Rng; |
| @@ -19,6 +16,9 @@ use embassy_nrf::usb::{Driver, PowerUsb}; | |||
| 19 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; | 16 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; |
| 20 | use embassy_usb::{Builder, Config, UsbDevice}; | 17 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 21 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 18 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 19 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 20 | use embassy_util::channel::mpmc::Channel; | ||
| 21 | use embassy_util::Forever; | ||
| 22 | use embedded_io::asynch::{Read, Write}; | 22 | use embedded_io::asynch::{Read, Write}; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {defmt_rtt as _, panic_probe as _}; |
| 24 | 24 | ||
| @@ -32,12 +32,12 @@ macro_rules! forever { | |||
| 32 | }}; | 32 | }}; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #[embassy::task] | 35 | #[embassy_executor::task] |
| 36 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { | 36 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { |
| 37 | device.run().await | 37 | device.run().await |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | #[embassy::task] | 40 | #[embassy_executor::task] |
| 41 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | 41 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { |
| 42 | loop { | 42 | loop { |
| 43 | warn!("WAITING for connection"); | 43 | warn!("WAITING for connection"); |
| @@ -66,7 +66,7 @@ async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | |||
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | 70 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { |
| 71 | loop { | 71 | loop { |
| 72 | let pkt = TX_CHANNEL.recv().await; | 72 | let pkt = TX_CHANNEL.recv().await; |
| @@ -76,12 +76,12 @@ async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #[embassy::task] | 79 | #[embassy_executor::task] |
| 80 | async fn net_task(stack: &'static Stack<Device>) -> ! { | 80 | async fn net_task(stack: &'static Stack<Device>) -> ! { |
| 81 | stack.run().await | 81 | stack.run().await |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | #[embassy::main] | 84 | #[embassy_executor::main] |
| 85 | async fn main(spawner: Spawner, p: Peripherals) { | 85 | async fn main(spawner: Spawner, p: Peripherals) { |
| 86 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 86 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 87 | 87 | ||
diff --git a/examples/nrf/src/bin/usb_hid_keyboard.rs b/examples/nrf/src/bin/usb_hid_keyboard.rs index 539ae6f16..863f3e5dd 100644 --- a/examples/nrf/src/bin/usb_hid_keyboard.rs +++ b/examples/nrf/src/bin/usb_hid_keyboard.rs | |||
| @@ -7,23 +7,22 @@ use core::mem; | |||
| 7 | use core::sync::atomic::{AtomicBool, Ordering}; | 7 | use core::sync::atomic::{AtomicBool, Ordering}; |
| 8 | 8 | ||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::channel::signal::Signal; | 10 | use embassy_executor::executor::Spawner; |
| 11 | use embassy::executor::Spawner; | ||
| 12 | use embassy::time::Duration; | ||
| 13 | use embassy::util::{select, Either}; | ||
| 14 | use embassy_nrf::gpio::{Input, Pin, Pull}; | 11 | use embassy_nrf::gpio::{Input, Pin, Pull}; |
| 15 | use embassy_nrf::usb::{Driver, PowerUsb}; | 12 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 16 | use embassy_nrf::{interrupt, pac, Peripherals}; | 13 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 17 | use embassy_usb::control::OutResponse; | 14 | use embassy_usb::control::OutResponse; |
| 18 | use embassy_usb::{Builder, Config, DeviceStateHandler}; | 15 | use embassy_usb::{Builder, Config, DeviceStateHandler}; |
| 19 | use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State}; | 16 | use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State}; |
| 17 | use embassy_util::channel::signal::Signal; | ||
| 18 | use embassy_util::{select, Either}; | ||
| 20 | use futures::future::join; | 19 | use futures::future::join; |
| 21 | use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; | 20 | use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; |
| 22 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 22 | ||
| 24 | static SUSPENDED: AtomicBool = AtomicBool::new(false); | 23 | static SUSPENDED: AtomicBool = AtomicBool::new(false); |
| 25 | 24 | ||
| 26 | #[embassy::main] | 25 | #[embassy_executor::main] |
| 27 | async fn main(_spawner: Spawner, p: Peripherals) { | 26 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 28 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 27 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 29 | 28 | ||
| @@ -154,11 +153,11 @@ impl RequestHandler for MyRequestHandler { | |||
| 154 | OutResponse::Accepted | 153 | OutResponse::Accepted |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | fn set_idle(&self, id: Option<ReportId>, dur: Duration) { | 156 | fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) { |
| 158 | info!("Set idle rate for {:?} to {:?}", id, dur); | 157 | info!("Set idle rate for {:?} to {:?}", id, dur); |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { | 160 | fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> { |
| 162 | info!("Get idle rate for {:?}", id); | 161 | info!("Get idle rate for {:?}", id); |
| 163 | None | 162 | None |
| 164 | } | 163 | } |
diff --git a/examples/nrf/src/bin/usb_hid_mouse.rs b/examples/nrf/src/bin/usb_hid_mouse.rs index 516e7ea95..88bf87bd6 100644 --- a/examples/nrf/src/bin/usb_hid_mouse.rs +++ b/examples/nrf/src/bin/usb_hid_mouse.rs | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy::time::{Duration, Timer}; | 10 | use embassy_executor::time::{Duration, Timer}; |
| 11 | use embassy_nrf::usb::{Driver, PowerUsb}; | 11 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 12 | use embassy_nrf::{interrupt, pac, Peripherals}; | 12 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 13 | use embassy_usb::control::OutResponse; | 13 | use embassy_usb::control::OutResponse; |
| @@ -17,7 +17,7 @@ use futures::future::join; | |||
| 17 | use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; | 17 | use usbd_hid::descriptor::{MouseReport, SerializedDescriptor}; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 19 | ||
| 20 | #[embassy::main] | 20 | #[embassy_executor::main] |
| 21 | async fn main(_spawner: Spawner, p: Peripherals) { | 21 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 22 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 22 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 23 | 23 | ||
| @@ -113,11 +113,11 @@ impl RequestHandler for MyRequestHandler { | |||
| 113 | OutResponse::Accepted | 113 | OutResponse::Accepted |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | fn set_idle(&self, id: Option<ReportId>, dur: Duration) { | 116 | fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) { |
| 117 | info!("Set idle rate for {:?} to {:?}", id, dur); | 117 | info!("Set idle rate for {:?} to {:?}", id, dur); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { | 120 | fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> { |
| 121 | info!("Get idle rate for {:?}", id); | 121 | info!("Get idle rate for {:?}", id); |
| 122 | None | 122 | None |
| 123 | } | 123 | } |
diff --git a/examples/nrf/src/bin/usb_serial.rs b/examples/nrf/src/bin/usb_serial.rs index d2200dc5d..7d233d24d 100644 --- a/examples/nrf/src/bin/usb_serial.rs +++ b/examples/nrf/src/bin/usb_serial.rs | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::{info, panic}; | 8 | use defmt::{info, panic}; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy_nrf::usb::{Driver, Instance, PowerUsb, UsbSupply}; | 10 | use embassy_nrf::usb::{Driver, Instance, PowerUsb, UsbSupply}; |
| 11 | use embassy_nrf::{interrupt, pac, Peripherals}; | 11 | use embassy_nrf::{interrupt, pac, Peripherals}; |
| 12 | use embassy_usb::driver::EndpointError; | 12 | use embassy_usb::driver::EndpointError; |
| @@ -15,7 +15,7 @@ use embassy_usb_serial::{CdcAcmClass, State}; | |||
| 15 | use futures::future::join; | 15 | use futures::future::join; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) { | 19 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 20 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 20 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 21 | 21 | ||
diff --git a/examples/nrf/src/bin/usb_serial_multitask.rs b/examples/nrf/src/bin/usb_serial_multitask.rs index 3806da5a0..956315322 100644 --- a/examples/nrf/src/bin/usb_serial_multitask.rs +++ b/examples/nrf/src/bin/usb_serial_multitask.rs | |||
| @@ -6,23 +6,23 @@ | |||
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | 7 | ||
| 8 | use defmt::{info, panic, unwrap}; | 8 | use defmt::{info, panic, unwrap}; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy::util::Forever; | ||
| 11 | use embassy_nrf::usb::{Driver, PowerUsb}; | 10 | use embassy_nrf::usb::{Driver, PowerUsb}; |
| 12 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; | 11 | use embassy_nrf::{interrupt, pac, peripherals, Peripherals}; |
| 13 | use embassy_usb::driver::EndpointError; | 12 | use embassy_usb::driver::EndpointError; |
| 14 | use embassy_usb::{Builder, Config, UsbDevice}; | 13 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 15 | use embassy_usb_serial::{CdcAcmClass, State}; | 14 | use embassy_usb_serial::{CdcAcmClass, State}; |
| 15 | use embassy_util::Forever; | ||
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | type MyDriver = Driver<'static, peripherals::USBD, PowerUsb>; | 18 | type MyDriver = Driver<'static, peripherals::USBD, PowerUsb>; |
| 19 | 19 | ||
| 20 | #[embassy::task] | 20 | #[embassy_executor::task] |
| 21 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) { | 21 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) { |
| 22 | device.run().await; | 22 | device.run().await; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #[embassy::task] | 25 | #[embassy_executor::task] |
| 26 | async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { | 26 | async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { |
| 27 | loop { | 27 | loop { |
| 28 | class.wait_connection().await; | 28 | class.wait_connection().await; |
| @@ -32,7 +32,7 @@ async fn echo_task(mut class: CdcAcmClass<'static, MyDriver>) { | |||
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #[embassy::main] | 35 | #[embassy_executor::main] |
| 36 | async fn main(spawner: Spawner, p: Peripherals) { | 36 | async fn main(spawner: Spawner, p: Peripherals) { |
| 37 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; | 37 | let clock: pac::CLOCK = unsafe { mem::transmute(()) }; |
| 38 | 38 | ||
diff --git a/examples/nrf/src/bin/wdt.rs b/examples/nrf/src/bin/wdt.rs index 280e23bcf..560cb3567 100644 --- a/examples/nrf/src/bin/wdt.rs +++ b/examples/nrf/src/bin/wdt.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_nrf::gpio::{Input, Pull}; | 7 | use embassy_nrf::gpio::{Input, Pull}; |
| 8 | use embassy_nrf::wdt::{Config, Watchdog}; | 8 | use embassy_nrf::wdt::{Config, Watchdog}; |
| 9 | use embassy_nrf::Peripherals; | 9 | use embassy_nrf::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index d0704f203..94c3d8013 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -5,7 +5,8 @@ version = "0.1.0" | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime"] } | 8 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime"] } | ||
| 9 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } | 10 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } |
| 10 | atomic-polyfill = "0.1.5" | 11 | atomic-polyfill = "0.1.5" |
| 11 | 12 | ||
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs index 35612a4cf..e53fca1af 100644 --- a/examples/rp/src/bin/blinky.rs +++ b/examples/rp/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_rp::{gpio, Peripherals}; | 8 | use embassy_rp::{gpio, Peripherals}; |
| 9 | use gpio::{Level, Output}; | 9 | use gpio::{Level, Output}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | let mut led = Output::new(p.PIN_25, Level::Low); | 14 | let mut led = Output::new(p.PIN_25, Level::Low); |
| 15 | 15 | ||
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index 980e54ea1..02cbc9416 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 6 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 7 | use embassy_rp::Peripherals; | 7 | use embassy_rp::Peripherals; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| 10 | #[embassy::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 12 | let button = Input::new(p.PIN_28, Pull::Up); | 12 | let button = Input::new(p.PIN_28, Pull::Up); |
| 13 | let mut led = Output::new(p.PIN_25, Level::Low); | 13 | let mut led = Output::new(p.PIN_25, Level::Low); |
diff --git a/examples/rp/src/bin/gpio_async.rs b/examples/rp/src/bin/gpio_async.rs index e0f2aa961..ba905b015 100644 --- a/examples/rp/src/bin/gpio_async.rs +++ b/examples/rp/src/bin/gpio_async.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_rp::{gpio, Peripherals}; | 8 | use embassy_rp::{gpio, Peripherals}; |
| 9 | use gpio::{Input, Level, Output, Pull}; | 9 | use gpio::{Input, Level, Output, Pull}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -19,7 +19,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 19 | /// high signal on PIN 16. Once the high event/signal occurs the program will | 19 | /// high signal on PIN 16. Once the high event/signal occurs the program will |
| 20 | /// continue and turn off the LED, and then wait for 2 seconds before completing | 20 | /// continue and turn off the LED, and then wait for 2 seconds before completing |
| 21 | /// the loop and starting over again. | 21 | /// the loop and starting over again. |
| 22 | #[embassy::main] | 22 | #[embassy_executor::main] |
| 23 | async fn main(_spawner: Spawner, p: Peripherals) { | 23 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 24 | let mut led = Output::new(p.PIN_25, Level::Low); | 24 | let mut led = Output::new(p.PIN_25, Level::Low); |
| 25 | let mut async_input = Input::new(p.PIN_16, Pull::None); | 25 | let mut async_input = Input::new(p.PIN_16, Pull::None); |
diff --git a/examples/rp/src/bin/spi.rs b/examples/rp/src/bin/spi.rs index d97aa94b3..a3160c106 100644 --- a/examples/rp/src/bin/spi.rs +++ b/examples/rp/src/bin/spi.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_rp::spi::Spi; | 7 | use embassy_rp::spi::Spi; |
| 8 | use embassy_rp::{gpio, spi, Peripherals}; | 8 | use embassy_rp::{gpio, spi, Peripherals}; |
| 9 | use gpio::{Level, Output}; | 9 | use gpio::{Level, Output}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs index f4a411ba6..2760b23fa 100644 --- a/examples/rp/src/bin/spi_display.rs +++ b/examples/rp/src/bin/spi_display.rs | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | use core::cell::RefCell; | 5 | use core::cell::RefCell; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::Delay; | 9 | use embassy_executor::time::Delay; |
| 10 | use embassy_rp::gpio::{Level, Output}; | 10 | use embassy_rp::gpio::{Level, Output}; |
| 11 | use embassy_rp::spi::Spi; | 11 | use embassy_rp::spi::Spi; |
| 12 | use embassy_rp::{spi, Peripherals}; | 12 | use embassy_rp::{spi, Peripherals}; |
| @@ -27,7 +27,7 @@ use crate::touch::Touch; | |||
| 27 | //const DISPLAY_FREQ: u32 = 64_000_000; | 27 | //const DISPLAY_FREQ: u32 = 64_000_000; |
| 28 | const TOUCH_FREQ: u32 = 200_000; | 28 | const TOUCH_FREQ: u32 = 200_000; |
| 29 | 29 | ||
| 30 | #[embassy::main] | 30 | #[embassy_executor::main] |
| 31 | async fn main(_spawner: Spawner, p: Peripherals) { | 31 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 32 | info!("Hello World!"); | 32 | info!("Hello World!"); |
| 33 | 33 | ||
diff --git a/examples/rp/src/bin/uart.rs b/examples/rp/src/bin/uart.rs index 99072253a..0d2954894 100644 --- a/examples/rp/src/bin/uart.rs +++ b/examples/rp/src/bin/uart.rs | |||
| @@ -2,11 +2,11 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_rp::{uart, Peripherals}; | 6 | use embassy_rp::{uart, Peripherals}; |
| 7 | use {defmt_rtt as _, panic_probe as _}; | 7 | use {defmt_rtt as _, panic_probe as _}; |
| 8 | 8 | ||
| 9 | #[embassy::main] | 9 | #[embassy_executor::main] |
| 10 | async fn main(_spawner: Spawner, p: Peripherals) { | 10 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 11 | let config = uart::Config::default(); | 11 | let config = uart::Config::default(); |
| 12 | let mut uart = uart::Uart::new(p.UART0, p.PIN_0, p.PIN_1, p.PIN_2, p.PIN_3, config); | 12 | let mut uart = uart::Uart::new(p.UART0, p.PIN_0, p.PIN_1, p.PIN_2, p.PIN_3, config); |
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml index 8787f3c92..54499796b 100644 --- a/examples/std/Cargo.toml +++ b/examples/std/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-std-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["log", "std", "time", "nightly"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["log"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "time", "nightly"] } | ||
| 8 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "dhcpv4", "pool-16"] } | 9 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "dhcpv4", "pool-16"] } |
| 9 | embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] } | 10 | embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] } |
| 10 | 11 | ||
diff --git a/examples/std/src/bin/net.rs b/examples/std/src/bin/net.rs index 74073ee81..202585289 100644 --- a/examples/std/src/bin/net.rs +++ b/examples/std/src/bin/net.rs | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | #![feature(type_alias_impl_trait)] | 1 | #![feature(type_alias_impl_trait)] |
| 2 | 2 | ||
| 3 | use clap::Parser; | 3 | use clap::Parser; |
| 4 | use embassy::executor::{Executor, Spawner}; | 4 | use embassy_executor::executor::{Executor, Spawner}; |
| 5 | use embassy::util::Forever; | ||
| 6 | use embassy_net::tcp::TcpSocket; | 5 | use embassy_net::tcp::TcpSocket; |
| 7 | use embassy_net::{ConfigStrategy, Ipv4Address, Ipv4Cidr, Stack, StackResources}; | 6 | use embassy_net::{ConfigStrategy, Ipv4Address, Ipv4Cidr, Stack, StackResources}; |
| 7 | use embassy_util::Forever; | ||
| 8 | use embedded_io::asynch::Write; | 8 | use embedded_io::asynch::Write; |
| 9 | use heapless::Vec; | 9 | use heapless::Vec; |
| 10 | use log::*; | 10 | use log::*; |
| @@ -34,12 +34,12 @@ struct Opts { | |||
| 34 | static_ip: bool, | 34 | static_ip: bool, |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy::task] | 37 | #[embassy_executor::task] |
| 38 | async fn net_task(stack: &'static Stack<TunTapDevice>) -> ! { | 38 | async fn net_task(stack: &'static Stack<TunTapDevice>) -> ! { |
| 39 | stack.run().await | 39 | stack.run().await |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | #[embassy::task] | 42 | #[embassy_executor::task] |
| 43 | async fn main_task(spawner: Spawner) { | 43 | async fn main_task(spawner: Spawner) { |
| 44 | let opts: Opts = Opts::parse(); | 44 | let opts: Opts = Opts::parse(); |
| 45 | 45 | ||
diff --git a/examples/std/src/bin/serial.rs b/examples/std/src/bin/serial.rs index b1e5b0142..b803d1ef7 100644 --- a/examples/std/src/bin/serial.rs +++ b/examples/std/src/bin/serial.rs | |||
| @@ -4,15 +4,15 @@ | |||
| 4 | mod serial_port; | 4 | mod serial_port; |
| 5 | 5 | ||
| 6 | use async_io::Async; | 6 | use async_io::Async; |
| 7 | use embassy::executor::Executor; | 7 | use embassy_executor::executor::Executor; |
| 8 | use embassy::util::Forever; | 8 | use embassy_util::Forever; |
| 9 | use embedded_io::asynch::Read; | 9 | use embedded_io::asynch::Read; |
| 10 | use log::*; | 10 | use log::*; |
| 11 | use nix::sys::termios; | 11 | use nix::sys::termios; |
| 12 | 12 | ||
| 13 | use self::serial_port::SerialPort; | 13 | use self::serial_port::SerialPort; |
| 14 | 14 | ||
| 15 | #[embassy::task] | 15 | #[embassy_executor::task] |
| 16 | async fn run() { | 16 | async fn run() { |
| 17 | // Open the serial port. | 17 | // Open the serial port. |
| 18 | let baudrate = termios::BaudRate::B115200; | 18 | let baudrate = termios::BaudRate::B115200; |
diff --git a/examples/std/src/bin/tick.rs b/examples/std/src/bin/tick.rs index bed9d7dc5..9ca900df8 100644 --- a/examples/std/src/bin/tick.rs +++ b/examples/std/src/bin/tick.rs | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | #![feature(type_alias_impl_trait)] | 1 | #![feature(type_alias_impl_trait)] |
| 2 | 2 | ||
| 3 | use embassy::executor::Spawner; | 3 | use embassy_executor::executor::Spawner; |
| 4 | use embassy::time::{Duration, Timer}; | 4 | use embassy_executor::time::{Duration, Timer}; |
| 5 | use log::*; | 5 | use log::*; |
| 6 | 6 | ||
| 7 | #[embassy::task] | 7 | #[embassy_executor::task] |
| 8 | async fn run() { | 8 | async fn run() { |
| 9 | loop { | 9 | loop { |
| 10 | info!("tick"); | 10 | info!("tick"); |
| @@ -12,7 +12,7 @@ async fn run() { | |||
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(spawner: Spawner) { | 16 | async fn main(spawner: Spawner) { |
| 17 | env_logger::builder() | 17 | env_logger::builder() |
| 18 | .filter_level(log::LevelFilter::Debug) | 18 | .filter_level(log::LevelFilter::Debug) |
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml index 615803258..3ba297636 100644 --- a/examples/stm32f0/Cargo.toml +++ b/examples/stm32f0/Cargo.toml | |||
| @@ -11,6 +11,7 @@ cortex-m-rt = "0.7.0" | |||
| 11 | defmt = "0.3" | 11 | defmt = "0.3" |
| 12 | defmt-rtt = "0.3" | 12 | defmt-rtt = "0.3" |
| 13 | panic-probe = "0.3" | 13 | panic-probe = "0.3" |
| 14 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 14 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 15 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 15 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f030f4", "time-driver-any"] } | 16 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f030f4", "time-driver-any"] } |
| 16 | 17 | ||
diff --git a/examples/stm32f0/src/bin/hello.rs b/examples/stm32f0/src/bin/hello.rs index 225f1c3ae..c9081ea12 100644 --- a/examples/stm32f0/src/bin/hello.rs +++ b/examples/stm32f0/src/bin/hello.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 12 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 13 | loop { | 13 | loop { |
| 14 | Timer::after(Duration::from_secs(1)).await; | 14 | Timer::after(Duration::from_secs(1)).await; |
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml index fb0e605d6..9ce553b6d 100644 --- a/examples/stm32f1/Cargo.toml +++ b/examples/stm32f1/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32f1-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] } |
| 9 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 10 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 10 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } | 11 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } |
diff --git a/examples/stm32f1/src/bin/adc.rs b/examples/stm32f1/src/bin/adc.rs index 09904d4cc..e54593fe5 100644 --- a/examples/stm32f1/src/bin/adc.rs +++ b/examples/stm32f1/src/bin/adc.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Delay, Duration, Timer}; | 7 | use embassy_executor::time::{Delay, Duration, Timer}; |
| 8 | use embassy_stm32::adc::Adc; | 8 | use embassy_stm32::adc::Adc; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f1/src/bin/blinky.rs b/examples/stm32f1/src/bin/blinky.rs index c98d0cdad..5171043e8 100644 --- a/examples/stm32f1/src/bin/blinky.rs +++ b/examples/stm32f1/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f1/src/bin/hello.rs b/examples/stm32f1/src/bin/hello.rs index 82f11bc28..549d1bfba 100644 --- a/examples/stm32f1/src/bin/hello.rs +++ b/examples/stm32f1/src/bin/hello.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 20 | loop { | 20 | loop { |
| 21 | info!("Hello World!"); | 21 | info!("Hello World!"); |
diff --git a/examples/stm32f1/src/bin/usb_serial.rs b/examples/stm32f1/src/bin/usb_serial.rs index d06315d76..cf7facb79 100644 --- a/examples/stm32f1/src/bin/usb_serial.rs +++ b/examples/stm32f1/src/bin/usb_serial.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{panic, *}; | 5 | use defmt::{panic, *}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::time::Hertz; | 9 | use embassy_stm32::time::Hertz; |
| 10 | use embassy_stm32::usb::{Driver, Instance}; | 10 | use embassy_stm32::usb::{Driver, Instance}; |
| @@ -23,7 +23,7 @@ fn config() -> Config { | |||
| 23 | config | 23 | config |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | #[embassy::main(config = "config()")] | 26 | #[embassy_executor::main(config = "config()")] |
| 27 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 27 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 28 | info!("Hello World!"); | 28 | info!("Hello World!"); |
| 29 | 29 | ||
diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml index 6ea6add17..a3fb736da 100644 --- a/examples/stm32f2/Cargo.toml +++ b/examples/stm32f2/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32f2-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] } |
| 9 | 10 | ||
| 10 | defmt = "0.3" | 11 | defmt = "0.3" |
diff --git a/examples/stm32f2/src/bin/blinky.rs b/examples/stm32f2/src/bin/blinky.rs index dd20ba85a..48ae2e711 100644 --- a/examples/stm32f2/src/bin/blinky.rs +++ b/examples/stm32f2/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f2/src/bin/pll.rs b/examples/stm32f2/src/bin/pll.rs index b09d64b0b..01e63b15e 100644 --- a/examples/stm32f2/src/bin/pll.rs +++ b/examples/stm32f2/src/bin/pll.rs | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | use core::convert::TryFrom; | 5 | use core::convert::TryFrom; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Timer}; | 9 | use embassy_executor::time::{Duration, Timer}; |
| 10 | use embassy_stm32::rcc::{ | 10 | use embassy_stm32::rcc::{ |
| 11 | APBPrescaler, ClockSrc, HSEConfig, HSESrc, PLL48Div, PLLConfig, PLLMainDiv, PLLMul, PLLPreDiv, PLLSrc, | 11 | APBPrescaler, ClockSrc, HSEConfig, HSESrc, PLL48Div, PLLConfig, PLLMainDiv, PLLMul, PLLPreDiv, PLLSrc, |
| 12 | }; | 12 | }; |
| @@ -43,7 +43,7 @@ fn config() -> Config { | |||
| 43 | config | 43 | config |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | #[embassy::main(config = "config()")] | 46 | #[embassy_executor::main(config = "config()")] |
| 47 | async fn main(_spawner: Spawner, _p: Peripherals) { | 47 | async fn main(_spawner: Spawner, _p: Peripherals) { |
| 48 | loop { | 48 | loop { |
| 49 | Timer::after(Duration::from_millis(1000)).await; | 49 | Timer::after(Duration::from_millis(1000)).await; |
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml index 6912ba765..410e9b3e0 100644 --- a/examples/stm32f3/Cargo.toml +++ b/examples/stm32f3/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32f3-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] } |
| 9 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 10 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 10 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } | 11 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } |
diff --git a/examples/stm32f3/src/bin/blinky.rs b/examples/stm32f3/src/bin/blinky.rs index 4d0b33f61..7146eaa54 100644 --- a/examples/stm32f3/src/bin/blinky.rs +++ b/examples/stm32f3/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 45862ddc6..ef5110316 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs | |||
| @@ -11,14 +11,14 @@ | |||
| 11 | #![feature(type_alias_impl_trait)] | 11 | #![feature(type_alias_impl_trait)] |
| 12 | 12 | ||
| 13 | use defmt::*; | 13 | use defmt::*; |
| 14 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 14 | use embassy_executor::executor::Spawner; |
| 15 | use embassy::channel::mpmc::Channel; | 15 | use embassy_executor::time::{with_timeout, Duration, Timer}; |
| 16 | use embassy::executor::Spawner; | ||
| 17 | use embassy::time::{with_timeout, Duration, Timer}; | ||
| 18 | use embassy_stm32::exti::ExtiInput; | 16 | use embassy_stm32::exti::ExtiInput; |
| 19 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; | 17 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; |
| 20 | use embassy_stm32::peripherals::PA0; | 18 | use embassy_stm32::peripherals::PA0; |
| 21 | use embassy_stm32::Peripherals; | 19 | use embassy_stm32::Peripherals; |
| 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 21 | use embassy_util::channel::mpmc::Channel; | ||
| 22 | use {defmt_rtt as _, panic_probe as _}; | 22 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 23 | ||
| 24 | struct Leds<'a> { | 24 | struct Leds<'a> { |
| @@ -99,7 +99,7 @@ enum ButtonEvent { | |||
| 99 | 99 | ||
| 100 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); | 100 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); |
| 101 | 101 | ||
| 102 | #[embassy::main] | 102 | #[embassy_executor::main] |
| 103 | async fn main(spawner: Spawner, p: Peripherals) { | 103 | async fn main(spawner: Spawner, p: Peripherals) { |
| 104 | let button = Input::new(p.PA0, Pull::Down); | 104 | let button = Input::new(p.PA0, Pull::Down); |
| 105 | let button = ExtiInput::new(button, p.EXTI0); | 105 | let button = ExtiInput::new(button, p.EXTI0); |
| @@ -120,14 +120,14 @@ async fn main(spawner: Spawner, p: Peripherals) { | |||
| 120 | spawner.spawn(led_blinker(leds)).unwrap(); | 120 | spawner.spawn(led_blinker(leds)).unwrap(); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | #[embassy::task] | 123 | #[embassy_executor::task] |
| 124 | async fn led_blinker(mut leds: Leds<'static>) { | 124 | async fn led_blinker(mut leds: Leds<'static>) { |
| 125 | loop { | 125 | loop { |
| 126 | leds.show().await; | 126 | leds.show().await; |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | #[embassy::task] | 130 | #[embassy_executor::task] |
| 131 | async fn button_waiter(mut button: ExtiInput<'static, PA0>) { | 131 | async fn button_waiter(mut button: ExtiInput<'static, PA0>) { |
| 132 | const DOUBLE_CLICK_DELAY: u64 = 250; | 132 | const DOUBLE_CLICK_DELAY: u64 = 250; |
| 133 | const HOLD_DELAY: u64 = 1000; | 133 | const HOLD_DELAY: u64 = 1000; |
diff --git a/examples/stm32f3/src/bin/button_exti.rs b/examples/stm32f3/src/bin/button_exti.rs index add6712b4..dee06e5de 100644 --- a/examples/stm32f3/src/bin/button_exti.rs +++ b/examples/stm32f3/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f3/src/bin/flash.rs b/examples/stm32f3/src/bin/flash.rs index ce16f6de7..be2f6f671 100644 --- a/examples/stm32f3/src/bin/flash.rs +++ b/examples/stm32f3/src/bin/flash.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f3/src/bin/hello.rs b/examples/stm32f3/src/bin/hello.rs index 3b89f1c72..bd9953a0e 100644 --- a/examples/stm32f3/src/bin/hello.rs +++ b/examples/stm32f3/src/bin/hello.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -16,7 +16,7 @@ fn config() -> Config { | |||
| 16 | config | 16 | config |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #[embassy::main(config = "config()")] | 19 | #[embassy_executor::main(config = "config()")] |
| 20 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 20 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 21 | loop { | 21 | loop { |
| 22 | info!("Hello World!"); | 22 | info!("Hello World!"); |
diff --git a/examples/stm32f3/src/bin/multiprio.rs b/examples/stm32f3/src/bin/multiprio.rs index 4f2cf9a6f..fba5b286e 100644 --- a/examples/stm32f3/src/bin/multiprio.rs +++ b/examples/stm32f3/src/bin/multiprio.rs | |||
| @@ -59,14 +59,14 @@ | |||
| 59 | 59 | ||
| 60 | use cortex_m_rt::entry; | 60 | use cortex_m_rt::entry; |
| 61 | use defmt::*; | 61 | use defmt::*; |
| 62 | use embassy::time::{Duration, Instant, Timer}; | 62 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 63 | use embassy::util::Forever; | ||
| 64 | use embassy_stm32::executor::{Executor, InterruptExecutor}; | 63 | use embassy_stm32::executor::{Executor, InterruptExecutor}; |
| 65 | use embassy_stm32::interrupt; | 64 | use embassy_stm32::interrupt; |
| 66 | use embassy_stm32::interrupt::InterruptExt; | 65 | use embassy_stm32::interrupt::InterruptExt; |
| 66 | use embassy_util::Forever; | ||
| 67 | use {defmt_rtt as _, panic_probe as _}; | 67 | use {defmt_rtt as _, panic_probe as _}; |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn run_high() { | 70 | async fn run_high() { |
| 71 | loop { | 71 | loop { |
| 72 | info!(" [high] tick!"); | 72 | info!(" [high] tick!"); |
| @@ -74,7 +74,7 @@ async fn run_high() { | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #[embassy::task] | 77 | #[embassy_executor::task] |
| 78 | async fn run_med() { | 78 | async fn run_med() { |
| 79 | loop { | 79 | loop { |
| 80 | let start = Instant::now(); | 80 | let start = Instant::now(); |
| @@ -91,7 +91,7 @@ async fn run_med() { | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | #[embassy::task] | 94 | #[embassy_executor::task] |
| 95 | async fn run_low() { | 95 | async fn run_low() { |
| 96 | loop { | 96 | loop { |
| 97 | let start = Instant::now(); | 97 | let start = Instant::now(); |
diff --git a/examples/stm32f3/src/bin/spi_dma.rs b/examples/stm32f3/src/bin/spi_dma.rs index ece1ae6fe..f554c509a 100644 --- a/examples/stm32f3/src/bin/spi_dma.rs +++ b/examples/stm32f3/src/bin/spi_dma.rs | |||
| @@ -6,14 +6,14 @@ use core::fmt::Write; | |||
| 6 | use core::str::from_utf8; | 6 | use core::str::from_utf8; |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy_stm32::spi::{Config, Spi}; | 10 | use embassy_stm32::spi::{Config, Spi}; |
| 11 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 13 | use heapless::String; | 13 | use heapless::String; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | info!("Hello World!"); | 18 | info!("Hello World!"); |
| 19 | 19 | ||
diff --git a/examples/stm32f3/src/bin/usart_dma.rs b/examples/stm32f3/src/bin/usart_dma.rs index 4660f812e..62d165029 100644 --- a/examples/stm32f3/src/bin/usart_dma.rs +++ b/examples/stm32f3/src/bin/usart_dma.rs | |||
| @@ -5,14 +5,14 @@ | |||
| 5 | use core::fmt::Write; | 5 | use core::fmt::Write; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use heapless::String; | 12 | use heapless::String; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
diff --git a/examples/stm32f3/src/bin/usb_serial.rs b/examples/stm32f3/src/bin/usb_serial.rs index 463d561ec..87b1138f5 100644 --- a/examples/stm32f3/src/bin/usb_serial.rs +++ b/examples/stm32f3/src/bin/usb_serial.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{panic, *}; | 5 | use defmt::{panic, *}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::time::mhz; | 9 | use embassy_stm32::time::mhz; |
| 10 | use embassy_stm32::usb::{Driver, Instance}; | 10 | use embassy_stm32::usb::{Driver, Instance}; |
| @@ -27,7 +27,7 @@ fn config() -> Config { | |||
| 27 | config | 27 | config |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[embassy::main(config = "config()")] | 30 | #[embassy_executor::main(config = "config()")] |
| 31 | async fn main(_spawner: Spawner, p: Peripherals) { | 31 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 32 | info!("Hello World!"); | 32 | info!("Hello World!"); |
| 33 | 33 | ||
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index 100c0e608..37464b1e0 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml | |||
| @@ -5,7 +5,8 @@ version = "0.1.0" | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "time-tick-32768hz"] } | 8 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "time-tick-32768hz"] } | ||
| 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } | 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } |
| 10 | 11 | ||
| 11 | defmt = "0.3" | 12 | defmt = "0.3" |
diff --git a/examples/stm32f4/src/bin/adc.rs b/examples/stm32f4/src/bin/adc.rs index 84ddbfd3c..27ed4fcc5 100644 --- a/examples/stm32f4/src/bin/adc.rs +++ b/examples/stm32f4/src/bin/adc.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Delay, Duration, Timer}; | 7 | use embassy_executor::time::{Delay, Duration, Timer}; |
| 8 | use embassy_stm32::adc::Adc; | 8 | use embassy_stm32::adc::Adc; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f4/src/bin/blinky.rs b/examples/stm32f4/src/bin/blinky.rs index 907492b3d..f71fe0989 100644 --- a/examples/stm32f4/src/bin/blinky.rs +++ b/examples/stm32f4/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs index 24ece9927..60dfb362b 100644 --- a/examples/stm32f4/src/bin/button_exti.rs +++ b/examples/stm32f4/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f4/src/bin/flash.rs b/examples/stm32f4/src/bin/flash.rs index 13fd2c90b..4f780656e 100644 --- a/examples/stm32f4/src/bin/flash.rs +++ b/examples/stm32f4/src/bin/flash.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f4/src/bin/hello.rs b/examples/stm32f4/src/bin/hello.rs index 8e69e89d1..f957656ef 100644 --- a/examples/stm32f4/src/bin/hello.rs +++ b/examples/stm32f4/src/bin/hello.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 20 | loop { | 20 | loop { |
| 21 | info!("Hello World!"); | 21 | info!("Hello World!"); |
diff --git a/examples/stm32f4/src/bin/multiprio.rs b/examples/stm32f4/src/bin/multiprio.rs index 4f2cf9a6f..fba5b286e 100644 --- a/examples/stm32f4/src/bin/multiprio.rs +++ b/examples/stm32f4/src/bin/multiprio.rs | |||
| @@ -59,14 +59,14 @@ | |||
| 59 | 59 | ||
| 60 | use cortex_m_rt::entry; | 60 | use cortex_m_rt::entry; |
| 61 | use defmt::*; | 61 | use defmt::*; |
| 62 | use embassy::time::{Duration, Instant, Timer}; | 62 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 63 | use embassy::util::Forever; | ||
| 64 | use embassy_stm32::executor::{Executor, InterruptExecutor}; | 63 | use embassy_stm32::executor::{Executor, InterruptExecutor}; |
| 65 | use embassy_stm32::interrupt; | 64 | use embassy_stm32::interrupt; |
| 66 | use embassy_stm32::interrupt::InterruptExt; | 65 | use embassy_stm32::interrupt::InterruptExt; |
| 66 | use embassy_util::Forever; | ||
| 67 | use {defmt_rtt as _, panic_probe as _}; | 67 | use {defmt_rtt as _, panic_probe as _}; |
| 68 | 68 | ||
| 69 | #[embassy::task] | 69 | #[embassy_executor::task] |
| 70 | async fn run_high() { | 70 | async fn run_high() { |
| 71 | loop { | 71 | loop { |
| 72 | info!(" [high] tick!"); | 72 | info!(" [high] tick!"); |
| @@ -74,7 +74,7 @@ async fn run_high() { | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #[embassy::task] | 77 | #[embassy_executor::task] |
| 78 | async fn run_med() { | 78 | async fn run_med() { |
| 79 | loop { | 79 | loop { |
| 80 | let start = Instant::now(); | 80 | let start = Instant::now(); |
| @@ -91,7 +91,7 @@ async fn run_med() { | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | #[embassy::task] | 94 | #[embassy_executor::task] |
| 95 | async fn run_low() { | 95 | async fn run_low() { |
| 96 | loop { | 96 | loop { |
| 97 | let start = Instant::now(); | 97 | let start = Instant::now(); |
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs index b39bbbe28..0b352c2b7 100644 --- a/examples/stm32f4/src/bin/pwm.rs +++ b/examples/stm32f4/src/bin/pwm.rs | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; | 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; |
| 9 | use embassy_stm32::pwm::Channel; | 9 | use embassy_stm32::pwm::Channel; |
| 10 | use embassy_stm32::time::khz; | 10 | use embassy_stm32::time::khz; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 17 | 17 | ||
diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs index 752ad57bf..6eef19963 100644 --- a/examples/stm32f4/src/bin/sdmmc.rs +++ b/examples/stm32f4/src/bin/sdmmc.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::sdmmc::Sdmmc; | 7 | use embassy_stm32::sdmmc::Sdmmc; |
| 8 | use embassy_stm32::time::mhz; | 8 | use embassy_stm32::time::mhz; |
| 9 | use embassy_stm32::{interrupt, Config, Peripherals}; | 9 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | 21 | ||
diff --git a/examples/stm32f4/src/bin/spi_dma.rs b/examples/stm32f4/src/bin/spi_dma.rs index f3c0f2cd5..023ca0971 100644 --- a/examples/stm32f4/src/bin/spi_dma.rs +++ b/examples/stm32f4/src/bin/spi_dma.rs | |||
| @@ -6,14 +6,14 @@ use core::fmt::Write; | |||
| 6 | use core::str::from_utf8; | 6 | use core::str::from_utf8; |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy_stm32::spi::{Config, Spi}; | 10 | use embassy_stm32::spi::{Config, Spi}; |
| 11 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 13 | use heapless::String; | 13 | use heapless::String; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | info!("Hello World!"); | 18 | info!("Hello World!"); |
| 19 | 19 | ||
diff --git a/examples/stm32f4/src/bin/usart_buffered.rs b/examples/stm32f4/src/bin/usart_buffered.rs index 039e43bd2..2555998ce 100644 --- a/examples/stm32f4/src/bin/usart_buffered.rs +++ b/examples/stm32f4/src/bin/usart_buffered.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::usart::{BufferedUart, Config, State, Uart}; | 8 | use embassy_stm32::usart::{BufferedUart, Config, State, Uart}; |
| 9 | use embassy_stm32::{interrupt, Peripherals}; | 9 | use embassy_stm32::{interrupt, Peripherals}; |
| 10 | use embedded_io::asynch::BufRead; | 10 | use embedded_io::asynch::BufRead; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/examples/stm32f4/src/bin/usart_dma.rs b/examples/stm32f4/src/bin/usart_dma.rs index 8d06f8439..7859ba2ae 100644 --- a/examples/stm32f4/src/bin/usart_dma.rs +++ b/examples/stm32f4/src/bin/usart_dma.rs | |||
| @@ -5,14 +5,14 @@ | |||
| 5 | use core::fmt::Write; | 5 | use core::fmt::Write; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use heapless::String; | 12 | use heapless::String; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
diff --git a/examples/stm32f4/src/bin/wdt.rs b/examples/stm32f4/src/bin/wdt.rs index bfc487c31..48394f4f1 100644 --- a/examples/stm32f4/src/bin/wdt.rs +++ b/examples/stm32f4/src/bin/wdt.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::wdg::IndependentWatchdog; | 9 | use embassy_stm32::wdg::IndependentWatchdog; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml index b0a548a3f..081bed84f 100644 --- a/examples/stm32f7/Cargo.toml +++ b/examples/stm32f7/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32f7-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } |
| 9 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 10 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 10 | embedded-io = { version = "0.3.0", features = ["async"] } | 11 | embedded-io = { version = "0.3.0", features = ["async"] } |
diff --git a/examples/stm32f7/src/bin/adc.rs b/examples/stm32f7/src/bin/adc.rs index fc8359622..2a813c050 100644 --- a/examples/stm32f7/src/bin/adc.rs +++ b/examples/stm32f7/src/bin/adc.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Delay, Duration, Timer}; | 7 | use embassy_executor::time::{Delay, Duration, Timer}; |
| 8 | use embassy_stm32::adc::Adc; | 8 | use embassy_stm32::adc::Adc; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f7/src/bin/blinky.rs b/examples/stm32f7/src/bin/blinky.rs index 907492b3d..f71fe0989 100644 --- a/examples/stm32f7/src/bin/blinky.rs +++ b/examples/stm32f7/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f7/src/bin/button_exti.rs b/examples/stm32f7/src/bin/button_exti.rs index 24ece9927..60dfb362b 100644 --- a/examples/stm32f7/src/bin/button_exti.rs +++ b/examples/stm32f7/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32f7/src/bin/eth.rs b/examples/stm32f7/src/bin/eth.rs index 177683c3a..33504af76 100644 --- a/examples/stm32f7/src/bin/eth.rs +++ b/examples/stm32f7/src/bin/eth.rs | |||
| @@ -3,9 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::util::Forever; | ||
| 9 | use embassy_net::tcp::TcpSocket; | 8 | use embassy_net::tcp::TcpSocket; |
| 10 | use embassy_net::{Ipv4Address, Stack, StackResources}; | 9 | use embassy_net::{Ipv4Address, Stack, StackResources}; |
| 11 | use embassy_stm32::eth::generic_smi::GenericSMI; | 10 | use embassy_stm32::eth::generic_smi::GenericSMI; |
| @@ -14,6 +13,7 @@ use embassy_stm32::peripherals::ETH; | |||
| 14 | use embassy_stm32::rng::Rng; | 13 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::time::mhz; | 14 | use embassy_stm32::time::mhz; |
| 16 | use embassy_stm32::{interrupt, Config, Peripherals}; | 15 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| 16 | use embassy_util::Forever; | ||
| 17 | use embedded_io::asynch::Write; | 17 | use embedded_io::asynch::Write; |
| 18 | use rand_core::RngCore; | 18 | use rand_core::RngCore; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 19 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -28,7 +28,7 @@ macro_rules! forever { | |||
| 28 | 28 | ||
| 29 | type Device = Ethernet<'static, ETH, GenericSMI, 4, 4>; | 29 | type Device = Ethernet<'static, ETH, GenericSMI, 4, 4>; |
| 30 | 30 | ||
| 31 | #[embassy::task] | 31 | #[embassy_executor::task] |
| 32 | async fn net_task(stack: &'static Stack<Device>) -> ! { | 32 | async fn net_task(stack: &'static Stack<Device>) -> ! { |
| 33 | stack.run().await | 33 | stack.run().await |
| 34 | } | 34 | } |
| @@ -39,7 +39,7 @@ fn config() -> Config { | |||
| 39 | config | 39 | config |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | #[embassy::main(config = "config()")] | 42 | #[embassy_executor::main(config = "config()")] |
| 43 | async fn main(spawner: Spawner, p: Peripherals) -> ! { | 43 | async fn main(spawner: Spawner, p: Peripherals) -> ! { |
| 44 | info!("Hello World!"); | 44 | info!("Hello World!"); |
| 45 | 45 | ||
diff --git a/examples/stm32f7/src/bin/flash.rs b/examples/stm32f7/src/bin/flash.rs index af66275d4..15864cabb 100644 --- a/examples/stm32f7/src/bin/flash.rs +++ b/examples/stm32f7/src/bin/flash.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::flash::Flash; | 8 | use embassy_stm32::flash::Flash; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello Flash!"); | 15 | info!("Hello Flash!"); |
| 16 | 16 | ||
diff --git a/examples/stm32f7/src/bin/hello.rs b/examples/stm32f7/src/bin/hello.rs index 8e69e89d1..f957656ef 100644 --- a/examples/stm32f7/src/bin/hello.rs +++ b/examples/stm32f7/src/bin/hello.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 20 | loop { | 20 | loop { |
| 21 | info!("Hello World!"); | 21 | info!("Hello World!"); |
diff --git a/examples/stm32f7/src/bin/sdmmc.rs b/examples/stm32f7/src/bin/sdmmc.rs index be1c2b152..1f321df17 100644 --- a/examples/stm32f7/src/bin/sdmmc.rs +++ b/examples/stm32f7/src/bin/sdmmc.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::sdmmc::Sdmmc; | 7 | use embassy_stm32::sdmmc::Sdmmc; |
| 8 | use embassy_stm32::time::mhz; | 8 | use embassy_stm32::time::mhz; |
| 9 | use embassy_stm32::{interrupt, Config, Peripherals}; | 9 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | 21 | ||
diff --git a/examples/stm32f7/src/bin/usart_dma.rs b/examples/stm32f7/src/bin/usart_dma.rs index d8551620c..9884d1634 100644 --- a/examples/stm32f7/src/bin/usart_dma.rs +++ b/examples/stm32f7/src/bin/usart_dma.rs | |||
| @@ -5,14 +5,14 @@ | |||
| 5 | use core::fmt::Write; | 5 | use core::fmt::Write; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use heapless::String; | 12 | use heapless::String; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | let config = Config::default(); | 17 | let config = Config::default(); |
| 18 | let mut usart = Uart::new(p.UART7, p.PA8, p.PA15, p.DMA1_CH1, NoDma, config); | 18 | let mut usart = Uart::new(p.UART7, p.PA8, p.PA15, p.DMA1_CH1, NoDma, config); |
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml index bf23fa822..3dedeac63 100644 --- a/examples/stm32g0/Cargo.toml +++ b/examples/stm32g0/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32g0-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] } |
| 9 | 10 | ||
| 10 | defmt = "0.3" | 11 | defmt = "0.3" |
diff --git a/examples/stm32g0/src/bin/blinky.rs b/examples/stm32g0/src/bin/blinky.rs index 907492b3d..f71fe0989 100644 --- a/examples/stm32g0/src/bin/blinky.rs +++ b/examples/stm32g0/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32g0/src/bin/button_exti.rs b/examples/stm32g0/src/bin/button_exti.rs index 924feeb33..0832386ed 100644 --- a/examples/stm32g0/src/bin/button_exti.rs +++ b/examples/stm32g0/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml index d3641c489..60c62ad1e 100644 --- a/examples/stm32g4/Cargo.toml +++ b/examples/stm32g4/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32g4-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] } |
| 9 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } | 10 | embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } |
| 10 | 11 | ||
diff --git a/examples/stm32g4/src/bin/blinky.rs b/examples/stm32g4/src/bin/blinky.rs index cd4883276..ea3c563b4 100644 --- a/examples/stm32g4/src/bin/blinky.rs +++ b/examples/stm32g4/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32g4/src/bin/button_exti.rs b/examples/stm32g4/src/bin/button_exti.rs index 24ece9927..60dfb362b 100644 --- a/examples/stm32g4/src/bin/button_exti.rs +++ b/examples/stm32g4/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32g4/src/bin/pwm.rs b/examples/stm32g4/src/bin/pwm.rs index dc4e164ab..7c16d0a3a 100644 --- a/examples/stm32g4/src/bin/pwm.rs +++ b/examples/stm32g4/src/bin/pwm.rs | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; | 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; |
| 9 | use embassy_stm32::pwm::Channel; | 9 | use embassy_stm32::pwm::Channel; |
| 10 | use embassy_stm32::time::khz; | 10 | use embassy_stm32::time::khz; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 17 | 17 | ||
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index d905031d6..8b1999b30 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32h7-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } |
| 9 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 10 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 10 | embedded-io = { version = "0.3.0", features = ["async"] } | 11 | embedded-io = { version = "0.3.0", features = ["async"] } |
diff --git a/examples/stm32h7/src/bin/adc.rs b/examples/stm32h7/src/bin/adc.rs index d8a5d23d7..f50976a30 100644 --- a/examples/stm32h7/src/bin/adc.rs +++ b/examples/stm32h7/src/bin/adc.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Delay, Duration, Timer}; | 7 | use embassy_executor::time::{Delay, Duration, Timer}; |
| 8 | use embassy_stm32::adc::{Adc, SampleTime}; | 8 | use embassy_stm32::adc::{Adc, SampleTime}; |
| 9 | use embassy_stm32::rcc::AdcClockSource; | 9 | use embassy_stm32::rcc::AdcClockSource; |
| 10 | use embassy_stm32::time::mhz; | 10 | use embassy_stm32::time::mhz; |
| @@ -20,7 +20,7 @@ pub fn config() -> Config { | |||
| 20 | config | 20 | config |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | #[embassy::main(config = "config()")] | 23 | #[embassy_executor::main(config = "config()")] |
| 24 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 24 | async fn main(_spawner: Spawner, mut p: Peripherals) { |
| 25 | info!("Hello World!"); | 25 | info!("Hello World!"); |
| 26 | 26 | ||
diff --git a/examples/stm32h7/src/bin/blinky.rs b/examples/stm32h7/src/bin/blinky.rs index 7982f4a0b..98ce15cc6 100644 --- a/examples/stm32h7/src/bin/blinky.rs +++ b/examples/stm32h7/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32h7/src/bin/button_exti.rs b/examples/stm32h7/src/bin/button_exti.rs index 24ece9927..60dfb362b 100644 --- a/examples/stm32h7/src/bin/button_exti.rs +++ b/examples/stm32h7/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs index 0d0179e62..69187182f 100644 --- a/examples/stm32h7/src/bin/camera.rs +++ b/examples/stm32h7/src/bin/camera.rs | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use embassy::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 6 | use embassy_executor::time::{Duration, Timer}; |
| 7 | use embassy_stm32::dcmi::{self, *}; | 7 | use embassy_stm32::dcmi::{self, *}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::i2c::I2c; | 9 | use embassy_stm32::i2c::I2c; |
| @@ -32,7 +32,7 @@ const HEIGHT: usize = 100; | |||
| 32 | 32 | ||
| 33 | static mut FRAME: [u32; WIDTH * HEIGHT / 2] = [0u32; WIDTH * HEIGHT / 2]; | 33 | static mut FRAME: [u32; WIDTH * HEIGHT / 2] = [0u32; WIDTH * HEIGHT / 2]; |
| 34 | 34 | ||
| 35 | #[embassy::main(config = "config()")] | 35 | #[embassy_executor::main(config = "config()")] |
| 36 | async fn main(_spawner: Spawner, p: Peripherals) { | 36 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 37 | defmt::info!("Hello World!"); | 37 | defmt::info!("Hello World!"); |
| 38 | let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3)); | 38 | let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3)); |
| @@ -78,7 +78,7 @@ mod ov7725 { | |||
| 78 | use core::marker::PhantomData; | 78 | use core::marker::PhantomData; |
| 79 | 79 | ||
| 80 | use defmt::Format; | 80 | use defmt::Format; |
| 81 | use embassy::time::{Duration, Timer}; | 81 | use embassy_executor::time::{Duration, Timer}; |
| 82 | use embassy_stm32::rcc::{Mco, McoInstance}; | 82 | use embassy_stm32::rcc::{Mco, McoInstance}; |
| 83 | use embedded_hal_async::i2c::I2c; | 83 | use embedded_hal_async::i2c::I2c; |
| 84 | 84 | ||
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index 556d472bd..4282fcedd 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs | |||
| @@ -3,9 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::util::Forever; | ||
| 9 | use embassy_net::tcp::TcpSocket; | 8 | use embassy_net::tcp::TcpSocket; |
| 10 | use embassy_net::{Ipv4Address, Stack, StackResources}; | 9 | use embassy_net::{Ipv4Address, Stack, StackResources}; |
| 11 | use embassy_stm32::eth::generic_smi::GenericSMI; | 10 | use embassy_stm32::eth::generic_smi::GenericSMI; |
| @@ -14,6 +13,7 @@ use embassy_stm32::peripherals::ETH; | |||
| 14 | use embassy_stm32::rng::Rng; | 13 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::time::mhz; | 14 | use embassy_stm32::time::mhz; |
| 16 | use embassy_stm32::{interrupt, Config, Peripherals}; | 15 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| 16 | use embassy_util::Forever; | ||
| 17 | use embedded_io::asynch::Write; | 17 | use embedded_io::asynch::Write; |
| 18 | use rand_core::RngCore; | 18 | use rand_core::RngCore; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 19 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -28,7 +28,7 @@ macro_rules! forever { | |||
| 28 | 28 | ||
| 29 | type Device = Ethernet<'static, ETH, GenericSMI, 4, 4>; | 29 | type Device = Ethernet<'static, ETH, GenericSMI, 4, 4>; |
| 30 | 30 | ||
| 31 | #[embassy::task] | 31 | #[embassy_executor::task] |
| 32 | async fn net_task(stack: &'static Stack<Device>) -> ! { | 32 | async fn net_task(stack: &'static Stack<Device>) -> ! { |
| 33 | stack.run().await | 33 | stack.run().await |
| 34 | } | 34 | } |
| @@ -41,7 +41,7 @@ pub fn config() -> Config { | |||
| 41 | config | 41 | config |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | #[embassy::main(config = "config()")] | 44 | #[embassy_executor::main(config = "config()")] |
| 45 | async fn main(spawner: Spawner, p: Peripherals) -> ! { | 45 | async fn main(spawner: Spawner, p: Peripherals) -> ! { |
| 46 | info!("Hello World!"); | 46 | info!("Hello World!"); |
| 47 | 47 | ||
diff --git a/examples/stm32h7/src/bin/flash.rs b/examples/stm32h7/src/bin/flash.rs index 5f97d2b31..0c477deba 100644 --- a/examples/stm32h7/src/bin/flash.rs +++ b/examples/stm32h7/src/bin/flash.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::flash::Flash; | 8 | use embassy_stm32::flash::Flash; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 10 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello Flash!"); | 15 | info!("Hello Flash!"); |
| 16 | 16 | ||
diff --git a/examples/stm32h7/src/bin/fmc.rs b/examples/stm32h7/src/bin/fmc.rs index 27c715ab0..5140a6e22 100644 --- a/examples/stm32h7/src/bin/fmc.rs +++ b/examples/stm32h7/src/bin/fmc.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Delay, Duration, Timer}; | 7 | use embassy_executor::time::{Delay, Duration, Timer}; |
| 8 | use embassy_stm32::fmc::Fmc; | 8 | use embassy_stm32::fmc::Fmc; |
| 9 | use embassy_stm32::time::mhz; | 9 | use embassy_stm32::time::mhz; |
| 10 | use embassy_stm32::{Config, Peripherals}; | 10 | use embassy_stm32::{Config, Peripherals}; |
| @@ -18,7 +18,7 @@ pub fn config() -> Config { | |||
| 18 | config | 18 | config |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | #[embassy::main(config = "config()")] | 21 | #[embassy_executor::main(config = "config()")] |
| 22 | async fn main(_spawner: Spawner, p: Peripherals) { | 22 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 23 | info!("Hello World!"); | 23 | info!("Hello World!"); |
| 24 | 24 | ||
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index d7c6da5bd..f2477c7a7 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::low_level::AFType; | 8 | use embassy_stm32::gpio::low_level::AFType; |
| 9 | use embassy_stm32::gpio::Speed; | 9 | use embassy_stm32::gpio::Speed; |
| 10 | use embassy_stm32::pwm::*; | 10 | use embassy_stm32::pwm::*; |
| @@ -24,7 +24,7 @@ pub fn config() -> Config { | |||
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main(config = "config()")] | 27 | #[embassy_executor::main(config = "config()")] |
| 28 | async fn main(_spawner: Spawner, p: Peripherals) { | 28 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 29 | info!("Hello World!"); | 29 | info!("Hello World!"); |
| 30 | 30 | ||
diff --git a/examples/stm32h7/src/bin/mco.rs b/examples/stm32h7/src/bin/mco.rs index 6f03b5479..83ba3742b 100644 --- a/examples/stm32h7/src/bin/mco.rs +++ b/examples/stm32h7/src/bin/mco.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; | 9 | use embassy_stm32::rcc::{Mco, Mco1Source, McoClock}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/examples/stm32h7/src/bin/pwm.rs b/examples/stm32h7/src/bin/pwm.rs index 730f637e9..36ed2e4a4 100644 --- a/examples/stm32h7/src/bin/pwm.rs +++ b/examples/stm32h7/src/bin/pwm.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; | 8 | use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; |
| 9 | use embassy_stm32::pwm::Channel; | 9 | use embassy_stm32::pwm::Channel; |
| 10 | use embassy_stm32::time::{khz, mhz}; | 10 | use embassy_stm32::time::{khz, mhz}; |
| @@ -23,7 +23,7 @@ pub fn config() -> Config { | |||
| 23 | config | 23 | config |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | #[embassy::main(config = "config()")] | 26 | #[embassy_executor::main(config = "config()")] |
| 27 | async fn main(_spawner: Spawner, p: Peripherals) { | 27 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 28 | info!("Hello World!"); | 28 | info!("Hello World!"); |
| 29 | 29 | ||
diff --git a/examples/stm32h7/src/bin/rng.rs b/examples/stm32h7/src/bin/rng.rs index 2b42a6afd..81fb3d162 100644 --- a/examples/stm32h7/src/bin/rng.rs +++ b/examples/stm32h7/src/bin/rng.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::rng::Rng; | 7 | use embassy_stm32::rng::Rng; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | info!("Hello World!"); | 13 | info!("Hello World!"); |
| 14 | 14 | ||
diff --git a/examples/stm32h7/src/bin/sdmmc.rs b/examples/stm32h7/src/bin/sdmmc.rs index 163807d86..19ae5ade1 100644 --- a/examples/stm32h7/src/bin/sdmmc.rs +++ b/examples/stm32h7/src/bin/sdmmc.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::sdmmc::Sdmmc; | 7 | use embassy_stm32::sdmmc::Sdmmc; |
| 8 | use embassy_stm32::time::mhz; | 8 | use embassy_stm32::time::mhz; |
| 9 | use embassy_stm32::{interrupt, Config, Peripherals}; | 9 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| @@ -15,7 +15,7 @@ fn config() -> Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 20 | info!("Hello World!"); | 20 | info!("Hello World!"); |
| 21 | 21 | ||
diff --git a/examples/stm32h7/src/bin/signal.rs b/examples/stm32h7/src/bin/signal.rs index f798b1c92..2fc75c7af 100644 --- a/examples/stm32h7/src/bin/signal.rs +++ b/examples/stm32h7/src/bin/signal.rs | |||
| @@ -3,15 +3,15 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::channel::signal::Signal; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy::time::{Duration, Timer}; | ||
| 9 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embassy_util::channel::signal::Signal; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | static SIGNAL: Signal<u32> = Signal::new(); | 12 | static SIGNAL: Signal<u32> = Signal::new(); |
| 13 | 13 | ||
| 14 | #[embassy::task] | 14 | #[embassy_executor::task] |
| 15 | async fn my_sending_task() { | 15 | async fn my_sending_task() { |
| 16 | let mut counter: u32 = 0; | 16 | let mut counter: u32 = 0; |
| 17 | 17 | ||
| @@ -24,7 +24,7 @@ async fn my_sending_task() { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main] | 27 | #[embassy_executor::main] |
| 28 | async fn main(spawner: Spawner, _p: Peripherals) { | 28 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 29 | unwrap!(spawner.spawn(my_sending_task())); | 29 | unwrap!(spawner.spawn(my_sending_task())); |
| 30 | 30 | ||
diff --git a/examples/stm32h7/src/bin/spi.rs b/examples/stm32h7/src/bin/spi.rs index f2eb5a3be..dc8cb7f47 100644 --- a/examples/stm32h7/src/bin/spi.rs +++ b/examples/stm32h7/src/bin/spi.rs | |||
| @@ -7,12 +7,12 @@ use core::str::from_utf8; | |||
| 7 | 7 | ||
| 8 | use cortex_m_rt::entry; | 8 | use cortex_m_rt::entry; |
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::executor::Executor; | 10 | use embassy_executor::executor::Executor; |
| 11 | use embassy::util::Forever; | ||
| 12 | use embassy_stm32::dma::NoDma; | 11 | use embassy_stm32::dma::NoDma; |
| 13 | use embassy_stm32::peripherals::SPI3; | 12 | use embassy_stm32::peripherals::SPI3; |
| 14 | use embassy_stm32::time::mhz; | 13 | use embassy_stm32::time::mhz; |
| 15 | use embassy_stm32::{spi, Config}; | 14 | use embassy_stm32::{spi, Config}; |
| 15 | use embassy_util::Forever; | ||
| 16 | use heapless::String; | 16 | use heapless::String; |
| 17 | use {defmt_rtt as _, panic_probe as _}; | 17 | use {defmt_rtt as _, panic_probe as _}; |
| 18 | 18 | ||
| @@ -24,7 +24,7 @@ pub fn config() -> Config { | |||
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::task] | 27 | #[embassy_executor::task] |
| 28 | async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) { | 28 | async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) { |
| 29 | for n in 0u32.. { | 29 | for n in 0u32.. { |
| 30 | let mut write: String<128> = String::new(); | 30 | let mut write: String<128> = String::new(); |
diff --git a/examples/stm32h7/src/bin/spi_dma.rs b/examples/stm32h7/src/bin/spi_dma.rs index d72051fda..2631ed30c 100644 --- a/examples/stm32h7/src/bin/spi_dma.rs +++ b/examples/stm32h7/src/bin/spi_dma.rs | |||
| @@ -7,11 +7,11 @@ use core::str::from_utf8; | |||
| 7 | 7 | ||
| 8 | use cortex_m_rt::entry; | 8 | use cortex_m_rt::entry; |
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::executor::Executor; | 10 | use embassy_executor::executor::Executor; |
| 11 | use embassy::util::Forever; | ||
| 12 | use embassy_stm32::peripherals::{DMA1_CH3, DMA1_CH4, SPI3}; | 11 | use embassy_stm32::peripherals::{DMA1_CH3, DMA1_CH4, SPI3}; |
| 13 | use embassy_stm32::time::mhz; | 12 | use embassy_stm32::time::mhz; |
| 14 | use embassy_stm32::{spi, Config}; | 13 | use embassy_stm32::{spi, Config}; |
| 14 | use embassy_util::Forever; | ||
| 15 | use heapless::String; | 15 | use heapless::String; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| @@ -23,7 +23,7 @@ pub fn config() -> Config { | |||
| 23 | config | 23 | config |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | #[embassy::task] | 26 | #[embassy_executor::task] |
| 27 | async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) { | 27 | async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) { |
| 28 | for n in 0u32.. { | 28 | for n in 0u32.. { |
| 29 | let mut write: String<128> = String::new(); | 29 | let mut write: String<128> = String::new(); |
diff --git a/examples/stm32h7/src/bin/usart.rs b/examples/stm32h7/src/bin/usart.rs index fc3db5a33..e491fb39d 100644 --- a/examples/stm32h7/src/bin/usart.rs +++ b/examples/stm32h7/src/bin/usart.rs | |||
| @@ -4,13 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | use cortex_m_rt::entry; | 5 | use cortex_m_rt::entry; |
| 6 | use defmt::*; | 6 | use defmt::*; |
| 7 | use embassy::executor::Executor; | 7 | use embassy_executor::executor::Executor; |
| 8 | use embassy::util::Forever; | ||
| 9 | use embassy_stm32::dma::NoDma; | 8 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 9 | use embassy_stm32::usart::{Config, Uart}; |
| 10 | use embassy_util::Forever; | ||
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::task] | 13 | #[embassy_executor::task] |
| 14 | async fn main_task() { | 14 | async fn main_task() { |
| 15 | let p = embassy_stm32::init(Default::default()); | 15 | let p = embassy_stm32::init(Default::default()); |
| 16 | 16 | ||
diff --git a/examples/stm32h7/src/bin/usart_dma.rs b/examples/stm32h7/src/bin/usart_dma.rs index d3325b0c1..aacda45bc 100644 --- a/examples/stm32h7/src/bin/usart_dma.rs +++ b/examples/stm32h7/src/bin/usart_dma.rs | |||
| @@ -6,14 +6,14 @@ use core::fmt::Write; | |||
| 6 | 6 | ||
| 7 | use cortex_m_rt::entry; | 7 | use cortex_m_rt::entry; |
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::executor::Executor; | 9 | use embassy_executor::executor::Executor; |
| 10 | use embassy::util::Forever; | ||
| 11 | use embassy_stm32::dma::NoDma; | 10 | use embassy_stm32::dma::NoDma; |
| 12 | use embassy_stm32::usart::{Config, Uart}; | 11 | use embassy_stm32::usart::{Config, Uart}; |
| 12 | use embassy_util::Forever; | ||
| 13 | use heapless::String; | 13 | use heapless::String; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::task] | 16 | #[embassy_executor::task] |
| 17 | async fn main_task() { | 17 | async fn main_task() { |
| 18 | let p = embassy_stm32::init(Default::default()); | 18 | let p = embassy_stm32::init(Default::default()); |
| 19 | 19 | ||
diff --git a/examples/stm32h7/src/bin/usart_split.rs b/examples/stm32h7/src/bin/usart_split.rs index 678d8c911..12bb0ce9c 100644 --- a/examples/stm32h7/src/bin/usart_split.rs +++ b/examples/stm32h7/src/bin/usart_split.rs | |||
| @@ -3,16 +3,16 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::channel::mpmc::Channel; | ||
| 8 | use embassy::executor::Spawner; | ||
| 9 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::peripherals::{DMA1_CH1, UART7}; | 8 | use embassy_stm32::peripherals::{DMA1_CH1, UART7}; |
| 11 | use embassy_stm32::usart::{Config, Uart, UartRx}; | 9 | use embassy_stm32::usart::{Config, Uart, UartRx}; |
| 12 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 12 | use embassy_util::channel::mpmc::Channel; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | #[embassy::task] | 15 | #[embassy_executor::task] |
| 16 | async fn writer(mut usart: Uart<'static, UART7, NoDma, NoDma>) { | 16 | async fn writer(mut usart: Uart<'static, UART7, NoDma, NoDma>) { |
| 17 | unwrap!(usart.blocking_write(b"Hello Embassy World!\r\n")); | 17 | unwrap!(usart.blocking_write(b"Hello Embassy World!\r\n")); |
| 18 | info!("wrote Hello, starting echo"); | 18 | info!("wrote Hello, starting echo"); |
| @@ -26,7 +26,7 @@ async fn writer(mut usart: Uart<'static, UART7, NoDma, NoDma>) { | |||
| 26 | 26 | ||
| 27 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); | 27 | static CHANNEL: Channel<ThreadModeRawMutex, [u8; 8], 1> = Channel::new(); |
| 28 | 28 | ||
| 29 | #[embassy::main] | 29 | #[embassy_executor::main] |
| 30 | async fn main(spawner: Spawner, p: Peripherals) -> ! { | 30 | async fn main(spawner: Spawner, p: Peripherals) -> ! { |
| 31 | info!("Hello World!"); | 31 | info!("Hello World!"); |
| 32 | 32 | ||
| @@ -45,7 +45,7 @@ async fn main(spawner: Spawner, p: Peripherals) -> ! { | |||
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | #[embassy::task] | 48 | #[embassy_executor::task] |
| 49 | async fn reader(mut rx: UartRx<'static, UART7, DMA1_CH1>) { | 49 | async fn reader(mut rx: UartRx<'static, UART7, DMA1_CH1>) { |
| 50 | let mut buf = [0; 8]; | 50 | let mut buf = [0; 8]; |
| 51 | loop { | 51 | loop { |
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index d6093963b..7edda042d 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml | |||
| @@ -8,7 +8,8 @@ default = ["nightly"] | |||
| 8 | nightly = ["embassy-stm32/nightly", "embassy-lora", "lorawan-device", "lorawan", "embedded-io/async"] | 8 | nightly = ["embassy-stm32/nightly", "embassy-lora", "lorawan-device", "lorawan", "embedded-io/async"] |
| 9 | 9 | ||
| 10 | [dependencies] | 10 | [dependencies] |
| 11 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 11 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 12 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 12 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } | 13 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } |
| 13 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"], optional = true} | 14 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"], optional = true} |
| 14 | 15 | ||
diff --git a/examples/stm32l0/src/bin/blinky.rs b/examples/stm32l0/src/bin/blinky.rs index e027192bc..8cf21effb 100644 --- a/examples/stm32l0/src/bin/blinky.rs +++ b/examples/stm32l0/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l0/src/bin/button.rs b/examples/stm32l0/src/bin/button.rs index 43ea8c2a5..a5e05c3a3 100644 --- a/examples/stm32l0/src/bin/button.rs +++ b/examples/stm32l0/src/bin/button.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | info!("Hello World!"); | 13 | info!("Hello World!"); |
| 14 | 14 | ||
diff --git a/examples/stm32l0/src/bin/button_exti.rs b/examples/stm32l0/src/bin/button_exti.rs index d87870a01..22a096af8 100644 --- a/examples/stm32l0/src/bin/button_exti.rs +++ b/examples/stm32l0/src/bin/button_exti.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| @@ -15,7 +15,7 @@ fn config() -> embassy_stm32::Config { | |||
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #[embassy::main(config = "config()")] | 18 | #[embassy_executor::main(config = "config()")] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) { | 19 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 20 | let button = Input::new(p.PB2, Pull::Up); | 20 | let button = Input::new(p.PB2, Pull::Up); |
| 21 | let mut button = ExtiInput::new(button, p.EXTI2); | 21 | let mut button = ExtiInput::new(button, p.EXTI2); |
diff --git a/examples/stm32l0/src/bin/flash.rs b/examples/stm32l0/src/bin/flash.rs index a2fec9291..7ad5ae3aa 100644 --- a/examples/stm32l0/src/bin/flash.rs +++ b/examples/stm32l0/src/bin/flash.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l0/src/bin/lorawan.rs b/examples/stm32l0/src/bin/lorawan.rs index da58e2f72..29e54c1be 100644 --- a/examples/stm32l0/src/bin/lorawan.rs +++ b/examples/stm32l0/src/bin/lorawan.rs | |||
| @@ -24,8 +24,8 @@ fn config() -> embassy_stm32::Config { | |||
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main(config = "config()")] | 27 | #[embassy_executor::main(config = "config()")] |
| 28 | async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) { | 28 | async fn main(_spawner: embassy_executor::executor::Spawner, p: Peripherals) { |
| 29 | // SPI for sx127x | 29 | // SPI for sx127x |
| 30 | let spi = spi::Spi::new( | 30 | let spi = spi::Spi::new( |
| 31 | p.SPI1, | 31 | p.SPI1, |
diff --git a/examples/stm32l0/src/bin/raw_spawn.rs b/examples/stm32l0/src/bin/raw_spawn.rs index dfe2cddb6..cd711a430 100644 --- a/examples/stm32l0/src/bin/raw_spawn.rs +++ b/examples/stm32l0/src/bin/raw_spawn.rs | |||
| @@ -5,10 +5,10 @@ use core::mem; | |||
| 5 | 5 | ||
| 6 | use cortex_m_rt::entry; | 6 | use cortex_m_rt::entry; |
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::raw::TaskStorage; | 8 | use embassy_executor::executor::raw::TaskStorage; |
| 9 | use embassy::executor::Executor; | 9 | use embassy_executor::executor::Executor; |
| 10 | use embassy::time::{Duration, Timer}; | 10 | use embassy_executor::time::{Duration, Timer}; |
| 11 | use embassy::util::Forever; | 11 | use embassy_util::Forever; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | async fn run1() { | 14 | async fn run1() { |
diff --git a/examples/stm32l0/src/bin/spi.rs b/examples/stm32l0/src/bin/spi.rs index dba0b281d..74694295c 100644 --- a/examples/stm32l0/src/bin/spi.rs +++ b/examples/stm32l0/src/bin/spi.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::spi::{Config, Spi}; | 9 | use embassy_stm32::spi::{Config, Spi}; |
| @@ -11,7 +11,7 @@ use embassy_stm32::time::Hertz; | |||
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World, folks!"); | 16 | info!("Hello World, folks!"); |
| 17 | 17 | ||
diff --git a/examples/stm32l0/src/bin/usart_dma.rs b/examples/stm32l0/src/bin/usart_dma.rs index 861241639..1c5ce94d7 100644 --- a/examples/stm32l0/src/bin/usart_dma.rs +++ b/examples/stm32l0/src/bin/usart_dma.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::usart::{Config, Uart}; | 7 | use embassy_stm32::usart::{Config, Uart}; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | let mut usart = Uart::new(p.USART1, p.PB7, p.PB6, p.DMA1_CH2, p.DMA1_CH3, Config::default()); | 13 | let mut usart = Uart::new(p.USART1, p.PB7, p.PB6, p.DMA1_CH2, p.DMA1_CH3, Config::default()); |
| 14 | 14 | ||
diff --git a/examples/stm32l0/src/bin/usart_irq.rs b/examples/stm32l0/src/bin/usart_irq.rs index 09b1b0b03..b77d97f85 100644 --- a/examples/stm32l0/src/bin/usart_irq.rs +++ b/examples/stm32l0/src/bin/usart_irq.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::usart::{BufferedUart, Config, State, Uart}; | 8 | use embassy_stm32::usart::{BufferedUart, Config, State, Uart}; |
| 9 | use embassy_stm32::{interrupt, Peripherals}; | 9 | use embassy_stm32::{interrupt, Peripherals}; |
| 10 | use embedded_io::asynch::{Read, Write}; | 10 | use embedded_io::asynch::{Read, Write}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hi!"); | 15 | info!("Hi!"); |
| 16 | 16 | ||
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml index 7fec60575..d69de9c53 100644 --- a/examples/stm32l1/Cargo.toml +++ b/examples/stm32l1/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32l1-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } |
| 9 | 10 | ||
| 10 | defmt = "0.3" | 11 | defmt = "0.3" |
diff --git a/examples/stm32l1/src/bin/blinky.rs b/examples/stm32l1/src/bin/blinky.rs index bace53d91..58306be94 100644 --- a/examples/stm32l1/src/bin/blinky.rs +++ b/examples/stm32l1/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l1/src/bin/flash.rs b/examples/stm32l1/src/bin/flash.rs index fc519b079..78938fe3e 100644 --- a/examples/stm32l1/src/bin/flash.rs +++ b/examples/stm32l1/src/bin/flash.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l1/src/bin/spi.rs b/examples/stm32l1/src/bin/spi.rs index 81ccba4e1..05e869e71 100644 --- a/examples/stm32l1/src/bin/spi.rs +++ b/examples/stm32l1/src/bin/spi.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::spi::{Config, Spi}; | 9 | use embassy_stm32::spi::{Config, Spi}; |
| @@ -11,7 +11,7 @@ use embassy_stm32::time::Hertz; | |||
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | #[embassy::main] | 14 | #[embassy_executor::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World, folks!"); | 16 | info!("Hello World, folks!"); |
| 17 | 17 | ||
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index 7d89bf94a..8ac974c92 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -6,7 +6,8 @@ version = "0.1.0" | |||
| 6 | [features] | 6 | [features] |
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 9 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 10 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } | 11 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } |
| 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits"] } | 12 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits"] } |
| 12 | 13 | ||
diff --git a/examples/stm32l4/src/bin/adc.rs b/examples/stm32l4/src/bin/adc.rs index 499ea47dc..93a20d5ea 100644 --- a/examples/stm32l4/src/bin/adc.rs +++ b/examples/stm32l4/src/bin/adc.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::time::Delay; | 6 | use embassy_executor::time::Delay; |
| 7 | use embassy_stm32::adc::{Adc, Resolution}; | 7 | use embassy_stm32::adc::{Adc, Resolution}; |
| 8 | use embassy_stm32::pac; | 8 | use embassy_stm32::pac; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
diff --git a/examples/stm32l4/src/bin/blinky.rs b/examples/stm32l4/src/bin/blinky.rs index 54f8e03b2..3d689b5ee 100644 --- a/examples/stm32l4/src/bin/blinky.rs +++ b/examples/stm32l4/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l4/src/bin/button_exti.rs b/examples/stm32l4/src/bin/button_exti.rs index 924feeb33..0832386ed 100644 --- a/examples/stm32l4/src/bin/button_exti.rs +++ b/examples/stm32l4/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l4/src/bin/i2c.rs b/examples/stm32l4/src/bin/i2c.rs index a22b52184..058529ecf 100644 --- a/examples/stm32l4/src/bin/i2c.rs +++ b/examples/stm32l4/src/bin/i2c.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::dma::NoDma; | 7 | use embassy_stm32::dma::NoDma; |
| 8 | use embassy_stm32::i2c::I2c; | 8 | use embassy_stm32::i2c::I2c; |
| 9 | use embassy_stm32::time::Hertz; | 9 | use embassy_stm32::time::Hertz; |
| @@ -13,7 +13,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 13 | const ADDRESS: u8 = 0x5F; | 13 | const ADDRESS: u8 = 0x5F; |
| 14 | const WHOAMI: u8 = 0x0F; | 14 | const WHOAMI: u8 = 0x0F; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 17 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 18 | let irq = interrupt::take!(I2C2_EV); | 18 | let irq = interrupt::take!(I2C2_EV); |
| 19 | let mut i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, NoDma, NoDma, Hertz(100_000)); | 19 | let mut i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, NoDma, NoDma, Hertz(100_000)); |
diff --git a/examples/stm32l4/src/bin/i2c_blocking_async.rs b/examples/stm32l4/src/bin/i2c_blocking_async.rs index 6c4a86703..2dae9c2d5 100644 --- a/examples/stm32l4/src/bin/i2c_blocking_async.rs +++ b/examples/stm32l4/src/bin/i2c_blocking_async.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | ||
| 7 | use embassy_embedded_hal::adapter::BlockingAsync; | 6 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_executor::executor::Spawner; | ||
| 8 | use embassy_stm32::dma::NoDma; | 8 | use embassy_stm32::dma::NoDma; |
| 9 | use embassy_stm32::i2c::I2c; | 9 | use embassy_stm32::i2c::I2c; |
| 10 | use embassy_stm32::time::Hertz; | 10 | use embassy_stm32::time::Hertz; |
| @@ -15,7 +15,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 15 | const ADDRESS: u8 = 0x5F; | 15 | const ADDRESS: u8 = 0x5F; |
| 16 | const WHOAMI: u8 = 0x0F; | 16 | const WHOAMI: u8 = 0x0F; |
| 17 | 17 | ||
| 18 | #[embassy::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 19 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 20 | let irq = interrupt::take!(I2C2_EV); | 20 | let irq = interrupt::take!(I2C2_EV); |
| 21 | let i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, NoDma, NoDma, Hertz(100_000)); | 21 | let i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, NoDma, NoDma, Hertz(100_000)); |
diff --git a/examples/stm32l4/src/bin/i2c_dma.rs b/examples/stm32l4/src/bin/i2c_dma.rs index 48d2e92cf..9e71d404b 100644 --- a/examples/stm32l4/src/bin/i2c_dma.rs +++ b/examples/stm32l4/src/bin/i2c_dma.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::i2c::I2c; | 7 | use embassy_stm32::i2c::I2c; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::{interrupt, Peripherals}; | 9 | use embassy_stm32::{interrupt, Peripherals}; |
| @@ -12,7 +12,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 12 | const ADDRESS: u8 = 0x5F; | 12 | const ADDRESS: u8 = 0x5F; |
| 13 | const WHOAMI: u8 = 0x0F; | 13 | const WHOAMI: u8 = 0x0F; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 16 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 17 | let irq = interrupt::take!(I2C2_EV); | 17 | let irq = interrupt::take!(I2C2_EV); |
| 18 | let mut i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, p.DMA1_CH4, p.DMA1_CH5, Hertz(100_000)); | 18 | let mut i2c = I2c::new(p.I2C2, p.PB10, p.PB11, irq, p.DMA1_CH4, p.DMA1_CH5, Hertz(100_000)); |
diff --git a/examples/stm32l4/src/bin/rng.rs b/examples/stm32l4/src/bin/rng.rs index 7aaa122ed..ed47fc6c9 100644 --- a/examples/stm32l4/src/bin/rng.rs +++ b/examples/stm32l4/src/bin/rng.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; | 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; |
| 8 | use embassy_stm32::rng::Rng; | 8 | use embassy_stm32::rng::Rng; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| @@ -22,7 +22,7 @@ fn config() -> Config { | |||
| 22 | config | 22 | config |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #[embassy::main(config = "config()")] | 25 | #[embassy_executor::main(config = "config()")] |
| 26 | async fn main(_spawner: Spawner, p: Peripherals) { | 26 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 27 | info!("Hello World!"); | 27 | info!("Hello World!"); |
| 28 | 28 | ||
diff --git a/examples/stm32l4/src/bin/spi_blocking_async.rs b/examples/stm32l4/src/bin/spi_blocking_async.rs index 20a2ff802..e06b29b81 100644 --- a/examples/stm32l4/src/bin/spi_blocking_async.rs +++ b/examples/stm32l4/src/bin/spi_blocking_async.rs | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | ||
| 7 | use embassy_embedded_hal::adapter::BlockingAsync; | 6 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_executor::executor::Spawner; | ||
| 8 | use embassy_stm32::dma::NoDma; | 8 | use embassy_stm32::dma::NoDma; |
| 9 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 9 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 10 | use embassy_stm32::spi::{Config, Spi}; | 10 | use embassy_stm32::spi::{Config, Spi}; |
| @@ -13,7 +13,7 @@ use embassy_stm32::Peripherals; | |||
| 13 | use embedded_hal_async::spi::SpiBus; | 13 | use embedded_hal_async::spi::SpiBus; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 15 | ||
| 16 | #[embassy::main] | 16 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 17 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 18 | info!("Hello World!"); | 18 | info!("Hello World!"); |
| 19 | 19 | ||
diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs index d0c3609af..e44754bec 100644 --- a/examples/stm32l4/src/bin/spi_dma.rs +++ b/examples/stm32l4/src/bin/spi_dma.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 8 | use embassy_stm32::spi::{Config, Spi}; | 8 | use embassy_stm32::spi::{Config, Spi}; |
| 9 | use embassy_stm32::time::Hertz; | 9 | use embassy_stm32::time::Hertz; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/examples/stm32l4/src/bin/usart_dma.rs b/examples/stm32l4/src/bin/usart_dma.rs index 7ae7e9e15..fdd5a85e6 100644 --- a/examples/stm32l4/src/bin/usart_dma.rs +++ b/examples/stm32l4/src/bin/usart_dma.rs | |||
| @@ -5,14 +5,14 @@ | |||
| 5 | use core::fmt::Write; | 5 | use core::fmt::Write; |
| 6 | 6 | ||
| 7 | use defmt::*; | 7 | use defmt::*; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use heapless::String; | 12 | use heapless::String; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 14 | ||
| 15 | #[embassy::main] | 15 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml index 85eac7b8f..6466994ed 100644 --- a/examples/stm32l5/Cargo.toml +++ b/examples/stm32l5/Cargo.toml | |||
| @@ -6,7 +6,8 @@ version = "0.1.0" | |||
| 6 | [features] | 6 | [features] |
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 9 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "unstable-traits", "memory-x"] } | 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "unstable-traits", "memory-x"] } |
| 11 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 12 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 12 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } | 13 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } |
diff --git a/examples/stm32l5/src/bin/button_exti.rs b/examples/stm32l5/src/bin/button_exti.rs index c7a6cfa28..99462e597 100644 --- a/examples/stm32l5/src/bin/button_exti.rs +++ b/examples/stm32l5/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32l5/src/bin/rng.rs b/examples/stm32l5/src/bin/rng.rs index d3627d2c2..45094374b 100644 --- a/examples/stm32l5/src/bin/rng.rs +++ b/examples/stm32l5/src/bin/rng.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; | 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; |
| 8 | use embassy_stm32::rng::Rng; | 8 | use embassy_stm32::rng::Rng; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::{Config, Peripherals}; |
| @@ -21,7 +21,7 @@ fn config() -> Config { | |||
| 21 | config | 21 | config |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | #[embassy::main(config = "config()")] | 24 | #[embassy_executor::main(config = "config()")] |
| 25 | async fn main(_spawner: Spawner, p: Peripherals) { | 25 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 26 | info!("Hello World!"); | 26 | info!("Hello World!"); |
| 27 | 27 | ||
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs index d711616ef..9e1df15dd 100644 --- a/examples/stm32l5/src/bin/usb_ethernet.rs +++ b/examples/stm32l5/src/bin/usb_ethernet.rs | |||
| @@ -7,10 +7,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; | |||
| 7 | use core::task::Waker; | 7 | use core::task::Waker; |
| 8 | 8 | ||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 10 | use embassy_executor::executor::Spawner; |
| 11 | use embassy::channel::mpmc::Channel; | ||
| 12 | use embassy::executor::Spawner; | ||
| 13 | use embassy::util::Forever; | ||
| 14 | use embassy_net::tcp::TcpSocket; | 11 | use embassy_net::tcp::TcpSocket; |
| 15 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; | 12 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; |
| 16 | use embassy_stm32::rcc::*; | 13 | use embassy_stm32::rcc::*; |
| @@ -20,6 +17,9 @@ use embassy_stm32::usb::Driver; | |||
| 20 | use embassy_stm32::{interrupt, Config, Peripherals}; | 17 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| 21 | use embassy_usb::{Builder, UsbDevice}; | 18 | use embassy_usb::{Builder, UsbDevice}; |
| 22 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 19 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 21 | use embassy_util::channel::mpmc::Channel; | ||
| 22 | use embassy_util::Forever; | ||
| 23 | use embedded_io::asynch::{Read, Write}; | 23 | use embedded_io::asynch::{Read, Write}; |
| 24 | use rand_core::RngCore; | 24 | use rand_core::RngCore; |
| 25 | use {defmt_rtt as _, panic_probe as _}; | 25 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -34,12 +34,12 @@ macro_rules! forever { | |||
| 34 | }}; | 34 | }}; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy::task] | 37 | #[embassy_executor::task] |
| 38 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { | 38 | async fn usb_task(mut device: UsbDevice<'static, MyDriver>) -> ! { |
| 39 | device.run().await | 39 | device.run().await |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | #[embassy::task] | 42 | #[embassy_executor::task] |
| 43 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | 43 | async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { |
| 44 | loop { | 44 | loop { |
| 45 | warn!("WAITING for connection"); | 45 | warn!("WAITING for connection"); |
| @@ -68,7 +68,7 @@ async fn usb_ncm_rx_task(mut class: Receiver<'static, MyDriver>) { | |||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | #[embassy::task] | 71 | #[embassy_executor::task] |
| 72 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | 72 | async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { |
| 73 | loop { | 73 | loop { |
| 74 | let pkt = TX_CHANNEL.recv().await; | 74 | let pkt = TX_CHANNEL.recv().await; |
| @@ -78,7 +78,7 @@ async fn usb_ncm_tx_task(mut class: Sender<'static, MyDriver>) { | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | #[embassy::task] | 81 | #[embassy_executor::task] |
| 82 | async fn net_task(stack: &'static Stack<Device>) -> ! { | 82 | async fn net_task(stack: &'static Stack<Device>) -> ! { |
| 83 | stack.run().await | 83 | stack.run().await |
| 84 | } | 84 | } |
| @@ -93,7 +93,7 @@ fn config() -> Config { | |||
| 93 | config | 93 | config |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | #[embassy::main(config = "config()")] | 96 | #[embassy_executor::main(config = "config()")] |
| 97 | async fn main(spawner: Spawner, p: Peripherals) { | 97 | async fn main(spawner: Spawner, p: Peripherals) { |
| 98 | // Create the driver, from the HAL. | 98 | // Create the driver, from the HAL. |
| 99 | let irq = interrupt::take!(USB_FS); | 99 | let irq = interrupt::take!(USB_FS); |
diff --git a/examples/stm32l5/src/bin/usb_hid_mouse.rs b/examples/stm32l5/src/bin/usb_hid_mouse.rs index d139e6bb1..6aac00881 100644 --- a/examples/stm32l5/src/bin/usb_hid_mouse.rs +++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | #![feature(type_alias_impl_trait)] | 4 | #![feature(type_alias_impl_trait)] |
| 5 | 5 | ||
| 6 | use defmt::*; | 6 | use defmt::*; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy_executor::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy_executor::time::{Duration, Timer}; |
| 9 | use embassy_stm32::rcc::*; | 9 | use embassy_stm32::rcc::*; |
| 10 | use embassy_stm32::time::Hertz; | 10 | use embassy_stm32::time::Hertz; |
| 11 | use embassy_stm32::usb::Driver; | 11 | use embassy_stm32::usb::Driver; |
| @@ -27,7 +27,7 @@ fn config() -> Config { | |||
| 27 | config | 27 | config |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[embassy::main(config = "config()")] | 30 | #[embassy_executor::main(config = "config()")] |
| 31 | async fn main(_spawner: Spawner, p: Peripherals) { | 31 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 32 | // Create the driver, from the HAL. | 32 | // Create the driver, from the HAL. |
| 33 | let irq = interrupt::take!(USB_FS); | 33 | let irq = interrupt::take!(USB_FS); |
diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs index 8dab001c6..508bce8a8 100644 --- a/examples/stm32l5/src/bin/usb_serial.rs +++ b/examples/stm32l5/src/bin/usb_serial.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{panic, *}; | 5 | use defmt::{panic, *}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::rcc::*; | 7 | use embassy_stm32::rcc::*; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::usb::{Driver, Instance}; | 9 | use embassy_stm32::usb::{Driver, Instance}; |
| @@ -24,7 +24,7 @@ fn config() -> Config { | |||
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main(config = "config()")] | 27 | #[embassy_executor::main(config = "config()")] |
| 28 | async fn main(_spawner: Spawner, p: Peripherals) { | 28 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 29 | info!("Hello World!"); | 29 | info!("Hello World!"); |
| 30 | 30 | ||
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml index 22e2e09a1..4ce95be4c 100644 --- a/examples/stm32u5/Cargo.toml +++ b/examples/stm32u5/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32u5-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32u585ai", "time-driver-any", "memory-x" ] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32u585ai", "time-driver-any", "memory-x" ] } |
| 9 | 10 | ||
| 10 | defmt = "0.3" | 11 | defmt = "0.3" |
diff --git a/examples/stm32u5/src/bin/blinky.rs b/examples/stm32u5/src/bin/blinky.rs index 4910e0b98..4f3eabc5e 100644 --- a/examples/stm32u5/src/bin/blinky.rs +++ b/examples/stm32u5/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { | 13 | async fn main(_spawner: Spawner, p: Peripherals) -> ! { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml index 812d638fa..dc9107dd0 100644 --- a/examples/stm32wb/Cargo.toml +++ b/examples/stm32wb/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32wb-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55cc", "time-driver-any", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55cc", "time-driver-any", "exti"] } |
| 9 | 10 | ||
| 10 | defmt = "0.3" | 11 | defmt = "0.3" |
diff --git a/examples/stm32wb/src/bin/blinky.rs b/examples/stm32wb/src/bin/blinky.rs index 8ab9b749d..3d8e8391d 100644 --- a/examples/stm32wb/src/bin/blinky.rs +++ b/examples/stm32wb/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wb/src/bin/button_exti.rs b/examples/stm32wb/src/bin/button_exti.rs index 2ddeb887c..41afaf4d6 100644 --- a/examples/stm32wb/src/bin/button_exti.rs +++ b/examples/stm32wb/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml index 6be360735..00d63f02d 100644 --- a/examples/stm32wl/Cargo.toml +++ b/examples/stm32wl/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-stm32wl-examples" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } | ||
| 8 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "subghz", "unstable-pac", "exti"] } | 9 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "subghz", "unstable-pac", "exti"] } |
| 9 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time", "defmt"] } | 10 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time", "defmt"] } |
| 10 | 11 | ||
diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs index 9393af1c6..e764b4cc3 100644 --- a/examples/stm32wl/src/bin/blinky.rs +++ b/examples/stm32wl/src/bin/blinky.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wl/src/bin/button_exti.rs b/examples/stm32wl/src/bin/button_exti.rs index 7d5c1b3cb..9f143597d 100644 --- a/examples/stm32wl/src/bin/button_exti.rs +++ b/examples/stm32wl/src/bin/button_exti.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | 9 | use embassy_stm32::Peripherals; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs index 6531feae9..46183b8a2 100644 --- a/examples/stm32wl/src/bin/flash.rs +++ b/examples/stm32wl/src/bin/flash.rs | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | #[embassy::main] | 12 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 13 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
diff --git a/examples/stm32wl/src/bin/lorawan.rs b/examples/stm32wl/src/bin/lorawan.rs index 158c17e18..2db022ea2 100644 --- a/examples/stm32wl/src/bin/lorawan.rs +++ b/examples/stm32wl/src/bin/lorawan.rs | |||
| @@ -23,8 +23,8 @@ fn config() -> embassy_stm32::Config { | |||
| 23 | config | 23 | config |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | #[embassy::main(config = "config()")] | 26 | #[embassy_executor::main(config = "config()")] |
| 27 | async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) { | 27 | async fn main(_spawner: embassy_executor::executor::Spawner, p: Peripherals) { |
| 28 | unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) } | 28 | unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) } |
| 29 | 29 | ||
| 30 | let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High); | 30 | let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High); |
diff --git a/examples/stm32wl/src/bin/subghz.rs b/examples/stm32wl/src/bin/subghz.rs index c5f6e502a..775dfbbfc 100644 --- a/examples/stm32wl/src/bin/subghz.rs +++ b/examples/stm32wl/src/bin/subghz.rs | |||
| @@ -6,13 +6,13 @@ | |||
| 6 | #![feature(type_alias_impl_trait)] | 6 | #![feature(type_alias_impl_trait)] |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy::channel::signal::Signal; | ||
| 10 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 11 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 13 | use embassy_stm32::interrupt::{Interrupt, InterruptExt}; | 12 | use embassy_stm32::interrupt::{Interrupt, InterruptExt}; |
| 14 | use embassy_stm32::subghz::*; | 13 | use embassy_stm32::subghz::*; |
| 15 | use embassy_stm32::{interrupt, Peripherals}; | 14 | use embassy_stm32::{interrupt, Peripherals}; |
| 15 | use embassy_util::channel::signal::Signal; | ||
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | const PING_DATA: &str = "PING"; | 18 | const PING_DATA: &str = "PING"; |
| @@ -57,8 +57,8 @@ fn config() -> embassy_stm32::Config { | |||
| 57 | config | 57 | config |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | #[embassy::main(config = "config()")] | 60 | #[embassy_executor::main(config = "config()")] |
| 61 | async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) { | 61 | async fn main(_spawner: embassy_executor::executor::Spawner, p: Peripherals) { |
| 62 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); | 62 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); |
| 63 | let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low); | 63 | let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low); |
| 64 | let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low); | 64 | let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low); |
diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml index 347252fa3..4e26f023c 100644 --- a/examples/wasm/Cargo.toml +++ b/examples/wasm/Cargo.toml | |||
| @@ -7,7 +7,8 @@ version = "0.1.0" | |||
| 7 | crate-type = ["cdylib"] | 7 | crate-type = ["cdylib"] |
| 8 | 8 | ||
| 9 | [dependencies] | 9 | [dependencies] |
| 10 | embassy = { version = "0.1.0", path = "../../embassy", features = ["log", "wasm", "nightly"] } | 10 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["log"] } |
| 11 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "wasm", "nightly"] } | ||
| 11 | 12 | ||
| 12 | wasm-logger = "0.2.0" | 13 | wasm-logger = "0.2.0" |
| 13 | wasm-bindgen = "0.2" | 14 | wasm-bindgen = "0.2" |
diff --git a/examples/wasm/src/lib.rs b/examples/wasm/src/lib.rs index 61757ebd7..2e961e65a 100644 --- a/examples/wasm/src/lib.rs +++ b/examples/wasm/src/lib.rs | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | #![feature(type_alias_impl_trait)] | 1 | #![feature(type_alias_impl_trait)] |
| 2 | #![allow(incomplete_features)] | 2 | #![allow(incomplete_features)] |
| 3 | 3 | ||
| 4 | use embassy::executor::Spawner; | 4 | use embassy_executor::executor::Spawner; |
| 5 | use embassy::time::{Duration, Timer}; | 5 | use embassy_executor::time::{Duration, Timer}; |
| 6 | 6 | ||
| 7 | #[embassy::task] | 7 | #[embassy_executor::task] |
| 8 | async fn ticker() { | 8 | async fn ticker() { |
| 9 | let window = web_sys::window().expect("no global `window` exists"); | 9 | let window = web_sys::window().expect("no global `window` exists"); |
| 10 | 10 | ||
| @@ -24,7 +24,7 @@ async fn ticker() { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy::main] | 27 | #[embassy_executor::main] |
| 28 | async fn main(spawner: Spawner) { | 28 | async fn main(spawner: Spawner) { |
| 29 | wasm_logger::init(wasm_logger::Config::default()); | 29 | wasm_logger::init(wasm_logger::Config::default()); |
| 30 | spawner.spawn(ticker()).unwrap(); | 30 | spawner.spawn(ticker()).unwrap(); |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index fe791d0d7..d19243b9d 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -4,7 +4,8 @@ name = "embassy-rp-tests" | |||
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } | 7 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt"] } | ||
| 8 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits"] } | 9 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits"] } |
| 9 | 10 | ||
| 10 | defmt = "0.3.0" | 11 | defmt = "0.3.0" |
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index 0be9d9f24..6f6baf77a 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{assert, *}; | 5 | use defmt::{assert, *}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull}; | 7 | use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull}; |
| 8 | use embassy_rp::Peripherals; | 8 | use embassy_rp::Peripherals; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy::main] | 11 | #[embassy_executor::main] |
| 12 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 13 | info!("Hello World!"); | 13 | info!("Hello World!"); |
| 14 | 14 | ||
diff --git a/tests/rp/src/bin/gpio_async.rs b/tests/rp/src/bin/gpio_async.rs index 46df4105c..1098682af 100644 --- a/tests/rp/src/bin/gpio_async.rs +++ b/tests/rp/src/bin/gpio_async.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::{assert, *}; | 5 | use defmt::{assert, *}; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy::time::{Duration, Instant, Timer}; | 7 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 8 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 8 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 9 | use embassy_rp::Peripherals; | 9 | use embassy_rp::Peripherals; |
| 10 | use futures::future::join; | 10 | use futures::future::join; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | #[embassy::main] | 13 | #[embassy_executor::main] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("embassy-rp gpio_async test"); | 15 | info!("embassy-rp gpio_async test"); |
| 16 | 16 | ||
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index df8d64449..c1cca99d1 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -13,7 +13,8 @@ stm32wb55rg = ["embassy-stm32/stm32wb55rg"] # Nucleo | |||
| 13 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board | 13 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board |
| 14 | 14 | ||
| 15 | [dependencies] | 15 | [dependencies] |
| 16 | embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "time-tick-32768hz"] } | 16 | embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } |
| 17 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "time-tick-32768hz"] } | ||
| 17 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-tim2"] } | 18 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-tim2"] } |
| 18 | 19 | ||
| 19 | defmt = "0.3.0" | 20 | defmt = "0.3.0" |
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index 37cfe7cf4..8eab731bf 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert; | 7 | use defmt::assert; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull, Speed}; | 9 | use embassy_stm32::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use example_common::*; | 11 | use example_common::*; |
| 12 | 12 | ||
| 13 | #[embassy::main(config = "config()")] | 13 | #[embassy_executor::main(config = "config()")] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs index 049ba1e9f..6d38b0bbf 100644 --- a/tests/stm32/src/bin/spi.rs +++ b/tests/stm32/src/bin/spi.rs | |||
| @@ -5,14 +5,14 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::spi::{self, Spi}; | 10 | use embassy_stm32::spi::{self, Spi}; |
| 11 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 13 | use example_common::*; | 13 | use example_common::*; |
| 14 | 14 | ||
| 15 | #[embassy::main(config = "config()")] | 15 | #[embassy_executor::main(config = "config()")] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs index 64337886b..8147c5f08 100644 --- a/tests/stm32/src/bin/spi_dma.rs +++ b/tests/stm32/src/bin/spi_dma.rs | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::spi::{self, Spi}; | 9 | use embassy_stm32::spi::{self, Spi}; |
| 10 | use embassy_stm32::time::Hertz; | 10 | use embassy_stm32::time::Hertz; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use example_common::*; | 12 | use example_common::*; |
| 13 | 13 | ||
| 14 | #[embassy::main(config = "config()")] | 14 | #[embassy_executor::main(config = "config()")] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 17 | 17 | ||
diff --git a/tests/stm32/src/bin/timer.rs b/tests/stm32/src/bin/timer.rs index 002a8a4d3..76b07ca15 100644 --- a/tests/stm32/src/bin/timer.rs +++ b/tests/stm32/src/bin/timer.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert; | 7 | use defmt::assert; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy::time::{Duration, Instant, Timer}; | 9 | use embassy_executor::time::{Duration, Instant, Timer}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use example_common::*; | 11 | use example_common::*; |
| 12 | 12 | ||
| 13 | #[embassy::main(config = "config()")] | 13 | #[embassy_executor::main(config = "config()")] |
| 14 | async fn main(_spawner: Spawner, _p: Peripherals) { | 14 | async fn main(_spawner: Spawner, _p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index c3468290e..7b60e4b28 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use example_common::*; | 12 | use example_common::*; |
| 13 | 13 | ||
| 14 | #[embassy::main(config = "config()")] | 14 | #[embassy_executor::main(config = "config()")] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 17 | 17 | ||
diff --git a/tests/stm32/src/bin/usart_dma.rs b/tests/stm32/src/bin/usart_dma.rs index 9946f4a56..323c41cae 100644 --- a/tests/stm32/src/bin/usart_dma.rs +++ b/tests/stm32/src/bin/usart_dma.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::usart::{Config, Uart}; | 9 | use embassy_stm32::usart::{Config, Uart}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use example_common::*; | 11 | use example_common::*; |
| 12 | 12 | ||
| 13 | #[embassy::main(config = "config()")] | 13 | #[embassy_executor::main(config = "config()")] |
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
