Split embassy-time from embassy-executor.

This commit is contained in:
Dario Nieuwenhuis 2022-08-17 23:40:16 +02:00
parent 1c5b54a482
commit 5daa173ce4
254 changed files with 847 additions and 552 deletions

View File

@ -16,7 +16,7 @@ Rust's <a href="https://rust-lang.github.io/async-book/">async/await</a> allows
- <a href="https://docs.embassy.dev/embassy-nrf/">embassy-nrf</a>, for the Nordic Semiconductor nRF52, nRF53, nRF91 series. - <a href="https://docs.embassy.dev/embassy-nrf/">embassy-nrf</a>, for the Nordic Semiconductor nRF52, nRF53, nRF91 series.
- **Time that Just Works** - - **Time that Just Works** -
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. No more messing with hardware timers. <a href="https://docs.embassy.dev/embassy-time">embassy_time</a> provides Instant, Duration and Timer types that are globally available and never overflow.
- **Real-time ready** - - **Real-time ready** -
Tasks on the same async executor run cooperatively, but you can create multiple executors with different priorities, so that higher priority tasks preempt lower priority ones. See the <a href="https://github.com/embassy-rs/embassy/blob/master/examples/nrf/src/bin/multiprio.rs">example</a>. 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,8 +44,8 @@ The <a href="https://github.com/embassy-rs/nrf-softdevice">nrf-softdevice</a> cr
```rust,ignore ```rust,ignore
use defmt::info; use defmt::info;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
use embassy_nrf::Peripherals; use embassy_nrf::Peripherals;

38
ci.sh
View File

@ -54,25 +54,25 @@ cargo batch \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits,log \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits,log \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly,unstable-traits \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features nightly \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f410tb,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f411ce,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f411ce,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32f429zi,log,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h7b3ai,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32h7b3ai,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32l476vg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wb15cc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wb15cc,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l072cz,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l041f6,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32l041f6,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32l151cb-a,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f398ve,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f398ve,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32g0c1ve,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32g0c1ve,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f217zg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features nightly,stm32l552ze,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features nightly,stm32l552ze,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32wl54jc-cm0p,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features nightly,stm32wl54jc-cm0p,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wle5ub,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features nightly,stm32wle5ub,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f107vc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f107vc,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f103re,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f103re,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f100c4,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features nightly,stm32f100c4,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
--- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \ --- build --release --manifest-path embassy-boot/stm32/Cargo.toml --target thumbv7em-none-eabi --features embassy-stm32/stm32wl55jc-cm4 \
--- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \ --- build --release --manifest-path docs/modules/ROOT/examples/basic/Cargo.toml --target thumbv7em-none-eabi \

View File

@ -30,38 +30,38 @@ cargo batch \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,defmt \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,defmt \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,log \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi --features unstable-traits,log \
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi \ --- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv6m-none-eabi \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g473cc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g473cc,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585zi,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585zi,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb55vy,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb55vy,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55uc-cm4,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55uc-cm4,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r9zi,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r9zi,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303vc,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303vc,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f411ce,defmt,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f410tb,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi,log,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi-cm7,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l476vg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32l072cz,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32l151cb-a,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-executor/time-tick-32768hz,unstable-traits \ --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,embassy-time?/tick-32768hz,unstable-traits \
--- build --release --manifest-path examples/nrf/Cargo.toml --target thumbv7em-none-eabi --no-default-features --out-dir out/examples/nrf --bin raw_spawn \ --- build --release --manifest-path examples/nrf/Cargo.toml --target thumbv7em-none-eabi --no-default-features --out-dir out/examples/nrf --bin raw_spawn \
--- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --no-default-features --out-dir out/examples/stm32l0 --bin raw_spawn \ --- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --no-default-features --out-dir out/examples/stm32l0 --bin raw_spawn \

View File

@ -6,6 +6,7 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] }
embassy-time = { version = "0.1.0", path = "../../../../../embassy-time", features = ["defmt", "nightly"] }
embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] } embassy-nrf = { version = "0.1.0", path = "../../../../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "nightly"] }
defmt = "0.3" defmt = "0.3"

View File

@ -3,10 +3,10 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_nrf::peripherals::P0_13; use embassy_nrf::peripherals::P0_13;
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; // global logger use {defmt_rtt as _, panic_probe as _}; // global logger
#[embassy_executor::task] #[embassy_executor::task]

View File

@ -2,7 +2,7 @@
#![no_main] #![no_main]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -1,7 +1,7 @@
//! Executor specific to cortex-m devices. //! Executor specific to cortex-m devices.
use core::marker::PhantomData; use core::marker::PhantomData;
pub use embassy_executor::executor::*; pub use embassy_executor::*;
use crate::interrupt::{Interrupt, InterruptExt}; use crate::interrupt::{Interrupt, InterruptExt};
@ -60,11 +60,11 @@ impl<I: Interrupt> InterruptExecutor<I> {
/// The executor keeps running in the background through the interrupt. /// The executor keeps running in the background through the interrupt.
/// ///
/// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`] /// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`]
/// is returned instead of a [`Spawner`](embassy_executor::executor::Spawner) because the executor effectively runs in a /// is returned instead of a [`Spawner`](embassy_executor::Spawner) because the executor effectively runs in a
/// different "thread" (the interrupt), so spawning tasks on it is effectively /// different "thread" (the interrupt), so spawning tasks on it is effectively
/// sending them. /// sending them.
/// ///
/// To obtain a [`Spawner`](embassy_executor::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy_executor::executor::Spawner::for_current_executor()) from /// To obtain a [`Spawner`](embassy_executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy_executor::Spawner::for_current_executor()) from
/// a task running in it. /// a task running in it.
/// ///
/// This function requires `&'static mut self`. This means you have to store the /// This function requires `&'static mut self`. This means you have to store the

View File

@ -7,7 +7,7 @@ edition = "2021"
[package.metadata.embassy_docs] [package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
features = ["nightly", "defmt", "unstable-traits", "time", "time-tick-1mhz"] features = ["nightly", "defmt", "unstable-traits"]
flavors = [ flavors = [
{ name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] }, { name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] },
{ name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] }, { name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] },
@ -22,49 +22,25 @@ flavors = [
[features] [features]
default = [] default = []
std = ["time", "time-tick-1mhz", "embassy-macros/std"] std = ["embassy-macros/std"]
wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"] wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"]
# Enable nightly-only features # Enable nightly-only features
nightly = ["embedded-hal-async"] nightly = []
# Implement embedded-hal 1.0 alpha and embedded-hal-async traits. integrated-timers = ["dep:embassy-time"]
# Implement embedded-hal-async traits if `nightly` is set as well.
unstable-traits = ["embedded-hal-1"]
# Display a timestamp of the number of seconds since startup next to defmt log messages
# To use this you must have a time driver provided.
defmt-timestamp-uptime = ["defmt"]
# Enable `embassy_executor::time` module.
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
# Enabling it directly without supplying a time driver will fail to link.
time = []
# Set the `embassy_executor::time` tick rate.
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
# If you're not writing your own driver, check the driver documentation to customize the tick rate.
# If you're writing a driver and your tick rate is not listed here, please add it and send a PR!
time-tick-32768hz = ["time"]
time-tick-1000hz = ["time"]
time-tick-1mhz = ["time"]
time-tick-16mhz = ["time"]
[dependencies] [dependencies]
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true } log = { version = "0.4.14", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
futures-util = { version = "0.3.17", default-features = false } futures-util = { version = "0.3.17", default-features = false }
embassy-macros = { version = "0.1.0", path = "../embassy-macros"} embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true}
atomic-polyfill = "1.0.1" atomic-polyfill = "1.0.1"
critical-section = "1.1" critical-section = "1.1"
cfg-if = "1.0.0" cfg-if = "1.0.0"
# WASM dependencies # WASM dependencies
wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true } wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true }
js-sys = { version = "0.3", optional = true } js-sys = { version = "0.3", optional = true }
wasm-timer = { version = "0.2.5", optional = true }

View File

@ -0,0 +1,11 @@
# embassy-executor
An async/await executor designed for embedded usage.
- No `alloc`, no heap needed. Task futures are statically allocated.
- No "fixed capacity" data structures, executor works with 1 or 1000 tasks without needing config/tuning.
- Integrated timer queue: sleeping is easy, just do `Timer::after(Duration::from_secs(1)).await;`.
- No busy-loop polling: CPU sleeps when there's no work to do, using interrupts or `WFE/SEV`.
- Efficient polling: a wake will only poll the woken task, not all of them.
- Fair: a task can't monopolize CPU time even if it's constantly being woken. All other tasks get a chance to run before a given task gets polled for the second time.
- Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks.

View File

@ -1,44 +0,0 @@
//! Async task executor.
//!
//! This module provides an async/await executor designed for embedded usage.
//!
//! - No `alloc`, no heap needed. Task futures are statically allocated.
//! - No "fixed capacity" data structures, executor works with 1 or 1000 tasks without needing config/tuning.
//! - Integrated timer queue: sleeping is easy, just do `Timer::after(Duration::from_secs(1)).await;`.
//! - No busy-loop polling: CPU sleeps when there's no work to do, using interrupts or `WFE/SEV`.
//! - Efficient polling: a wake will only poll the woken task, not all of them.
//! - Fair: a task can't monopolize CPU time even if it's constantly being woken. All other tasks get a chance to run before a given task gets polled for the second time.
//! - Creating multiple executor instances is supported, to run tasks with multiple priority levels. This allows higher-priority tasks to preempt lower-priority tasks.
cfg_if::cfg_if! {
if #[cfg(cortex_m)] {
#[path="arch/cortex_m.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(target_arch="riscv32")] {
#[path="arch/riscv32.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] {
#[path="arch/xtensa.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(feature="wasm")] {
#[path="arch/wasm.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(feature="std")] {
#[path="arch/std.rs"]
mod arch;
pub use arch::*;
}
}
pub mod raw;
mod spawner;
pub use spawner::*;

View File

@ -195,9 +195,6 @@ macro_rules! unwrap {
} }
} }
#[cfg(feature = "defmt-timestamp-uptime")]
defmt::timestamp! {"{=u64:us}", crate::time::Instant::now().as_micros() }
#[derive(Debug, Copy, Clone, Eq, PartialEq)] #[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct NoneError; pub struct NoneError;

View File

@ -1,22 +1,44 @@
#![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)] #![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)]
#![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))]
#![cfg_attr(all(feature = "nightly", target_arch = "xtensa"), feature(asm_experimental_arch))] #![cfg_attr(all(feature = "nightly", target_arch = "xtensa"), feature(asm_experimental_arch))]
#![allow(clippy::new_without_default)] #![allow(clippy::new_without_default)]
#![doc = include_str!("../../README.md")] #![doc = include_str!("../README.md")]
#![warn(missing_docs)] #![warn(missing_docs)]
// This mod MUST go first, so that the others see its macros. // This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt; pub(crate) mod fmt;
pub mod executor;
#[cfg(feature = "time")]
pub mod time;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
pub use embassy_macros::{main, task}; pub use embassy_macros::{main, task};
#[doc(hidden)] cfg_if::cfg_if! {
/// Implementation details for embassy macros. DO NOT USE. if #[cfg(cortex_m)] {
pub mod export { #[path="arch/cortex_m.rs"]
pub use atomic_polyfill as atomic; mod arch;
pub use arch::*;
}
else if #[cfg(target_arch="riscv32")] {
#[path="arch/riscv32.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] {
#[path="arch/xtensa.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(feature="wasm")] {
#[path="arch/wasm.rs"]
mod arch;
pub use arch::*;
}
else if #[cfg(feature="std")] {
#[path="arch/std.rs"]
mod arch;
pub use arch::*;
}
} }
pub mod raw;
mod spawner;
pub use spawner::*;

View File

@ -8,7 +8,7 @@
//! executor wrappers in [`executor`](crate::executor) and the [`embassy_executor::task`](embassy_macros::task) macro, which are fully safe. //! executor wrappers in [`executor`](crate::executor) and the [`embassy_executor::task`](embassy_macros::task) macro, which are fully safe.
mod run_queue; mod run_queue;
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
mod timer_queue; mod timer_queue;
pub(crate) mod util; pub(crate) mod util;
mod waker; mod waker;
@ -22,22 +22,22 @@ use core::{mem, ptr};
use atomic_polyfill::{AtomicU32, Ordering}; use atomic_polyfill::{AtomicU32, Ordering};
use critical_section::CriticalSection; use critical_section::CriticalSection;
#[cfg(feature = "integrated-timers")]
use embassy_time::driver::{self, AlarmHandle};
#[cfg(feature = "integrated-timers")]
use embassy_time::Instant;
use self::run_queue::{RunQueue, RunQueueItem}; use self::run_queue::{RunQueue, RunQueueItem};
use self::util::UninitCell; use self::util::UninitCell;
pub use self::waker::task_from_waker; pub use self::waker::task_from_waker;
use super::SpawnToken; use super::SpawnToken;
#[cfg(feature = "time")]
use crate::time::driver::{self, AlarmHandle};
#[cfg(feature = "time")]
use crate::time::Instant;
/// Task is spawned (has a future) /// Task is spawned (has a future)
pub(crate) const STATE_SPAWNED: u32 = 1 << 0; pub(crate) const STATE_SPAWNED: u32 = 1 << 0;
/// Task is in the executor run queue /// Task is in the executor run queue
pub(crate) const STATE_RUN_QUEUED: u32 = 1 << 1; pub(crate) const STATE_RUN_QUEUED: u32 = 1 << 1;
/// Task is in the executor timer queue /// Task is in the executor timer queue
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
pub(crate) const STATE_TIMER_QUEUED: u32 = 1 << 2; pub(crate) const STATE_TIMER_QUEUED: u32 = 1 << 2;
/// Raw task header for use in task pointers. /// Raw task header for use in task pointers.
@ -50,9 +50,9 @@ pub struct TaskHeader {
pub(crate) executor: Cell<*const Executor>, // Valid if state != 0 pub(crate) executor: Cell<*const Executor>, // Valid if state != 0
pub(crate) poll_fn: UninitCell<unsafe fn(NonNull<TaskHeader>)>, // Valid if STATE_SPAWNED pub(crate) poll_fn: UninitCell<unsafe fn(NonNull<TaskHeader>)>, // Valid if STATE_SPAWNED
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
pub(crate) expires_at: Cell<Instant>, pub(crate) expires_at: Cell<Instant>,
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
pub(crate) timer_queue_item: timer_queue::TimerQueueItem, pub(crate) timer_queue_item: timer_queue::TimerQueueItem,
} }
@ -64,9 +64,9 @@ impl TaskHeader {
executor: Cell::new(ptr::null()), executor: Cell::new(ptr::null()),
poll_fn: UninitCell::uninit(), poll_fn: UninitCell::uninit(),
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
expires_at: Cell::new(Instant::from_ticks(0)), expires_at: Cell::new(Instant::from_ticks(0)),
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
timer_queue_item: timer_queue::TimerQueueItem::new(), timer_queue_item: timer_queue::TimerQueueItem::new(),
} }
} }
@ -267,9 +267,9 @@ pub struct Executor {
signal_fn: fn(*mut ()), signal_fn: fn(*mut ()),
signal_ctx: *mut (), signal_ctx: *mut (),
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
pub(crate) timer_queue: timer_queue::TimerQueue, pub(crate) timer_queue: timer_queue::TimerQueue,
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
alarm: AlarmHandle, alarm: AlarmHandle,
} }
@ -281,9 +281,9 @@ impl Executor {
/// ///
/// See [`Executor`] docs for details on `signal_fn`. /// See [`Executor`] docs for details on `signal_fn`.
pub fn new(signal_fn: fn(*mut ()), signal_ctx: *mut ()) -> Self { pub fn new(signal_fn: fn(*mut ()), signal_ctx: *mut ()) -> Self {
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
let alarm = unsafe { unwrap!(driver::allocate_alarm()) }; let alarm = unsafe { unwrap!(driver::allocate_alarm()) };
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
driver::set_alarm_callback(alarm, signal_fn, signal_ctx); driver::set_alarm_callback(alarm, signal_fn, signal_ctx);
Self { Self {
@ -291,9 +291,9 @@ impl Executor {
signal_fn, signal_fn,
signal_ctx, signal_ctx,
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
timer_queue: timer_queue::TimerQueue::new(), timer_queue: timer_queue::TimerQueue::new(),
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
alarm, alarm,
} }
} }
@ -346,13 +346,13 @@ impl Executor {
/// somehow schedule for `poll()` to be called later, at a time you know for sure there's /// somehow schedule for `poll()` to be called later, at a time you know for sure there's
/// no `poll()` already running. /// no `poll()` already running.
pub unsafe fn poll(&'static self) { pub unsafe fn poll(&'static self) {
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
self.timer_queue.dequeue_expired(Instant::now(), |task| wake_task(task)); self.timer_queue.dequeue_expired(Instant::now(), |task| wake_task(task));
self.run_queue.dequeue_all(|p| { self.run_queue.dequeue_all(|p| {
let task = p.as_ref(); let task = p.as_ref();
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
task.expires_at.set(Instant::MAX); task.expires_at.set(Instant::MAX);
let state = task.state.fetch_and(!STATE_RUN_QUEUED, Ordering::AcqRel); let state = task.state.fetch_and(!STATE_RUN_QUEUED, Ordering::AcqRel);
@ -369,11 +369,11 @@ impl Executor {
task.poll_fn.read()(p as _); task.poll_fn.read()(p as _);
// Enqueue or update into timer_queue // Enqueue or update into timer_queue
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
self.timer_queue.update(p); self.timer_queue.update(p);
}); });
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
{ {
// If this is already in the past, set_alarm will immediately trigger the alarm. // If this is already in the past, set_alarm will immediately trigger the alarm.
// This will cause `signal_fn` to be called, which will cause `poll()` to be called again, // This will cause `signal_fn` to be called, which will cause `poll()` to be called again,
@ -418,8 +418,9 @@ pub unsafe fn wake_task(task: NonNull<TaskHeader>) {
}) })
} }
#[cfg(feature = "time")] #[cfg(feature = "integrated-timers")]
pub(crate) unsafe fn register_timer(at: Instant, waker: &core::task::Waker) { #[no_mangle]
unsafe fn _embassy_time_schedule_wake(at: Instant, waker: &core::task::Waker) {
let task = waker::task_from_waker(waker); let task = waker::task_from_waker(waker);
let task = task.as_ref(); let task = task.as_ref();
let expires_at = task.expires_at.get(); let expires_at = task.expires_at.get();

View File

@ -4,9 +4,9 @@ use core::ptr;
use core::ptr::NonNull; use core::ptr::NonNull;
use atomic_polyfill::Ordering; use atomic_polyfill::Ordering;
use embassy_time::Instant;
use super::{TaskHeader, STATE_TIMER_QUEUED}; use super::{TaskHeader, STATE_TIMER_QUEUED};
use crate::time::Instant;
pub(crate) struct TimerQueueItem { pub(crate) struct TimerQueueItem {
next: Cell<*mut TaskHeader>, next: Cell<*mut TaskHeader>,

View File

@ -40,7 +40,7 @@ pub fn task_from_waker(waker: &Waker) -> NonNull<TaskHeader> {
// TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992 // TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992
let hack: &WakerHack = unsafe { mem::transmute(waker) }; let hack: &WakerHack = unsafe { mem::transmute(waker) };
if hack.vtable != &VTABLE { if hack.vtable != &VTABLE {
panic!("Found waker not created by the Embassy executor. `embassy_executor::time::Timer` only works with the Embassy executor.") panic!("Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor.")
} }
// safety: we never create a waker with a null data pointer. // safety: we never create a waker with a null data pointer.

View File

@ -8,8 +8,8 @@ src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/em
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-lora/src/" src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-lora/src/"
features = ["time", "defmt"] features = ["time", "defmt"]
flavors = [ flavors = [
{ name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] }, { name = "sx127x", target = "thumbv7em-none-eabihf", features = ["sx127x", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-time/tick-32768hz"] },
{ name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-executor/time-tick-32768hz"] }, { name = "stm32wl", target = "thumbv7em-none-eabihf", features = ["stm32wl", "embassy-stm32/stm32wl55jc-cm4", "embassy-stm32/time-driver-any", "embassy-time/tick-32768hz"] },
] ]
[lib] [lib]
@ -24,7 +24,7 @@ time = []
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true } log = { version = "0.4.14", optional = true }
embassy-executor = { version = "0.1.0", path = "../embassy-executor" } embassy-time = { version = "0.1.0", path = "../embassy-time" }
embassy-util = { version = "0.1.0", path = "../embassy-util" } embassy-util = { version = "0.1.0", path = "../embassy-util" }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }

View File

@ -18,6 +18,6 @@ pub struct LoraTimer;
impl lorawan_device::async_device::radio::Timer for LoraTimer { impl lorawan_device::async_device::radio::Timer for LoraTimer {
type DelayFuture<'m> = impl core::future::Future<Output = ()> + 'm; type DelayFuture<'m> = impl core::future::Future<Output = ()> + 'm;
fn delay_ms<'m>(&'m mut self, millis: u64) -> Self::DelayFuture<'m> { fn delay_ms<'m>(&'m mut self, millis: u64) -> Self::DelayFuture<'m> {
embassy_executor::time::Timer::after(embassy_executor::time::Duration::from_millis(millis)) embassy_time::Timer::after(embassy_time::Duration::from_millis(millis))
} }
} }

View File

@ -6,7 +6,7 @@
#![allow(dead_code)] #![allow(dead_code)]
use bit_field::BitField; use bit_field::BitField;
use embassy_executor::time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embedded_hal::digital::v2::OutputPin; use embedded_hal::digital::v2::OutputPin;
use embedded_hal_async::spi::SpiBus; use embedded_hal_async::spi::SpiBus;

View File

@ -34,8 +34,8 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, Toke
let main = quote! { let main = quote! {
#[wasm_bindgen::prelude::wasm_bindgen(start)] #[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn main() -> Result<(), wasm_bindgen::JsValue> { pub fn main() -> Result<(), wasm_bindgen::JsValue> {
static EXECUTOR: ::embassy_util::Forever<::embassy_executor::executor::Executor> = ::embassy_util::Forever::new(); static EXECUTOR: ::embassy_util::Forever<::embassy_executor::Executor> = ::embassy_util::Forever::new();
let executor = EXECUTOR.put(::embassy_executor::executor::Executor::new()); let executor = EXECUTOR.put(::embassy_executor::Executor::new());
executor.start(|spawner| { executor.start(|spawner| {
spawner.spawn(__embassy_main(spawner)).unwrap(); spawner.spawn(__embassy_main(spawner)).unwrap();
@ -48,7 +48,7 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, Toke
#[cfg(all(feature = "std", not(feature = "wasm")))] #[cfg(all(feature = "std", not(feature = "wasm")))]
let main = quote! { let main = quote! {
fn main() -> ! { fn main() -> ! {
let mut executor = ::embassy_executor::executor::Executor::new(); let mut executor = ::embassy_executor::Executor::new();
let executor = unsafe { __make_static(&mut executor) }; let executor = unsafe { __make_static(&mut executor) };
executor.run(|spawner| { executor.run(|spawner| {
@ -61,7 +61,7 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, Toke
let main = quote! { let main = quote! {
#[cortex_m_rt::entry] #[cortex_m_rt::entry]
fn main() -> ! { fn main() -> ! {
let mut executor = ::embassy_executor::executor::Executor::new(); let mut executor = ::embassy_executor::Executor::new();
let executor = unsafe { __make_static(&mut executor) }; let executor = unsafe { __make_static(&mut executor) };
executor.run(|spawner| { executor.run(|spawner| {

View File

@ -64,9 +64,9 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn) -> Result<TokenStream, Toke
// in the user's code. // in the user's code.
#task_inner #task_inner
#visibility fn #task_ident(#fargs) -> ::embassy_executor::executor::SpawnToken<impl Sized> { #visibility fn #task_ident(#fargs) -> ::embassy_executor::SpawnToken<impl Sized> {
type Fut = impl ::core::future::Future + 'static; type Fut = impl ::core::future::Future + 'static;
static POOL: ::embassy_executor::executor::raw::TaskPool<Fut, #pool_size> = ::embassy_executor::executor::raw::TaskPool::new(); static POOL: ::embassy_executor::raw::TaskPool<Fut, #pool_size> = ::embassy_executor::raw::TaskPool::new();
unsafe { POOL._spawn_async_fn(move || #task_inner_ident(#(#arg_names,)*)) } unsafe { POOL._spawn_async_fn(move || #task_inner_ident(#(#arg_names,)*)) }
} }
}; };

View File

@ -7,7 +7,7 @@ edition = "2021"
[package.metadata.embassy_docs] [package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-net-v$VERSION/embassy-net/src/" src_base = "https://github.com/embassy-rs/embassy/blob/embassy-net-v$VERSION/embassy-net/src/"
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-net/src/" src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-net/src/"
features = [ "pool-4", "defmt", "tcp", "dns", "dhcpv4", "proto-ipv6", "medium-ethernet", "medium-ip", "embassy-executor/time", "embassy-executor/time-tick-1mhz"] features = [ "pool-4", "defmt", "tcp", "dns", "dhcpv4", "proto-ipv6", "medium-ethernet", "medium-ip", "embassy-time/tick-1mhz"]
target = "thumbv7em-none-eabi" target = "thumbv7em-none-eabi"
[features] [features]
@ -37,16 +37,16 @@ unstable-traits = []
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true } log = { version = "0.4.14", optional = true }
embassy-executor = { version = "0.1.0", path = "../embassy-executor" } embassy-time = { version = "0.1.0", path = "../embassy-time" }
embassy-util = { version = "0.1.0", path = "../embassy-util" } embassy-util = { version = "0.1.0", path = "../embassy-util" }
embedded-io = { version = "0.3.0", features = [ "async" ] } embedded-io = { version = "0.3.0", features = [ "async" ] }
managed = { version = "0.8.0", default-features = false, features = [ "map" ] } managed = { version = "0.8.0", default-features = false, features = [ "map" ] }
heapless = { version = "0.7.5", default-features = false } heapless = { version = "0.7.5", default-features = false }
as-slice = "0.2.1" as-slice = "0.2.1"
generic-array = { version = "0.14.4", default-features = false } generic-array = { version = "0.14.4", default-features = false }
stable_deref_trait = { version = "1.2.0", default-features = false } stable_deref_trait = { version = "1.2.0", default-features = false }
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
atomic-pool = "0.2.1" atomic-pool = "0.2.1"
atomic-polyfill = "0.1.5" atomic-polyfill = "0.1.5"
embedded-nal-async = "0.2.0" embedded-nal-async = "0.2.0"

View File

@ -2,7 +2,7 @@ use core::cell::UnsafeCell;
use core::future::Future; use core::future::Future;
use core::task::{Context, Poll}; use core::task::{Context, Poll};
use embassy_executor::time::{Instant, Timer}; use embassy_time::{Instant, Timer};
use embassy_util::waitqueue::WakerRegistration; use embassy_util::waitqueue::WakerRegistration;
use futures::future::poll_fn; use futures::future::poll_fn;
use futures::pin_mut; use futures::pin_mut;

View File

@ -16,7 +16,7 @@ flavors = [
[features] [features]
time = ["embassy-executor/time"] time = ["dep:embassy-time"]
defmt = ["dep:defmt", "embassy-executor/defmt", "embassy-util/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"] defmt = ["dep:defmt", "embassy-executor/defmt", "embassy-util/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"]
@ -57,7 +57,7 @@ _nrf5340-net = ["_nrf5340", "nrf5340-net-pac"]
_nrf5340 = ["_gpio-p1", "_dppi"] _nrf5340 = ["_gpio-p1", "_dppi"]
_nrf9160 = ["nrf9160-pac", "_dppi"] _nrf9160 = ["nrf9160-pac", "_dppi"]
_time-driver = ["embassy-executor/time-tick-32768hz", "time"] _time-driver = ["dep:embassy-time", "embassy-time?/tick-32768hz"]
_ppi = [] _ppi = []
_dppi = [] _dppi = []
@ -65,6 +65,7 @@ _gpio-p1 = []
[dependencies] [dependencies]
embassy-executor = { version = "0.1.0", path = "../embassy-executor", optional = true } embassy-executor = { version = "0.1.0", path = "../embassy-executor", optional = true }
embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true }
embassy-util = { version = "0.1.0", path = "../embassy-util" } embassy-util = { version = "0.1.0", path = "../embassy-util" }
embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]}
embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }

View File

@ -3,7 +3,7 @@ use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering};
use core::{mem, ptr}; use core::{mem, ptr};
use critical_section::CriticalSection; use critical_section::CriticalSection;
use embassy_executor::time::driver::{AlarmHandle, Driver}; use embassy_time::driver::{AlarmHandle, Driver};
use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_util::blocking_mutex::CriticalSectionMutex as Mutex; use embassy_util::blocking_mutex::CriticalSectionMutex as Mutex;
@ -119,7 +119,7 @@ struct RtcDriver {
} }
const ALARM_STATE_NEW: AlarmState = AlarmState::new(); const ALARM_STATE_NEW: AlarmState = AlarmState::new();
embassy_executor::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { embassy_time::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver {
period: AtomicU32::new(0), period: AtomicU32::new(0),
alarm_count: AtomicU8::new(0), alarm_count: AtomicU8::new(0),
alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]),

View File

@ -12,9 +12,9 @@ use core::sync::atomic::Ordering::SeqCst;
use core::task::Poll; use core::task::Poll;
use embassy_embedded_hal::SetConfig; use embassy_embedded_hal::SetConfig;
#[cfg(feature = "time")]
use embassy_executor::time::{Duration, Instant};
use embassy_hal_common::{into_ref, PeripheralRef}; use embassy_hal_common::{into_ref, PeripheralRef};
#[cfg(feature = "time")]
use embassy_time::{Duration, Instant};
use embassy_util::waitqueue::AtomicWaker; use embassy_util::waitqueue::AtomicWaker;
use futures::future::poll_fn; use futures::future::poll_fn;

View File

@ -28,7 +28,8 @@ unstable-traits = ["embedded-hal-1"]
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../embassy-util" } embassy-util = { version = "0.1.0", path = "../embassy-util" }
embassy-executor = { version = "0.1.0", path = "../embassy-executor", features = [ "time-tick-1mhz" ] } embassy-executor = { version = "0.1.0", path = "../embassy-executor" }
embassy-time = { version = "0.1.0", path = "../embassy-time", features = [ "tick-1mhz" ] }
embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]}
embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }

View File

@ -2,7 +2,7 @@ use core::cell::Cell;
use atomic_polyfill::{AtomicU8, Ordering}; use atomic_polyfill::{AtomicU8, Ordering};
use critical_section::CriticalSection; use critical_section::CriticalSection;
use embassy_executor::time::driver::{AlarmHandle, Driver}; use embassy_time::driver::{AlarmHandle, Driver};
use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_util::blocking_mutex::Mutex; use embassy_util::blocking_mutex::Mutex;
@ -26,7 +26,7 @@ struct TimerDriver {
next_alarm: AtomicU8, next_alarm: AtomicU8,
} }
embassy_executor::time_driver_impl!(static DRIVER: TimerDriver = TimerDriver{ embassy_time::time_driver_impl!(static DRIVER: TimerDriver = TimerDriver{
alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [DUMMY_ALARM; ALARM_COUNT]), alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [DUMMY_ALARM; ALARM_COUNT]),
next_alarm: AtomicU8::new(0), next_alarm: AtomicU8::new(0),
}); });

View File

@ -10,7 +10,7 @@ src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-stm32
# TODO: sdmmc # TODO: sdmmc
# TODO: net # TODO: net
# TODO: subghz # TODO: subghz
features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "exti", "time-driver-any", "embassy-executor/time-tick-32768hz"] features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "exti", "time-driver-any", "embassy-time/tick-32768hz"]
flavors = [ flavors = [
{ regex_feature = "stm32f0.*", target = "thumbv6m-none-eabi" }, { regex_feature = "stm32f0.*", target = "thumbv6m-none-eabi" },
{ regex_feature = "stm32f1.*", target = "thumbv7m-none-eabi" }, { regex_feature = "stm32f1.*", target = "thumbv7m-none-eabi" },
@ -33,6 +33,7 @@ flavors = [
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../embassy-util" } embassy-util = { version = "0.1.0", path = "../embassy-util" }
embassy-executor = { version = "0.1.0", path = "../embassy-executor" } embassy-executor = { version = "0.1.0", path = "../embassy-executor" }
embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true }
embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-4"]} embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-4"]}
embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
@ -80,7 +81,7 @@ exti = []
# Features starting with `_` are for internal use only. They're not intended # Features starting with `_` are for internal use only. They're not intended
# to be enabled by other crates, and are not covered by semver guarantees. # to be enabled by other crates, and are not covered by semver guarantees.
_time-driver = ["embassy-executor/time"] _time-driver = ["dep:embassy-time"]
time-driver-any = ["_time-driver"] time-driver-any = ["_time-driver"]
time-driver-tim2 = ["_time-driver"] time-driver-tim2 = ["_time-driver"]
time-driver-tim3 = ["_time-driver"] time-driver-tim3 = ["_time-driver"]

View File

@ -504,7 +504,7 @@ impl<'d> SubGhz<'d, NoDma, NoDma> {
/// ///
/// sg.set_standby(StandbyClk::Rc)?; /// sg.set_standby(StandbyClk::Rc)?;
/// unsafe { sg.set_sleep(SleepCfg::default())? }; /// unsafe { sg.set_sleep(SleepCfg::default())? };
/// embassy_executor::time::Timer::after(embassy_executor::time::Duration::from_micros(500)).await; /// embassy_time::Timer::after(embassy_time::Duration::from_micros(500)).await;
/// unsafe { wakeup() }; /// unsafe { wakeup() };
/// # Ok::<(), embassy_stm32::subghz::Error>(()) /// # Ok::<(), embassy_stm32::subghz::Error>(())
/// ``` /// ```

View File

@ -439,9 +439,9 @@ impl From<Timeout> for [u8; 3] {
} }
} }
impl From<Timeout> for embassy_executor::time::Duration { impl From<Timeout> for embassy_time::Duration {
fn from(to: Timeout) -> Self { fn from(to: Timeout) -> Self {
embassy_executor::time::Duration::from_micros(to.as_micros().into()) embassy_time::Duration::from_micros(to.as_micros().into())
} }
} }

View File

@ -44,17 +44,17 @@ impl From<RampTime> for core::time::Duration {
} }
} }
impl From<RampTime> for embassy_executor::time::Duration { impl From<RampTime> for embassy_time::Duration {
fn from(rt: RampTime) -> Self { fn from(rt: RampTime) -> Self {
match rt { match rt {
RampTime::Micros10 => embassy_executor::time::Duration::from_micros(10), RampTime::Micros10 => embassy_time::Duration::from_micros(10),
RampTime::Micros20 => embassy_executor::time::Duration::from_micros(20), RampTime::Micros20 => embassy_time::Duration::from_micros(20),
RampTime::Micros40 => embassy_executor::time::Duration::from_micros(40), RampTime::Micros40 => embassy_time::Duration::from_micros(40),
RampTime::Micros80 => embassy_executor::time::Duration::from_micros(80), RampTime::Micros80 => embassy_time::Duration::from_micros(80),
RampTime::Micros200 => embassy_executor::time::Duration::from_micros(200), RampTime::Micros200 => embassy_time::Duration::from_micros(200),
RampTime::Micros800 => embassy_executor::time::Duration::from_micros(800), RampTime::Micros800 => embassy_time::Duration::from_micros(800),
RampTime::Micros1700 => embassy_executor::time::Duration::from_micros(1700), RampTime::Micros1700 => embassy_time::Duration::from_micros(1700),
RampTime::Micros3400 => embassy_executor::time::Duration::from_micros(3400), RampTime::Micros3400 => embassy_time::Duration::from_micros(3400),
} }
} }
} }

View File

@ -4,8 +4,8 @@ use core::sync::atomic::{compiler_fence, Ordering};
use core::{mem, ptr}; use core::{mem, ptr};
use atomic_polyfill::{AtomicU32, AtomicU8}; use atomic_polyfill::{AtomicU32, AtomicU8};
use embassy_executor::time::driver::{AlarmHandle, Driver}; use embassy_time::driver::{AlarmHandle, Driver};
use embassy_executor::time::TICKS_PER_SECOND; use embassy_time::TICKS_PER_SECOND;
use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_util::blocking_mutex::Mutex; use embassy_util::blocking_mutex::Mutex;
use stm32_metapac::timer::regs; use stm32_metapac::timer::regs;
@ -133,7 +133,7 @@ struct RtcDriver {
const ALARM_STATE_NEW: AlarmState = AlarmState::new(); const ALARM_STATE_NEW: AlarmState = AlarmState::new();
embassy_executor::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver { embassy_time::time_driver_impl!(static DRIVER: RtcDriver = RtcDriver {
period: AtomicU32::new(0), period: AtomicU32::new(0),
alarm_count: AtomicU8::new(0), alarm_count: AtomicU8::new(0),
alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]), alarms: Mutex::const_new(CriticalSectionRawMutex::new(), [ALARM_STATE_NEW; ALARM_COUNT]),

View File

@ -5,8 +5,8 @@ use core::sync::atomic::Ordering;
use core::task::Poll; use core::task::Poll;
use atomic_polyfill::{AtomicBool, AtomicU8}; use atomic_polyfill::{AtomicBool, AtomicU8};
use embassy_executor::time::{block_for, Duration};
use embassy_hal_common::into_ref; use embassy_hal_common::into_ref;
use embassy_time::{block_for, Duration};
use embassy_usb::driver::{self, EndpointAllocError, EndpointError, Event, Unsupported}; use embassy_usb::driver::{self, EndpointAllocError, EndpointError, Event, Unsupported};
use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection};
use embassy_util::waitqueue::AtomicWaker; use embassy_util::waitqueue::AtomicWaker;

54
embassy-time/Cargo.toml Normal file
View File

@ -0,0 +1,54 @@
[package]
name = "embassy-time"
version = "0.1.0"
edition = "2021"
[package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-time-v$VERSION/embassy-time/src/"
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-time/src/"
features = ["nightly", "defmt", "unstable-traits", "std"]
target = "x86_64-unknown-linux-gnu"
[features]
std = ["tick-1mhz"]
wasm = ["dep:wasm-bindgen", "dep:js-sys", "dep:wasm-timer", "tick-1mhz"]
# Enable nightly-only features
nightly = ["embedded-hal-async"]
# Implement embedded-hal 1.0 alpha and embedded-hal-async traits.
# Implement embedded-hal-async traits if `nightly` is set as well.
unstable-traits = ["embedded-hal-1"]
# Display a timestamp of the number of seconds since startup next to defmt log messages
# To use this you must have a time driver provided.
defmt-timestamp-uptime = ["defmt"]
# Set the `embassy_time` tick rate.
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
# If you're not writing your own driver, check the driver documentation to customize the tick rate.
# If you're writing a driver and your tick rate is not listed here, please add it and send a PR!
tick-32768hz = []
tick-1000hz = []
tick-1mhz = []
tick-16mhz = []
[dependencies]
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true}
futures-util = { version = "0.3.17", default-features = false }
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
atomic-polyfill = "1.0.1"
critical-section = "1.1"
cfg-if = "1.0.0"
# WASM dependencies
wasm-bindgen = { version = "0.2.76", features = ["nightly"], optional = true }
js-sys = { version = "0.3", optional = true }
wasm-timer = { version = "0.2.5", optional = true }

View File

@ -33,7 +33,7 @@ mod eh1 {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] {
use crate::time::Timer; use crate::Timer;
use core::future::Future; use core::future::Future;
use futures_util::FutureExt; use futures_util::FutureExt;

View File

@ -1,17 +1,17 @@
//! Time driver interface //! Time driver interface
//! //!
//! This module defines the interface a driver needs to implement to power the `embassy_executor::time` module. //! This module defines the interface a driver needs to implement to power the `embassy_time` module.
//! //!
//! # Implementing a driver //! # Implementing a driver
//! //!
//! - Define a struct `MyDriver` //! - Define a struct `MyDriver`
//! - Implement [`Driver`] for it //! - Implement [`Driver`] for it
//! - Register it as the global driver with [`time_driver_impl`]. //! - Register it as the global driver with [`time_driver_impl`].
//! - Enable the Cargo features `embassy-executor/time` and one of `embassy-executor/time-tick-*` corresponding to the //! - Enable the Cargo features `embassy-executor/time` and one of `embassy-time/tick-*` corresponding to the
//! tick rate of your driver. //! tick rate of your driver.
//! //!
//! If you wish to make the tick rate configurable by the end user, you should do so by exposing your own //! If you wish to make the tick rate configurable by the end user, you should do so by exposing your own
//! Cargo features and having each enable the corresponding `embassy-executor/time-tick-*`. //! Cargo features and having each enable the corresponding `embassy-time/tick-*`.
//! //!
//! # Linkage details //! # Linkage details
//! //!
@ -34,10 +34,10 @@
//! # Example //! # Example
//! //!
//! ``` //! ```
//! use embassy_executor::time::driver::{Driver, AlarmHandle}; //! use embassy_time::driver::{Driver, AlarmHandle};
//! //!
//! struct MyDriver{}; // not public! //! struct MyDriver{}; // not public!
//! embassy_executor::time_driver_impl!(static DRIVER: MyDriver = MyDriver{}); //! embassy_time::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
//! //!
//! impl Driver for MyDriver { //! impl Driver for MyDriver {
//! fn now(&self) -> u64 { //! fn now(&self) -> u64 {
@ -121,17 +121,25 @@ extern "Rust" {
fn _embassy_time_set_alarm(alarm: AlarmHandle, timestamp: u64); fn _embassy_time_set_alarm(alarm: AlarmHandle, timestamp: u64);
} }
pub(crate) fn now() -> u64 { /// See [`Driver::now`]
pub fn now() -> u64 {
unsafe { _embassy_time_now() } unsafe { _embassy_time_now() }
} }
/// See [`Driver::allocate_alarm`]
///
/// Safety: it is UB to make the alarm fire before setting a callback. /// Safety: it is UB to make the alarm fire before setting a callback.
pub(crate) unsafe fn allocate_alarm() -> Option<AlarmHandle> { pub unsafe fn allocate_alarm() -> Option<AlarmHandle> {
_embassy_time_allocate_alarm() _embassy_time_allocate_alarm()
} }
pub(crate) fn set_alarm_callback(alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) {
/// See [`Driver::set_alarm_callback`]
pub fn set_alarm_callback(alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) {
unsafe { _embassy_time_set_alarm_callback(alarm, callback, ctx) } unsafe { _embassy_time_set_alarm_callback(alarm, callback, ctx) }
} }
pub(crate) fn set_alarm(alarm: AlarmHandle, timestamp: u64) {
/// See [`Driver::set_alarm`]
pub fn set_alarm(alarm: AlarmHandle, timestamp: u64) {
unsafe { _embassy_time_set_alarm(alarm, timestamp) } unsafe { _embassy_time_set_alarm(alarm, timestamp) }
} }
@ -145,26 +153,22 @@ macro_rules! time_driver_impl {
#[no_mangle] #[no_mangle]
fn _embassy_time_now() -> u64 { fn _embassy_time_now() -> u64 {
<$t as $crate::time::driver::Driver>::now(&$name) <$t as $crate::driver::Driver>::now(&$name)
} }
#[no_mangle] #[no_mangle]
unsafe fn _embassy_time_allocate_alarm() -> Option<$crate::time::driver::AlarmHandle> { unsafe fn _embassy_time_allocate_alarm() -> Option<$crate::driver::AlarmHandle> {
<$t as $crate::time::driver::Driver>::allocate_alarm(&$name) <$t as $crate::driver::Driver>::allocate_alarm(&$name)
} }
#[no_mangle] #[no_mangle]
fn _embassy_time_set_alarm_callback( fn _embassy_time_set_alarm_callback(alarm: $crate::driver::AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) {
alarm: $crate::time::driver::AlarmHandle, <$t as $crate::driver::Driver>::set_alarm_callback(&$name, alarm, callback, ctx)
callback: fn(*mut ()),
ctx: *mut (),
) {
<$t as $crate::time::driver::Driver>::set_alarm_callback(&$name, alarm, callback, ctx)
} }
#[no_mangle] #[no_mangle]
fn _embassy_time_set_alarm(alarm: $crate::time::driver::AlarmHandle, timestamp: u64) { fn _embassy_time_set_alarm(alarm: $crate::driver::AlarmHandle, timestamp: u64) {
<$t as $crate::time::driver::Driver>::set_alarm(&$name, alarm, timestamp) <$t as $crate::driver::Driver>::set_alarm(&$name, alarm, timestamp)
} }
}; };
} }

View File

@ -6,7 +6,7 @@ use std::{mem, ptr, thread};
use atomic_polyfill::{AtomicU8, Ordering}; use atomic_polyfill::{AtomicU8, Ordering};
use crate::time::driver::{AlarmHandle, Driver}; use crate::driver::{AlarmHandle, Driver};
const ALARM_COUNT: usize = 4; const ALARM_COUNT: usize = 4;

View File

@ -7,7 +7,7 @@ use atomic_polyfill::{AtomicU8, Ordering};
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
use wasm_timer::Instant as StdInstant; use wasm_timer::Instant as StdInstant;
use crate::time::driver::{AlarmHandle, Driver}; use crate::driver::{AlarmHandle, Driver};
const ALARM_COUNT: usize = 4; const ALARM_COUNT: usize = 4;

225
embassy-time/src/fmt.rs Normal file
View File

@ -0,0 +1,225 @@
#![macro_use]
#![allow(unused_macros)]
#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");
macro_rules! assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::assert!($($x)*);
#[cfg(feature = "defmt")]
::defmt::assert!($($x)*);
}
};
}
macro_rules! assert_eq {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::assert_eq!($($x)*);
#[cfg(feature = "defmt")]
::defmt::assert_eq!($($x)*);
}
};
}
macro_rules! assert_ne {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::assert_ne!($($x)*);
#[cfg(feature = "defmt")]
::defmt::assert_ne!($($x)*);
}
};
}
macro_rules! debug_assert {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::debug_assert!($($x)*);
#[cfg(feature = "defmt")]
::defmt::debug_assert!($($x)*);
}
};
}
macro_rules! debug_assert_eq {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::debug_assert_eq!($($x)*);
#[cfg(feature = "defmt")]
::defmt::debug_assert_eq!($($x)*);
}
};
}
macro_rules! debug_assert_ne {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::debug_assert_ne!($($x)*);
#[cfg(feature = "defmt")]
::defmt::debug_assert_ne!($($x)*);
}
};
}
macro_rules! todo {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::todo!($($x)*);
#[cfg(feature = "defmt")]
::defmt::todo!($($x)*);
}
};
}
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
::defmt::unreachable!($($x)*);
}
};
}
macro_rules! panic {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))]
::core::panic!($($x)*);
#[cfg(feature = "defmt")]
::defmt::panic!($($x)*);
}
};
}
macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
::log::trace!($s $(, $x)*);
#[cfg(feature = "defmt")]
::defmt::trace!($s $(, $x)*);
#[cfg(not(any(feature = "log", feature="defmt")))]
let _ = ($( & $x ),*);
}
};
}
macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
::log::debug!($s $(, $x)*);
#[cfg(feature = "defmt")]
::defmt::debug!($s $(, $x)*);
#[cfg(not(any(feature = "log", feature="defmt")))]
let _ = ($( & $x ),*);
}
};
}
macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
::log::info!($s $(, $x)*);
#[cfg(feature = "defmt")]
::defmt::info!($s $(, $x)*);
#[cfg(not(any(feature = "log", feature="defmt")))]
let _ = ($( & $x ),*);
}
};
}
macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
::log::warn!($s $(, $x)*);
#[cfg(feature = "defmt")]
::defmt::warn!($s $(, $x)*);
#[cfg(not(any(feature = "log", feature="defmt")))]
let _ = ($( & $x ),*);
}
};
}
macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
::log::error!($s $(, $x)*);
#[cfg(feature = "defmt")]
::defmt::error!($s $(, $x)*);
#[cfg(not(any(feature = "log", feature="defmt")))]
let _ = ($( & $x ),*);
}
};
}
#[cfg(feature = "defmt")]
macro_rules! unwrap {
($($x:tt)*) => {
::defmt::unwrap!($($x)*)
};
}
#[cfg(not(feature = "defmt"))]
macro_rules! unwrap {
($arg:expr) => {
match $crate::fmt::Try::into_result($arg) {
::core::result::Result::Ok(t) => t,
::core::result::Result::Err(e) => {
::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e);
}
}
};
($arg:expr, $($msg:expr),+ $(,)? ) => {
match $crate::fmt::Try::into_result($arg) {
::core::result::Result::Ok(t) => t,
::core::result::Result::Err(e) => {
::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e);
}
}
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct NoneError;
pub trait Try {
type Ok;
type Error;
fn into_result(self) -> Result<Self::Ok, Self::Error>;
}
impl<T> Try for Option<T> {
type Ok = T;
type Error = NoneError;
#[inline]
fn into_result(self) -> Result<T, NoneError> {
self.ok_or(NoneError)
}
}
impl<T, E> Try for Result<T, E> {
type Ok = T;
type Error = E;
#[inline]
fn into_result(self) -> Self {
self
}
}

View File

@ -1,3 +1,8 @@
#![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)]
#![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))]
#![allow(clippy::new_without_default)]
#![warn(missing_docs)]
//! Timekeeping, delays and timeouts. //! Timekeeping, delays and timeouts.
//! //!
//! Timekeeping is done with elapsed time since system boot. Time is represented in //! Timekeeping is done with elapsed time since system boot. Time is represented in
@ -26,7 +31,7 @@
//! like `2021-08-24 13:33:21`). //! like `2021-08-24 13:33:21`).
//! //!
//! If persistence across reboots is not needed, support can be built on top of //! If persistence across reboots is not needed, support can be built on top of
//! `embassy_executor::time` by storing the offset between "seconds elapsed since boot" //! `embassy_time` by storing the offset between "seconds elapsed since boot"
//! and "seconds since unix epoch". //! and "seconds since unix epoch".
//! //!
//! # Time driver //! # Time driver
@ -35,12 +40,13 @@
//! Only one driver can be active in a program. //! Only one driver can be active in a program.
//! //!
//! All methods and structs transparently call into the active driver. This makes it //! All methods and structs transparently call into the active driver. This makes it
//! possible for libraries to use `embassy_executor::time` in a driver-agnostic way without //! possible for libraries to use `embassy_time` in a driver-agnostic way without
//! requiring generic parameters. //! requiring generic parameters.
//! //!
//! For more details, check the [`driver`] module. //! For more details, check the [`driver`] module.
#![deny(missing_docs)] // This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
mod delay; mod delay;
pub mod driver; pub mod driver;
@ -50,7 +56,6 @@ mod timer;
#[cfg(feature = "std")] #[cfg(feature = "std")]
mod driver_std; mod driver_std;
#[cfg(feature = "wasm")] #[cfg(feature = "wasm")]
mod driver_wasm; mod driver_wasm;
@ -59,24 +64,24 @@ pub use duration::Duration;
pub use instant::Instant; pub use instant::Instant;
pub use timer::{with_timeout, Ticker, TimeoutError, Timer}; pub use timer::{with_timeout, Ticker, TimeoutError, Timer};
#[cfg(feature = "time-tick-1000hz")] #[cfg(feature = "tick-1000hz")]
const TPS: u64 = 1_000; const TPS: u64 = 1_000;
#[cfg(feature = "time-tick-32768hz")] #[cfg(feature = "tick-32768hz")]
const TPS: u64 = 32_768; const TPS: u64 = 32_768;
#[cfg(feature = "time-tick-1mhz")] #[cfg(feature = "tick-1mhz")]
const TPS: u64 = 1_000_000; const TPS: u64 = 1_000_000;
#[cfg(feature = "time-tick-16mhz")] #[cfg(feature = "tick-16mhz")]
const TPS: u64 = 16_000_000; const TPS: u64 = 16_000_000;
/// Ticks per second of the global timebase. /// Ticks per second of the global timebase.
/// ///
/// This value is specified by the `time-tick-*` Cargo features, which /// This value is specified by the `tick-*` Cargo features, which
/// should be set by the time driver. Some drivers support a fixed tick rate, others /// should be set by the time driver. Some drivers support a fixed tick rate, others
/// allow you to choose a tick rate with Cargo features of their own. You should not /// allow you to choose a tick rate with Cargo features of their own. You should not
/// set the `time-tick-*` features for embassy yourself as an end user. /// set the `tick-*` features for embassy yourself as an end user.
pub const TICKS_PER_SECOND: u64 = TPS; pub const TICKS_PER_SECOND: u64 = TPS;
const fn gcd(a: u64, b: u64) -> u64 { const fn gcd(a: u64, b: u64) -> u64 {
@ -89,3 +94,6 @@ const fn gcd(a: u64, b: u64) -> u64 {
pub(crate) const GCD_1K: u64 = gcd(TICKS_PER_SECOND, 1_000); pub(crate) const GCD_1K: u64 = gcd(TICKS_PER_SECOND, 1_000);
pub(crate) const GCD_1M: u64 = gcd(TICKS_PER_SECOND, 1_000_000); pub(crate) const GCD_1M: u64 = gcd(TICKS_PER_SECOND, 1_000_000);
#[cfg(feature = "defmt-timestamp-uptime")]
defmt::timestamp! {"{=u64:us}", Instant::now().as_micros() }

View File

@ -1,12 +1,11 @@
use core::future::Future; use core::future::Future;
use core::pin::Pin; use core::pin::Pin;
use core::task::{Context, Poll}; use core::task::{Context, Poll, Waker};
use futures_util::future::{select, Either}; use futures_util::future::{select, Either};
use futures_util::{pin_mut, Stream}; use futures_util::{pin_mut, Stream};
use crate::executor::raw; use crate::{Duration, Instant};
use crate::time::{Duration, Instant};
/// Error returned by [`with_timeout`] on timeout. /// Error returned by [`with_timeout`] on timeout.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
@ -49,7 +48,7 @@ impl Timer {
/// # #![feature(type_alias_impl_trait)] /// # #![feature(type_alias_impl_trait)]
/// # /// #
/// # fn foo() {} /// # fn foo() {}
/// use embassy_executor::time::{Duration, Timer}; /// use embassy_time::{Duration, Timer};
/// ///
/// #[embassy_executor::task] /// #[embassy_executor::task]
/// async fn demo_sleep_seconds() { /// async fn demo_sleep_seconds() {
@ -73,7 +72,7 @@ impl Future for Timer {
if self.yielded_once && self.expires_at <= Instant::now() { if self.yielded_once && self.expires_at <= Instant::now() {
Poll::Ready(()) Poll::Ready(())
} else { } else {
unsafe { raw::register_timer(self.expires_at, cx.waker()) }; schedule_wake(self.expires_at, cx.waker());
self.yielded_once = true; self.yielded_once = true;
Poll::Pending Poll::Pending
} }
@ -88,7 +87,7 @@ impl Future for Timer {
/// ``` no_run /// ``` no_run
/// # #![feature(type_alias_impl_trait)] /// # #![feature(type_alias_impl_trait)]
/// # /// #
/// use embassy_executor::time::{Duration, Timer}; /// use embassy_time::{Duration, Timer};
/// # fn foo() {} /// # fn foo() {}
/// ///
/// #[embassy_executor::task] /// #[embassy_executor::task]
@ -108,7 +107,7 @@ impl Future for Timer {
/// ``` no_run /// ``` no_run
/// # #![feature(type_alias_impl_trait)] /// # #![feature(type_alias_impl_trait)]
/// # /// #
/// use embassy_executor::time::{Duration, Ticker}; /// use embassy_time::{Duration, Ticker};
/// use futures::StreamExt; /// use futures::StreamExt;
/// # fn foo(){} /// # fn foo(){}
/// ///
@ -144,8 +143,16 @@ impl Stream for Ticker {
self.expires_at += dur; self.expires_at += dur;
Poll::Ready(Some(())) Poll::Ready(Some(()))
} else { } else {
unsafe { raw::register_timer(self.expires_at, cx.waker()) }; schedule_wake(self.expires_at, cx.waker());
Poll::Pending Poll::Pending
} }
} }
} }
extern "Rust" {
fn _embassy_time_schedule_wake(at: Instant, waker: &Waker);
}
fn schedule_wake(at: Instant, waker: &Waker) {
unsafe { _embassy_time_schedule_wake(at, waker) }
}

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util" } embassy-util = { version = "0.1.0", path = "../../../../embassy-util" }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly"] }
embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] } embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] }
embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" } embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use embassy_boot_nrf::FirmwareUpdater; use embassy_boot_nrf::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
use embassy_nrf::nvmc::Nvmc; use embassy_nrf::nvmc::Nvmc;
use panic_reset as _; use panic_reset as _;

View File

@ -4,9 +4,9 @@
#![feature(generic_associated_types)] #![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f303re", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32f767zi", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32h743zi", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l072cz", "time-driver-any", "exti", "memory-x"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,11 +6,11 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
static APP_B: &[u8] = include_bytes!("../../b.bin"); static APP_B: &[u8] = include_bytes!("../../b.bin");

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l151cb-a", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,11 +6,11 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
static APP_B: &[u8] = include_bytes!("../../b.bin"); static APP_B: &[u8] = include_bytes!("../../b.bin");

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32l475vg", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,8 @@ version = "0.1.0"
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "time-tick-32768hz"] } embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] } embassy-stm32 = { version = "0.1.0", path = "../../../../embassy-stm32", features = ["unstable-traits", "nightly", "stm32wl55jc-cm4", "time-driver-any", "exti"] }
embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" } embassy-boot-stm32 = { version = "0.1.0", path = "../../../../embassy-boot/stm32" }
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" } embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }

View File

@ -6,7 +6,7 @@
use defmt_rtt::*; use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater; use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync; use embassy_embedded_hal::adapter::BlockingAsync;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash; use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};

View File

@ -4,9 +4,9 @@
#[cfg(feature = "defmt-rtt")] #[cfg(feature = "defmt-rtt")]
use defmt_rtt::*; use defmt_rtt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer};
use panic_reset as _; use panic_reset as _;
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -9,7 +9,8 @@ nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unsta
[dependencies] [dependencies]
embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] }
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true } embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true } embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true }

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::info; use defmt::info;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::interrupt; use embassy_nrf::interrupt;
use embassy_nrf::timer::Timer; use embassy_nrf::timer::Timer;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -2,9 +2,9 @@
#![no_main] #![no_main]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::buffered_uarte::{BufferedUarte, State}; use embassy_nrf::buffered_uarte::{BufferedUarte, State};
use embassy_nrf::{interrupt, uarte}; use embassy_nrf::{interrupt, uarte};
use embedded_io::asynch::{BufRead, Write}; use embedded_io::asynch::{BufRead, Write};

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::unwrap; use defmt::unwrap;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_time::{Duration, Timer};
use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_util::channel::mpmc::Channel; use embassy_util::channel::mpmc::Channel;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::unwrap; use defmt::unwrap;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin};
use embassy_time::{Duration, Timer};
use embassy_util::blocking_mutex::raw::NoopRawMutex; use embassy_util::blocking_mutex::raw::NoopRawMutex;
use embassy_util::channel::mpmc::{Channel, Receiver, Sender}; use embassy_util::channel::mpmc::{Channel, Receiver, Sender};
use embassy_util::Forever; use embassy_util::Forever;

View File

@ -5,8 +5,8 @@
use core::task::Poll; use core::task::Poll;
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Instant, Timer}; use embassy_time::{Duration, Instant, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::task] #[embassy_executor::task]

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::info; use defmt::info;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::gpio::{Input, Pull}; use embassy_nrf::gpio::{Input, Pull};
use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -59,10 +59,10 @@
use cortex_m_rt::entry; use cortex_m_rt::entry;
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::time::{Duration, Instant, Timer};
use embassy_nrf::executor::{Executor, InterruptExecutor}; use embassy_nrf::executor::{Executor, InterruptExecutor};
use embassy_nrf::interrupt; use embassy_nrf::interrupt;
use embassy_nrf::interrupt::InterruptExt; use embassy_nrf::interrupt::InterruptExt;
use embassy_time::{Duration, Instant, Timer};
use embassy_util::Forever; use embassy_util::Forever;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,8 +3,8 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_util::mutex::Mutex; use embassy_util::mutex::Mutex;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::nvmc::Nvmc; use embassy_nrf::nvmc::Nvmc;
use embassy_time::{Duration, Timer};
use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -5,7 +5,7 @@
use core::future::pending; use core::future::pending;
use defmt::info; use defmt::info;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity}; use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity};
use embassy_nrf::ppi::Ppi; use embassy_nrf::ppi::Ppi;

View File

@ -3,8 +3,8 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::unwrap; use defmt::unwrap;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; use embassy_util::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_util::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; use embassy_util::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::pwm::{Prescaler, SimplePwm}; use embassy_nrf::pwm::{Prescaler, SimplePwm};
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='') // for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='')

View File

@ -3,11 +3,11 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::pwm::{ use embassy_nrf::pwm::{
Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence, Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence,
}; };
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer}; use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer};
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -5,7 +5,7 @@
use core::future::pending; use core::future::pending;
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::gpio::{Input, Pull}; use embassy_nrf::gpio::{Input, Pull};
use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity};
use embassy_nrf::ppi::Ppi; use embassy_nrf::ppi::Ppi;

View File

@ -3,11 +3,11 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::pwm::{ use embassy_nrf::pwm::{
Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer, Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer,
}; };
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
// WS2812B LED light demonstration. Drives just one light. // WS2812B LED light demonstration. Drives just one light.

View File

@ -3,9 +3,9 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*; use defmt::*;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::pwm::{Prescaler, SimplePwm}; use embassy_nrf::pwm::{Prescaler, SimplePwm};
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main] #[embassy_executor::main]

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::info; use defmt::info;
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::interrupt; use embassy_nrf::interrupt;
use embassy_nrf::qdec::{self, Qdec}; use embassy_nrf::qdec::{self, Qdec};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -3,7 +3,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::{assert_eq, info, unwrap}; use defmt::{assert_eq, info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::{interrupt, qspi}; use embassy_nrf::{interrupt, qspi};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -5,9 +5,9 @@
use core::mem; use core::mem;
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_nrf::{interrupt, qspi}; use embassy_nrf::{interrupt, qspi};
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
// Workaround for alignment requirements. // Workaround for alignment requirements.

View File

@ -5,9 +5,9 @@ use core::mem;
use cortex_m_rt::entry; use cortex_m_rt::entry;
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::executor::raw::TaskStorage; use embassy_executor::raw::TaskStorage;
use embassy_executor::executor::Executor; use embassy_executor::Executor;
use embassy_executor::time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embassy_util::Forever; use embassy_util::Forever;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -2,7 +2,7 @@
#![no_main] #![no_main]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner; use embassy_executor::Spawner;
use embassy_nrf::interrupt; use embassy_nrf::interrupt;
use embassy_nrf::rng::Rng; use embassy_nrf::rng::Rng;
use rand::Rng as _; use rand::Rng as _;

Some files were not shown because too many files have changed in this diff Show More