From 21072bee48ff6ec19b79e0d9527ad8cc34a4e9e0 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 22 Aug 2022 21:46:09 +0200 Subject: [PATCH] split `embassy-util` into `embassy-futures`, `embassy-sync`. --- .github/workflows/rust.yml | 2 +- .vscode/settings.json | 2 +- embassy-boot/boot/Cargo.toml | 2 +- embassy-boot/nrf/Cargo.toml | 2 +- embassy-boot/stm32/Cargo.toml | 2 +- embassy-cortex-m/Cargo.toml | 2 +- embassy-embedded-hal/Cargo.toml | 2 +- .../src/shared_bus/asynch/i2c.rs | 8 +- .../src/shared_bus/asynch/spi.rs | 8 +- .../src/shared_bus/blocking/i2c.rs | 6 +- .../src/shared_bus/blocking/spi.rs | 6 +- embassy-futures/Cargo.toml | 14 ++ {embassy-util => embassy-futures}/src/fmt.rs | 0 embassy-futures/src/lib.rs | 12 + .../src/select.rs | 0 .../src/yield_now.rs | 0 embassy-lora/Cargo.toml | 2 +- embassy-lora/src/stm32wl/mod.rs | 2 +- embassy-net/Cargo.toml | 2 +- embassy-net/src/stack.rs | 2 +- embassy-nrf/Cargo.toml | 4 +- embassy-nrf/src/buffered_uarte.rs | 2 +- embassy-nrf/src/gpiote.rs | 2 +- embassy-nrf/src/qdec.rs | 2 +- embassy-nrf/src/qspi.rs | 2 +- embassy-nrf/src/rng.rs | 2 +- embassy-nrf/src/saadc.rs | 2 +- embassy-nrf/src/spim.rs | 2 +- embassy-nrf/src/temp.rs | 2 +- embassy-nrf/src/time_driver.rs | 4 +- embassy-nrf/src/timer.rs | 6 +- embassy-nrf/src/twim.rs | 2 +- embassy-nrf/src/uarte.rs | 2 +- embassy-nrf/src/usb.rs | 2 +- embassy-rp/Cargo.toml | 2 +- embassy-rp/src/gpio.rs | 2 +- embassy-rp/src/timer.rs | 4 +- embassy-stm32/Cargo.toml | 4 +- embassy-stm32/src/dcmi.rs | 2 +- embassy-stm32/src/dma/bdma.rs | 2 +- embassy-stm32/src/dma/dma.rs | 2 +- embassy-stm32/src/dma/gpdma.rs | 2 +- embassy-stm32/src/eth/v1/mod.rs | 2 +- embassy-stm32/src/eth/v2/mod.rs | 2 +- embassy-stm32/src/exti.rs | 2 +- embassy-stm32/src/i2c/v2.rs | 2 +- embassy-stm32/src/rng.rs | 2 +- embassy-stm32/src/sdmmc/mod.rs | 6 +- embassy-stm32/src/time_driver.rs | 4 +- embassy-stm32/src/usart/buffered.rs | 2 +- embassy-stm32/src/usb/usb.rs | 2 +- {embassy-util => embassy-sync}/Cargo.toml | 6 +- {embassy-util => embassy-sync}/build.rs | 0 .../src/blocking_mutex/mod.rs | 0 .../src/blocking_mutex/raw.rs | 0 .../src/channel/mod.rs | 0 .../src/channel/mpmc.rs | 4 +- .../src/channel/pubsub/mod.rs | 6 +- .../src/channel/pubsub/publisher.rs | 0 .../src/channel/pubsub/subscriber.rs | 0 .../src/channel/signal.rs | 2 +- embassy-sync/src/fmt.rs | 228 ++++++++++++++++++ {embassy-util => embassy-sync}/src/lib.rs | 6 - {embassy-util => embassy-sync}/src/mutex.rs | 0 {embassy-util => embassy-sync}/src/pipe.rs | 4 +- .../src/ring_buffer.rs | 0 .../src/waitqueue/mod.rs | 0 .../src/waitqueue/multi_waker.rs | 0 .../src/waitqueue/waker.rs | 0 embassy-usb-hid/Cargo.toml | 2 +- embassy-usb-ncm/Cargo.toml | 2 +- embassy-usb-serial/Cargo.toml | 2 +- embassy-usb-serial/src/lib.rs | 2 +- embassy-usb/Cargo.toml | 2 +- embassy-usb/src/lib.rs | 2 +- examples/boot/application/nrf/Cargo.toml | 2 +- examples/boot/application/stm32f3/Cargo.toml | 2 +- examples/boot/application/stm32f7/Cargo.toml | 2 +- examples/boot/application/stm32h7/Cargo.toml | 2 +- examples/boot/application/stm32l0/Cargo.toml | 2 +- examples/boot/application/stm32l1/Cargo.toml | 2 +- examples/boot/application/stm32l4/Cargo.toml | 2 +- examples/boot/application/stm32wl/Cargo.toml | 2 +- examples/nrf-rtos-trace/Cargo.toml | 4 +- examples/nrf/Cargo.toml | 3 +- examples/nrf/src/bin/channel.rs | 4 +- .../nrf/src/bin/channel_sender_receiver.rs | 4 +- examples/nrf/src/bin/mutex.rs | 4 +- examples/nrf/src/bin/pubsub.rs | 4 +- examples/nrf/src/bin/uart_split.rs | 4 +- examples/nrf/src/bin/usb_ethernet.rs | 4 +- examples/nrf/src/bin/usb_hid_keyboard.rs | 4 +- examples/rp/Cargo.toml | 2 +- examples/std/Cargo.toml | 2 +- examples/stm32f0/Cargo.toml | 2 +- examples/stm32f1/Cargo.toml | 2 +- examples/stm32f2/Cargo.toml | 2 +- examples/stm32f3/Cargo.toml | 2 +- examples/stm32f3/src/bin/button_events.rs | 4 +- examples/stm32f4/Cargo.toml | 2 +- examples/stm32f7/Cargo.toml | 2 +- examples/stm32g0/Cargo.toml | 2 +- examples/stm32g4/Cargo.toml | 2 +- examples/stm32h7/Cargo.toml | 2 +- examples/stm32h7/src/bin/signal.rs | 2 +- examples/stm32h7/src/bin/usart_split.rs | 4 +- examples/stm32l0/Cargo.toml | 2 +- examples/stm32l1/Cargo.toml | 2 +- examples/stm32l4/Cargo.toml | 2 +- examples/stm32l5/Cargo.toml | 2 +- examples/stm32l5/src/bin/usb_ethernet.rs | 4 +- examples/stm32u5/Cargo.toml | 2 +- examples/stm32wb/Cargo.toml | 2 +- examples/stm32wl/Cargo.toml | 2 +- examples/stm32wl/src/bin/subghz.rs | 2 +- examples/wasm/Cargo.toml | 2 +- tests/rp/Cargo.toml | 2 +- tests/stm32/Cargo.toml | 2 +- 118 files changed, 391 insertions(+), 142 deletions(-) create mode 100644 embassy-futures/Cargo.toml rename {embassy-util => embassy-futures}/src/fmt.rs (100%) create mode 100644 embassy-futures/src/lib.rs rename {embassy-util => embassy-futures}/src/select.rs (100%) rename {embassy-util => embassy-futures}/src/yield_now.rs (100%) rename {embassy-util => embassy-sync}/Cargo.toml (85%) rename {embassy-util => embassy-sync}/build.rs (100%) rename {embassy-util => embassy-sync}/src/blocking_mutex/mod.rs (100%) rename {embassy-util => embassy-sync}/src/blocking_mutex/raw.rs (100%) rename {embassy-util => embassy-sync}/src/channel/mod.rs (100%) rename {embassy-util => embassy-sync}/src/channel/mpmc.rs (99%) rename {embassy-util => embassy-sync}/src/channel/pubsub/mod.rs (99%) rename {embassy-util => embassy-sync}/src/channel/pubsub/publisher.rs (100%) rename {embassy-util => embassy-sync}/src/channel/pubsub/subscriber.rs (100%) rename {embassy-util => embassy-sync}/src/channel/signal.rs (98%) create mode 100644 embassy-sync/src/fmt.rs rename {embassy-util => embassy-sync}/src/lib.rs (87%) rename {embassy-util => embassy-sync}/src/mutex.rs (100%) rename {embassy-util => embassy-sync}/src/pipe.rs (99%) rename {embassy-util => embassy-sync}/src/ring_buffer.rs (100%) rename {embassy-util => embassy-sync}/src/waitqueue/mod.rs (100%) rename {embassy-util => embassy-sync}/src/waitqueue/multi_waker.rs (100%) rename {embassy-util => embassy-sync}/src/waitqueue/waker.rs (100%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d76e5ced..d2e8e316 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -69,4 +69,4 @@ jobs: steps: - uses: actions/checkout@v2 - name: Test - run: cd embassy-util && cargo test + run: cd embassy-sync && cargo test diff --git a/.vscode/settings.json b/.vscode/settings.json index d6ce75c9..5e9e5179 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,7 @@ "rust-analyzer.linkedProjects": [ // Declare for the target you wish to develop //"embassy-executor/Cargo.toml", - //"embassy-util/Cargo.toml", + //"embassy-sync/Cargo.toml", "examples/nrf/Cargo.toml", // "examples/rp/Cargo.toml", // "examples/std/Cargo.toml", diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml index 9c2e72be..a42f8868 100644 --- a/embassy-boot/boot/Cargo.toml +++ b/embassy-boot/boot/Cargo.toml @@ -14,7 +14,7 @@ target = "thumbv7em-none-eabi" [dependencies] defmt = { version = "0.3", optional = true } log = { version = "0.4", optional = true } -embassy-util = { version = "0.1.0", path = "../../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } embedded-storage = "0.3.0" embedded-storage-async = "0.3.0" diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml index b06e8102..234393e7 100644 --- a/embassy-boot/nrf/Cargo.toml +++ b/embassy-boot/nrf/Cargo.toml @@ -15,7 +15,7 @@ target = "thumbv7em-none-eabi" [dependencies] defmt = { version = "0.3", optional = true } -embassy-util = { path = "../../embassy-util" } +embassy-sync = { path = "../../embassy-sync" } embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } embassy-boot = { path = "../boot", default-features = false } cortex-m = { version = "0.7.6" } diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml index d8f49253..ad4657e0 100644 --- a/embassy-boot/stm32/Cargo.toml +++ b/embassy-boot/stm32/Cargo.toml @@ -17,7 +17,7 @@ defmt = { version = "0.3", optional = true } defmt-rtt = { version = "0.3", optional = true } log = { version = "0.4", optional = true } -embassy-util = { path = "../../embassy-util" } +embassy-sync = { path = "../../embassy-sync" } embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] } embassy-boot = { path = "../boot", default-features = false } cortex-m = { version = "0.7.6" } diff --git a/embassy-cortex-m/Cargo.toml b/embassy-cortex-m/Cargo.toml index 1f16da31..7efced66 100644 --- a/embassy-cortex-m/Cargo.toml +++ b/embassy-cortex-m/Cargo.toml @@ -35,7 +35,7 @@ prio-bits-8 = [] defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-executor = { version = "0.1.0", path = "../embassy-executor"} embassy-macros = { version = "0.1.0", path = "../embassy-macros"} embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common"} diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml index 86666687..46268072 100644 --- a/embassy-embedded-hal/Cargo.toml +++ b/embassy-embedded-hal/Cargo.toml @@ -16,7 +16,7 @@ std = [] nightly = ["embedded-hal-async", "embedded-storage-async"] [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs index dc483b82..0bc6afd9 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs @@ -4,8 +4,8 @@ //! //! ```rust //! use embassy_embedded_hal::shared_bus::i2c::I2cDevice; -//! use embassy_util::mutex::Mutex; -//! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; +//! use embassy_sync::mutex::Mutex; +//! use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; //! //! static I2C_BUS: StaticCell>> = StaticCell::new(); //! let config = twim::Config::default(); @@ -24,8 +24,8 @@ //! ``` use core::future::Future; -use embassy_util::blocking_mutex::raw::RawMutex; -use embassy_util::mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; +use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c; use crate::shared_bus::I2cDeviceError; diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs index bb419d6a..c95b59ef 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs @@ -4,8 +4,8 @@ //! //! ```rust //! use embassy_embedded_hal::shared_bus::spi::SpiDevice; -//! use embassy_util::mutex::Mutex; -//! use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; +//! use embassy_sync::mutex::Mutex; +//! use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; //! //! static SPI_BUS: StaticCell>> = StaticCell::new(); //! let mut config = spim::Config::default(); @@ -27,8 +27,8 @@ //! ``` use core::future::Future; -use embassy_util::blocking_mutex::raw::RawMutex; -use embassy_util::mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; +use embassy_sync::mutex::Mutex; use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::spi::ErrorType; use embedded_hal_async::spi; diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs index 837312e8..a611e2d2 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs @@ -4,7 +4,7 @@ //! //! ```rust //! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; -//! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; +//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; //! //! static I2C_BUS: StaticCell>>> = StaticCell::new(); //! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); @@ -18,8 +18,8 @@ use core::cell::RefCell; -use embassy_util::blocking_mutex::raw::RawMutex; -use embassy_util::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; +use embassy_sync::blocking_mutex::Mutex; use embedded_hal_1::i2c::blocking::{I2c, Operation}; use embedded_hal_1::i2c::ErrorType; diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index a48d9183..23845d88 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs @@ -4,7 +4,7 @@ //! //! ```rust //! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice; -//! use embassy_util::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; +//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; //! //! static SPI_BUS: StaticCell>>> = StaticCell::new(); //! let irq = interrupt::take!(SPIM3); @@ -20,8 +20,8 @@ use core::cell::RefCell; -use embassy_util::blocking_mutex::raw::RawMutex; -use embassy_util::blocking_mutex::Mutex; +use embassy_sync::blocking_mutex::raw::RawMutex; +use embassy_sync::blocking_mutex::Mutex; use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::spi; use embedded_hal_1::spi::blocking::SpiBusFlush; diff --git a/embassy-futures/Cargo.toml b/embassy-futures/Cargo.toml new file mode 100644 index 00000000..e564f5a9 --- /dev/null +++ b/embassy-futures/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "embassy-futures" +version = "0.1.0" +edition = "2021" + +[package.metadata.embassy_docs] +src_base = "https://github.com/embassy-rs/embassy/blob/embassy-futures-v$VERSION/embassy-futures/src/" +src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-futures/src/" +features = ["nightly"] +target = "thumbv7em-none-eabi" + +[dependencies] +defmt = { version = "0.3", optional = true } +log = { version = "0.4.14", optional = true } diff --git a/embassy-util/src/fmt.rs b/embassy-futures/src/fmt.rs similarity index 100% rename from embassy-util/src/fmt.rs rename to embassy-futures/src/fmt.rs diff --git a/embassy-futures/src/lib.rs b/embassy-futures/src/lib.rs new file mode 100644 index 00000000..48c9c857 --- /dev/null +++ b/embassy-futures/src/lib.rs @@ -0,0 +1,12 @@ +#![no_std] +#![doc = include_str!("../../README.md")] +#![warn(missing_docs)] + +// This mod MUST go first, so that the others see its macros. +pub(crate) mod fmt; + +mod select; +mod yield_now; + +pub use select::*; +pub use yield_now::*; diff --git a/embassy-util/src/select.rs b/embassy-futures/src/select.rs similarity index 100% rename from embassy-util/src/select.rs rename to embassy-futures/src/select.rs diff --git a/embassy-util/src/yield_now.rs b/embassy-futures/src/yield_now.rs similarity index 100% rename from embassy-util/src/yield_now.rs rename to embassy-futures/src/yield_now.rs diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml index c7435ab3..9d5e7aed 100644 --- a/embassy-lora/Cargo.toml +++ b/embassy-lora/Cargo.toml @@ -25,7 +25,7 @@ defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } embassy-time = { version = "0.1.0", path = "../embassy-time" } -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-async = { version = "0.1.0-alpha.1" } diff --git a/embassy-lora/src/stm32wl/mod.rs b/embassy-lora/src/stm32wl/mod.rs index 4a4c5cfb..374c8532 100644 --- a/embassy-lora/src/stm32wl/mod.rs +++ b/embassy-lora/src/stm32wl/mod.rs @@ -12,7 +12,7 @@ use embassy_stm32::subghz::{ Status, SubGhz, TcxoMode, TcxoTrim, Timeout, TxParams, }; use embassy_stm32::Peripheral; -use embassy_util::channel::signal::Signal; +use embassy_sync::channel::signal::Signal; use lorawan_device::async_device::radio::{Bandwidth, PhyRxTx, RfConfig, RxQuality, SpreadingFactor, TxConfig}; use lorawan_device::async_device::Timings; diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml index 9f9bb226..2143f36d 100644 --- a/embassy-net/Cargo.toml +++ b/embassy-net/Cargo.toml @@ -38,7 +38,7 @@ defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } embassy-time = { version = "0.1.0", path = "../embassy-time" } -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embedded-io = { version = "0.3.0", features = [ "async" ] } managed = { version = "0.8.0", default-features = false, features = [ "map" ] } diff --git a/embassy-net/src/stack.rs b/embassy-net/src/stack.rs index 4b6a7ae2..8d2dd4bc 100644 --- a/embassy-net/src/stack.rs +++ b/embassy-net/src/stack.rs @@ -2,8 +2,8 @@ use core::cell::UnsafeCell; use core::future::Future; use core::task::{Context, Poll}; +use embassy_sync::waitqueue::WakerRegistration; use embassy_time::{Instant, Timer}; -use embassy_util::waitqueue::WakerRegistration; use futures::future::poll_fn; use futures::pin_mut; use heapless::Vec; diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index 0ef7f5bb..186c73a5 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml @@ -18,7 +18,7 @@ flavors = [ 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-sync/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"] # Enable nightly-only features nightly = ["embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"] @@ -66,7 +66,7 @@ _gpio-p1 = [] [dependencies] 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-sync = { version = "0.1.0", path = "../embassy-sync" } 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-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 08dfcbcf..62af544a 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -21,7 +21,7 @@ use core::task::Poll; use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; use embassy_hal_common::ring_buffer::RingBuffer; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::WakerRegistration; +use embassy_sync::waitqueue::WakerRegistration; use futures::future::poll_fn; // Re-export SVD variants to allow user to directly set values pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity}; diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index cf49b0db..b5203570 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -3,7 +3,7 @@ use core::future::Future; use core::task::{Context, Poll}; use embassy_hal_common::{impl_peripheral, Peripheral, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::gpio::sealed::Pin as _; diff --git a/embassy-nrf/src/qdec.rs b/embassy-nrf/src/qdec.rs index 83f2916b..762e0971 100644 --- a/embassy-nrf/src/qdec.rs +++ b/embassy-nrf/src/qdec.rs @@ -3,7 +3,7 @@ use core::task::Poll; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::gpio::sealed::Pin as _; diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index 6d7ebb4b..c97cb165 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs @@ -526,7 +526,7 @@ cfg_if::cfg_if! { } pub(crate) mod sealed { - use embassy_util::waitqueue::AtomicWaker; + use embassy_sync::waitqueue::AtomicWaker; use super::*; diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs index 7aad561b..42da51d0 100644 --- a/embassy-nrf/src/rng.rs +++ b/embassy-nrf/src/rng.rs @@ -4,7 +4,7 @@ use core::task::Poll; use embassy_hal_common::drop::OnDrop; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::interrupt::InterruptExt; diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index f2ef46d8..7dc66349 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs @@ -4,7 +4,7 @@ use core::sync::atomic::{compiler_fence, Ordering}; use core::task::Poll; use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use pac::{saadc, SAADC}; use saadc::ch::config::{GAIN_A, REFSEL_A, RESP_A, TACQ_A}; diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index 57c0c14c..be2fc02f 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs @@ -363,7 +363,7 @@ impl<'d, T: Instance> Drop for Spim<'d, T> { } pub(crate) mod sealed { - use embassy_util::waitqueue::AtomicWaker; + use embassy_sync::waitqueue::AtomicWaker; use super::*; diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs index 1491e426..d520fd68 100644 --- a/embassy-nrf/src/temp.rs +++ b/embassy-nrf/src/temp.rs @@ -4,7 +4,7 @@ use core::task::Poll; use embassy_hal_common::drop::OnDrop; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use fixed::types::I30F2; use futures::future::poll_fn; diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs index b961d65a..c32a4463 100644 --- a/embassy-nrf/src/time_driver.rs +++ b/embassy-nrf/src/time_driver.rs @@ -3,9 +3,9 @@ use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering}; use core::{mem, ptr}; use critical_section::CriticalSection; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embassy_sync::blocking_mutex::CriticalSectionMutex as Mutex; use embassy_time::driver::{AlarmHandle, Driver}; -use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; -use embassy_util::blocking_mutex::CriticalSectionMutex as Mutex; use crate::interrupt::{Interrupt, InterruptExt}; use crate::{interrupt, pac}; diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index b3b613db..3de5a896 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs @@ -5,7 +5,7 @@ use core::task::Poll; use embassy_hal_common::drop::OnDrop; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::interrupt::{Interrupt, InterruptExt}; @@ -40,8 +40,8 @@ macro_rules! impl_timer { fn regs() -> &'static pac::timer0::RegisterBlock { unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } } - fn waker(n: usize) -> &'static ::embassy_util::waitqueue::AtomicWaker { - use ::embassy_util::waitqueue::AtomicWaker; + fn waker(n: usize) -> &'static ::embassy_sync::waitqueue::AtomicWaker { + use ::embassy_sync::waitqueue::AtomicWaker; const NEW_AW: AtomicWaker = AtomicWaker::new(); static WAKERS: [AtomicWaker; $ccs] = [NEW_AW; $ccs]; &WAKERS[n] diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 9587d1f4..850f6d0f 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs @@ -13,9 +13,9 @@ use core::task::Poll; use embassy_embedded_hal::SetConfig; use embassy_hal_common::{into_ref, PeripheralRef}; +use embassy_sync::waitqueue::AtomicWaker; #[cfg(feature = "time")] use embassy_time::{Duration, Instant}; -use embassy_util::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE}; diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 0d24cf65..4347ea55 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -932,7 +932,7 @@ impl<'d, U: Instance, T: TimerInstance> UarteRxWithIdle<'d, U, T> { pub(crate) mod sealed { use core::sync::atomic::AtomicU8; - use embassy_util::waitqueue::AtomicWaker; + use embassy_sync::waitqueue::AtomicWaker; use super::*; diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index 509ee313..688326e9 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs @@ -7,10 +7,10 @@ use core::task::Poll; use cortex_m::peripheral::NVIC; use embassy_hal_common::{into_ref, PeripheralRef}; +use embassy_sync::waitqueue::AtomicWaker; pub use embassy_usb; use embassy_usb::driver::{self, EndpointError, Event, Unsupported}; use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; -use embassy_util::waitqueue::AtomicWaker; use futures::future::poll_fn; use futures::Future; use pac::usbd::RegisterBlock; diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index 0e53d3a3..cfd95b7b 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml @@ -27,7 +27,7 @@ nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", " unstable-traits = ["embedded-hal-1"] [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 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-2"]} diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 90862fa3..428855c7 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -5,7 +5,7 @@ use core::task::{Context, Poll}; use embassy_cortex_m::interrupt::{Interrupt, InterruptExt}; use embassy_hal_common::{impl_peripheral, into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use crate::pac::common::{Reg, RW}; use crate::pac::SIO; diff --git a/embassy-rp/src/timer.rs b/embassy-rp/src/timer.rs index 5bc1f66c..5215c0c0 100644 --- a/embassy-rp/src/timer.rs +++ b/embassy-rp/src/timer.rs @@ -2,9 +2,9 @@ use core::cell::Cell; use atomic_polyfill::{AtomicU8, Ordering}; use critical_section::CriticalSection; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embassy_sync::blocking_mutex::Mutex; use embassy_time::driver::{AlarmHandle, Driver}; -use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; -use embassy_util::blocking_mutex::Mutex; use crate::interrupt::{Interrupt, InterruptExt}; use crate::{interrupt, pac}; diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index c47ea0bc..7a8e5c59 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -31,7 +31,7 @@ flavors = [ ] [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 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"]} @@ -72,7 +72,7 @@ quote = "1.0.15" stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]} [features] -defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-util/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"] +defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"] sdmmc-rs = ["embedded-sdmmc"] net = ["embassy-net" ] memory-x = ["stm32-metapac/memory-x"] diff --git a/embassy-stm32/src/dcmi.rs b/embassy-stm32/src/dcmi.rs index bbb9a12c..fb9dc9d0 100644 --- a/embassy-stm32/src/dcmi.rs +++ b/embassy-stm32/src/dcmi.rs @@ -1,7 +1,7 @@ use core::task::Poll; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::gpio::sealed::AFType; diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index bd2cd5b5..674255dd 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -3,7 +3,7 @@ use core::sync::atomic::{fence, Ordering}; use core::task::Waker; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use super::{TransferOptions, Word, WordSize}; use crate::_generated::BDMA_CHANNEL_COUNT; diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index 0c66005c..a45b8780 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -1,7 +1,7 @@ use core::sync::atomic::{fence, Ordering}; use core::task::Waker; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use super::{Burst, FlowControl, Request, TransferOptions, Word, WordSize}; use crate::_generated::DMA_CHANNEL_COUNT; diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index 1aea6c65..bde8c3ef 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs @@ -1,7 +1,7 @@ use core::sync::atomic::{fence, Ordering}; use core::task::Waker; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use super::{Request, TransferOptions, Word, WordSize}; use crate::_generated::GPDMA_CHANNEL_COUNT; diff --git a/embassy-stm32/src/eth/v1/mod.rs b/embassy-stm32/src/eth/v1/mod.rs index 37593914..1ab0438a 100644 --- a/embassy-stm32/src/eth/v1/mod.rs +++ b/embassy-stm32/src/eth/v1/mod.rs @@ -7,7 +7,7 @@ use core::task::Waker; use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; use embassy_hal_common::{into_ref, PeripheralRef}; use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::sealed::{AFType, Pin as __GpioPin}; use crate::gpio::{AnyPin, Speed}; diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs index 1bc1fb72..d67c3c5e 100644 --- a/embassy-stm32/src/eth/v2/mod.rs +++ b/embassy-stm32/src/eth/v2/mod.rs @@ -5,7 +5,7 @@ use core::task::Waker; use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; use embassy_hal_common::{into_ref, PeripheralRef}; use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::sealed::{AFType, Pin as _}; use crate::gpio::{AnyPin, Speed}; diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index ecb180bb..935149b1 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -4,7 +4,7 @@ use core::pin::Pin; use core::task::{Context, Poll}; use embassy_hal_common::impl_peripheral; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use crate::gpio::{AnyPin, Input, Pin as GpioPin}; use crate::pac::exti::regs::Lines; diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index b4303d3d..07a3105d 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs @@ -5,7 +5,7 @@ use atomic_polyfill::{AtomicUsize, Ordering}; use embassy_embedded_hal::SetConfig; use embassy_hal_common::drop::OnDrop; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use crate::dma::NoDma; diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 81e28f35..520f2ab9 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs @@ -3,7 +3,7 @@ use core::task::Poll; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use rand_core::{CryptoRng, RngCore}; diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index 3ad31ec8..67758c49 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs @@ -5,7 +5,7 @@ use core::task::Poll; use embassy_hal_common::drop::OnDrop; use embassy_hal_common::{into_ref, PeripheralRef}; -use embassy_util::waitqueue::AtomicWaker; +use embassy_sync::waitqueue::AtomicWaker; use futures::future::poll_fn; use sdio_host::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatus, CID, CSD, OCR, SCR}; @@ -1514,8 +1514,8 @@ foreach_peripheral!( INNER } - fn state() -> &'static ::embassy_util::waitqueue::AtomicWaker { - static WAKER: ::embassy_util::waitqueue::AtomicWaker = ::embassy_util::waitqueue::AtomicWaker::new(); + fn state() -> &'static ::embassy_sync::waitqueue::AtomicWaker { + static WAKER: ::embassy_sync::waitqueue::AtomicWaker = ::embassy_sync::waitqueue::AtomicWaker::new(); &WAKER } } diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 7f472316..6989a43d 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs @@ -4,10 +4,10 @@ use core::sync::atomic::{compiler_fence, Ordering}; use core::{mem, ptr}; use atomic_polyfill::{AtomicU32, AtomicU8}; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embassy_sync::blocking_mutex::Mutex; use embassy_time::driver::{AlarmHandle, Driver}; use embassy_time::TICKS_PER_SECOND; -use embassy_util::blocking_mutex::raw::CriticalSectionRawMutex; -use embassy_util::blocking_mutex::Mutex; use stm32_metapac::timer::regs; use crate::interrupt::{CriticalSection, InterruptExt}; diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs index ec2231e4..a7fa4389 100644 --- a/embassy-stm32/src/usart/buffered.rs +++ b/embassy-stm32/src/usart/buffered.rs @@ -4,7 +4,7 @@ use core::task::Poll; use atomic_polyfill::{compiler_fence, Ordering}; use embassy_cortex_m::peripheral::{PeripheralMutex, PeripheralState, StateStorage}; use embassy_hal_common::ring_buffer::RingBuffer; -use embassy_util::waitqueue::WakerRegistration; +use embassy_sync::waitqueue::WakerRegistration; use futures::future::poll_fn; use super::*; diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 3861e42d..db965824 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs @@ -6,10 +6,10 @@ use core::task::Poll; use atomic_polyfill::{AtomicBool, AtomicU8}; use embassy_hal_common::into_ref; +use embassy_sync::waitqueue::AtomicWaker; use embassy_time::{block_for, Duration}; use embassy_usb::driver::{self, EndpointAllocError, EndpointError, Event, Unsupported}; use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; -use embassy_util::waitqueue::AtomicWaker; use futures::future::poll_fn; use futures::Future; use pac::common::{Reg, RW}; diff --git a/embassy-util/Cargo.toml b/embassy-sync/Cargo.toml similarity index 85% rename from embassy-util/Cargo.toml rename to embassy-sync/Cargo.toml index b54a58b4..0d14bba5 100644 --- a/embassy-util/Cargo.toml +++ b/embassy-sync/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "embassy-util" +name = "embassy-sync" version = "0.1.0" edition = "2021" [package.metadata.embassy_docs] -src_base = "https://github.com/embassy-rs/embassy/blob/embassy-util-v$VERSION/embassy-util/src/" -src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-util/src/" +src_base = "https://github.com/embassy-rs/embassy/blob/embassy-sync-v$VERSION/embassy-sync/src/" +src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-sync/src/" features = ["nightly"] target = "thumbv7em-none-eabi" diff --git a/embassy-util/build.rs b/embassy-sync/build.rs similarity index 100% rename from embassy-util/build.rs rename to embassy-sync/build.rs diff --git a/embassy-util/src/blocking_mutex/mod.rs b/embassy-sync/src/blocking_mutex/mod.rs similarity index 100% rename from embassy-util/src/blocking_mutex/mod.rs rename to embassy-sync/src/blocking_mutex/mod.rs diff --git a/embassy-util/src/blocking_mutex/raw.rs b/embassy-sync/src/blocking_mutex/raw.rs similarity index 100% rename from embassy-util/src/blocking_mutex/raw.rs rename to embassy-sync/src/blocking_mutex/raw.rs diff --git a/embassy-util/src/channel/mod.rs b/embassy-sync/src/channel/mod.rs similarity index 100% rename from embassy-util/src/channel/mod.rs rename to embassy-sync/src/channel/mod.rs diff --git a/embassy-util/src/channel/mpmc.rs b/embassy-sync/src/channel/mpmc.rs similarity index 99% rename from embassy-util/src/channel/mpmc.rs rename to embassy-sync/src/channel/mpmc.rs index 263f29bf..7bebd341 100644 --- a/embassy-util/src/channel/mpmc.rs +++ b/embassy-sync/src/channel/mpmc.rs @@ -373,8 +373,8 @@ where /// Establish a new bounded channel. For example, to create one with a NoopMutex: /// /// ``` - /// use embassy_util::channel::mpmc::Channel; - /// use embassy_util::blocking_mutex::raw::NoopRawMutex; + /// use embassy_sync::channel::mpmc::Channel; + /// use embassy_sync::blocking_mutex::raw::NoopRawMutex; /// /// // Declare a bounded channel of 3 u32s. /// let mut channel = Channel::::new(); diff --git a/embassy-util/src/channel/pubsub/mod.rs b/embassy-sync/src/channel/pubsub/mod.rs similarity index 99% rename from embassy-util/src/channel/pubsub/mod.rs rename to embassy-sync/src/channel/pubsub/mod.rs index ecc8fbd8..f62b4d11 100644 --- a/embassy-util/src/channel/pubsub/mod.rs +++ b/embassy-sync/src/channel/pubsub/mod.rs @@ -33,9 +33,9 @@ pub use subscriber::{DynSubscriber, Subscriber}; /// ## Example /// /// ``` -/// # use embassy_util::blocking_mutex::raw::NoopRawMutex; -/// # use embassy_util::channel::pubsub::WaitResult; -/// # use embassy_util::channel::pubsub::PubSubChannel; +/// # use embassy_sync::blocking_mutex::raw::NoopRawMutex; +/// # use embassy_sync::channel::pubsub::WaitResult; +/// # use embassy_sync::channel::pubsub::PubSubChannel; /// # use futures_executor::block_on; /// # let test = async { /// // Create the channel. This can be static as well diff --git a/embassy-util/src/channel/pubsub/publisher.rs b/embassy-sync/src/channel/pubsub/publisher.rs similarity index 100% rename from embassy-util/src/channel/pubsub/publisher.rs rename to embassy-sync/src/channel/pubsub/publisher.rs diff --git a/embassy-util/src/channel/pubsub/subscriber.rs b/embassy-sync/src/channel/pubsub/subscriber.rs similarity index 100% rename from embassy-util/src/channel/pubsub/subscriber.rs rename to embassy-sync/src/channel/pubsub/subscriber.rs diff --git a/embassy-util/src/channel/signal.rs b/embassy-sync/src/channel/signal.rs similarity index 98% rename from embassy-util/src/channel/signal.rs rename to embassy-sync/src/channel/signal.rs index 05889f5a..9279266c 100644 --- a/embassy-util/src/channel/signal.rs +++ b/embassy-sync/src/channel/signal.rs @@ -19,7 +19,7 @@ use core::task::{Context, Poll, Waker}; /// Signals are generally declared as `static`s and then borrowed as required. /// /// ``` -/// use embassy_util::channel::signal::Signal; +/// use embassy_sync::channel::signal::Signal; /// /// enum SomeCommand { /// On, diff --git a/embassy-sync/src/fmt.rs b/embassy-sync/src/fmt.rs new file mode 100644 index 00000000..f8bb0a03 --- /dev/null +++ b/embassy-sync/src/fmt.rs @@ -0,0 +1,228 @@ +#![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); + } + } + } +} + +#[cfg(feature = "defmt-timestamp-uptime")] +defmt::timestamp! {"{=u64:us}", crate::time::Instant::now().as_micros() } + +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +pub struct NoneError; + +pub trait Try { + type Ok; + type Error; + fn into_result(self) -> Result; +} + +impl Try for Option { + type Ok = T; + type Error = NoneError; + + #[inline] + fn into_result(self) -> Result { + self.ok_or(NoneError) + } +} + +impl Try for Result { + type Ok = T; + type Error = E; + + #[inline] + fn into_result(self) -> Self { + self + } +} diff --git a/embassy-util/src/lib.rs b/embassy-sync/src/lib.rs similarity index 87% rename from embassy-util/src/lib.rs rename to embassy-sync/src/lib.rs index 8ec3300d..7d881590 100644 --- a/embassy-util/src/lib.rs +++ b/embassy-sync/src/lib.rs @@ -15,9 +15,3 @@ pub mod channel; pub mod mutex; pub mod pipe; pub mod waitqueue; - -mod select; -mod yield_now; - -pub use select::*; -pub use yield_now::*; diff --git a/embassy-util/src/mutex.rs b/embassy-sync/src/mutex.rs similarity index 100% rename from embassy-util/src/mutex.rs rename to embassy-sync/src/mutex.rs diff --git a/embassy-util/src/pipe.rs b/embassy-sync/src/pipe.rs similarity index 99% rename from embassy-util/src/pipe.rs rename to embassy-sync/src/pipe.rs index d85b843e..7d64b648 100644 --- a/embassy-util/src/pipe.rs +++ b/embassy-sync/src/pipe.rs @@ -241,8 +241,8 @@ where /// Establish a new bounded pipe. For example, to create one with a NoopMutex: /// /// ``` - /// use embassy_util::pipe::Pipe; - /// use embassy_util::blocking_mutex::raw::NoopRawMutex; + /// use embassy_sync::pipe::Pipe; + /// use embassy_sync::blocking_mutex::raw::NoopRawMutex; /// /// // Declare a bounded pipe, with a buffer of 256 bytes. /// let mut pipe = Pipe::::new(); diff --git a/embassy-util/src/ring_buffer.rs b/embassy-sync/src/ring_buffer.rs similarity index 100% rename from embassy-util/src/ring_buffer.rs rename to embassy-sync/src/ring_buffer.rs diff --git a/embassy-util/src/waitqueue/mod.rs b/embassy-sync/src/waitqueue/mod.rs similarity index 100% rename from embassy-util/src/waitqueue/mod.rs rename to embassy-sync/src/waitqueue/mod.rs diff --git a/embassy-util/src/waitqueue/multi_waker.rs b/embassy-sync/src/waitqueue/multi_waker.rs similarity index 100% rename from embassy-util/src/waitqueue/multi_waker.rs rename to embassy-sync/src/waitqueue/multi_waker.rs diff --git a/embassy-util/src/waitqueue/waker.rs b/embassy-sync/src/waitqueue/waker.rs similarity index 100% rename from embassy-util/src/waitqueue/waker.rs rename to embassy-sync/src/waitqueue/waker.rs diff --git a/embassy-usb-hid/Cargo.toml b/embassy-usb-hid/Cargo.toml index 5e9cfebf..73035148 100644 --- a/embassy-usb-hid/Cargo.toml +++ b/embassy-usb-hid/Cargo.toml @@ -14,7 +14,7 @@ default = ["usbd-hid"] usbd-hid = ["dep:usbd-hid", "ssmarshal"] [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-usb = { version = "0.1.0", path = "../embassy-usb" } defmt = { version = "0.3", optional = true } diff --git a/embassy-usb-ncm/Cargo.toml b/embassy-usb-ncm/Cargo.toml index 47c1f36b..15d3db96 100644 --- a/embassy-usb-ncm/Cargo.toml +++ b/embassy-usb-ncm/Cargo.toml @@ -10,7 +10,7 @@ features = ["defmt"] target = "thumbv7em-none-eabi" [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-usb = { version = "0.1.0", path = "../embassy-usb" } defmt = { version = "0.3", optional = true } diff --git a/embassy-usb-serial/Cargo.toml b/embassy-usb-serial/Cargo.toml index 63361047..9788588e 100644 --- a/embassy-usb-serial/Cargo.toml +++ b/embassy-usb-serial/Cargo.toml @@ -10,7 +10,7 @@ features = ["defmt"] target = "thumbv7em-none-eabi" [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-usb = { version = "0.1.0", path = "../embassy-usb" } defmt = { version = "0.3", optional = true } diff --git a/embassy-usb-serial/src/lib.rs b/embassy-usb-serial/src/lib.rs index e561be9d..f3de2ec1 100644 --- a/embassy-usb-serial/src/lib.rs +++ b/embassy-usb-serial/src/lib.rs @@ -9,11 +9,11 @@ use core::cell::Cell; use core::mem::{self, MaybeUninit}; use core::sync::atomic::{AtomicBool, Ordering}; +use embassy_sync::blocking_mutex::CriticalSectionMutex; use embassy_usb::control::{self, ControlHandler, InResponse, OutResponse, Request}; use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut}; use embassy_usb::types::*; use embassy_usb::Builder; -use embassy_util::blocking_mutex::CriticalSectionMutex; /// This should be used as `device_class` when building the `UsbDevice`. pub const USB_CLASS_CDC: u8 = 0x02; diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml index 6adbd399..8cad4d31 100644 --- a/embassy-usb/Cargo.toml +++ b/embassy-usb/Cargo.toml @@ -10,7 +10,7 @@ features = ["defmt"] target = "thumbv7em-none-eabi" [dependencies] -embassy-util = { version = "0.1.0", path = "../embassy-util" } +embassy-futures = { version = "0.1.0", path = "../embassy-futures" } defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index 3f6e1347..5a3f8ba8 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs @@ -12,7 +12,7 @@ mod descriptor_reader; pub mod driver; pub mod types; -use embassy_util::{select, Either}; +use embassy_futures::{select, Either}; use heapless::Vec; pub use self::builder::{Builder, Config}; diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml index ef934663..b9ff9257 100644 --- a/examples/boot/application/nrf/Cargo.toml +++ b/examples/boot/application/nrf/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-nrf-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" } 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"] } diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml index 27eafa65..f143d1e8 100644 --- a/examples/boot/application/stm32f3/Cargo.toml +++ b/examples/boot/application/stm32f3/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32f3-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml index 7de0b82d..29c87eee 100644 --- a/examples/boot/application/stm32f7/Cargo.toml +++ b/examples/boot/application/stm32f7/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32f7-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml index 65d34c70..5669527f 100644 --- a/examples/boot/application/stm32h7/Cargo.toml +++ b/examples/boot/application/stm32h7/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32h7-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml index 8f37869e..48624d5e 100644 --- a/examples/boot/application/stm32l0/Cargo.toml +++ b/examples/boot/application/stm32l0/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32l0-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml index 6abf1986..00b638ca 100644 --- a/examples/boot/application/stm32l1/Cargo.toml +++ b/examples/boot/application/stm32l1/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32l1-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml index 6f2d12ff..51ba730d 100644 --- a/examples/boot/application/stm32l4/Cargo.toml +++ b/examples/boot/application/stm32l4/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32l4-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml index be97d4eb..182acf69 100644 --- a/examples/boot/application/stm32wl/Cargo.toml +++ b/examples/boot/application/stm32wl/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-boot-stm32wl-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/nrf-rtos-trace/Cargo.toml b/examples/nrf-rtos-trace/Cargo.toml index b0907f92..87c9f33f 100644 --- a/examples/nrf-rtos-trace/Cargo.toml +++ b/examples/nrf-rtos-trace/Cargo.toml @@ -8,14 +8,14 @@ default = ["log", "nightly"] nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits"] log = [ "dep:log", - "embassy-util/log", + "embassy-sync/log", "embassy-executor/log", "embassy-time/log", "embassy-nrf/log", ] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util" } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features=["rtos-trace", "rtos-trace-interrupt", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time" } embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml index 17f29b8f..b0af0c86 100644 --- a/examples/nrf/Cargo.toml +++ b/examples/nrf/Cargo.toml @@ -8,7 +8,8 @@ default = ["nightly"] nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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"] } diff --git a/examples/nrf/src/bin/channel.rs b/examples/nrf/src/bin/channel.rs index 19520098..8371fd0a 100644 --- a/examples/nrf/src/bin/channel.rs +++ b/examples/nrf/src/bin/channel.rs @@ -5,9 +5,9 @@ use defmt::unwrap; use embassy_executor::Spawner; use embassy_nrf::gpio::{Level, Output, OutputDrive}; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use embassy_time::{Duration, Timer}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; use {defmt_rtt as _, panic_probe as _}; enum LedState { diff --git a/examples/nrf/src/bin/channel_sender_receiver.rs b/examples/nrf/src/bin/channel_sender_receiver.rs index d250b6a5..55d1fccb 100644 --- a/examples/nrf/src/bin/channel_sender_receiver.rs +++ b/examples/nrf/src/bin/channel_sender_receiver.rs @@ -5,9 +5,9 @@ use defmt::unwrap; use embassy_executor::Spawner; use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin}; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; +use embassy_sync::channel::mpmc::{Channel, Receiver, Sender}; use embassy_time::{Duration, Timer}; -use embassy_util::blocking_mutex::raw::NoopRawMutex; -use embassy_util::channel::mpmc::{Channel, Receiver, Sender}; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/nrf/src/bin/mutex.rs b/examples/nrf/src/bin/mutex.rs index 87629788..c402c6ba 100644 --- a/examples/nrf/src/bin/mutex.rs +++ b/examples/nrf/src/bin/mutex.rs @@ -4,9 +4,9 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::mutex::Mutex; use embassy_time::{Duration, Timer}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::mutex::Mutex; use {defmt_rtt as _, panic_probe as _}; static MUTEX: Mutex = Mutex::new(0); diff --git a/examples/nrf/src/bin/pubsub.rs b/examples/nrf/src/bin/pubsub.rs index 1d90217f..64fed641 100644 --- a/examples/nrf/src/bin/pubsub.rs +++ b/examples/nrf/src/bin/pubsub.rs @@ -4,9 +4,9 @@ use defmt::unwrap; use embassy_executor::Spawner; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; use embassy_time::{Duration, Timer}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::pubsub::{DynSubscriber, PubSubChannel, Subscriber}; use {defmt_rtt as _, panic_probe as _}; /// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher diff --git a/examples/nrf/src/bin/uart_split.rs b/examples/nrf/src/bin/uart_split.rs index dab8e475..88b9c0a8 100644 --- a/examples/nrf/src/bin/uart_split.rs +++ b/examples/nrf/src/bin/uart_split.rs @@ -7,8 +7,8 @@ use embassy_executor::Spawner; use embassy_nrf::peripherals::UARTE0; use embassy_nrf::uarte::UarteRx; use embassy_nrf::{interrupt, uarte}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use {defmt_rtt as _, panic_probe as _}; static CHANNEL: Channel = Channel::new(); diff --git a/examples/nrf/src/bin/usb_ethernet.rs b/examples/nrf/src/bin/usb_ethernet.rs index d427f756..0200d880 100644 --- a/examples/nrf/src/bin/usb_ethernet.rs +++ b/examples/nrf/src/bin/usb_ethernet.rs @@ -14,10 +14,10 @@ use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; use embassy_nrf::rng::Rng; use embassy_nrf::usb::{Driver, PowerUsb}; use embassy_nrf::{interrupt, pac, peripherals}; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use embassy_usb::{Builder, Config, UsbDevice}; use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; use embedded_io::asynch::{Read, Write}; use static_cell::StaticCell; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/nrf/src/bin/usb_hid_keyboard.rs b/examples/nrf/src/bin/usb_hid_keyboard.rs index cf0078ee..d7c6dafd 100644 --- a/examples/nrf/src/bin/usb_hid_keyboard.rs +++ b/examples/nrf/src/bin/usb_hid_keyboard.rs @@ -8,14 +8,14 @@ use core::sync::atomic::{AtomicBool, Ordering}; use defmt::*; use embassy_executor::Spawner; +use embassy_futures::{select, Either}; use embassy_nrf::gpio::{Input, Pin, Pull}; use embassy_nrf::usb::{Driver, PowerUsb}; use embassy_nrf::{interrupt, pac}; +use embassy_sync::channel::signal::Signal; use embassy_usb::control::OutResponse; use embassy_usb::{Builder, Config, DeviceStateHandler}; use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State}; -use embassy_util::channel::signal::Signal; -use embassy_util::{select, Either}; use futures::future::join; use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index c2dcf429..d804a660 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml index 164a2b42..c7cec6b1 100644 --- a/examples/std/Cargo.toml +++ b/examples/std/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-std-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["log"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] } embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] } diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml index 8476200d..cd2995d2 100644 --- a/examples/stm32f0/Cargo.toml +++ b/examples/stm32f0/Cargo.toml @@ -11,7 +11,7 @@ cortex-m-rt = "0.7.0" defmt = "0.3" defmt-rtt = "0.3" panic-probe = "0.3" -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f030f4", "time-driver-any"] } diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml index fbc96400..8660e743 100644 --- a/examples/stm32f1/Cargo.toml +++ b/examples/stm32f1/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32f1-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] } diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml index 27894df5..b4bff4d8 100644 --- a/examples/stm32f2/Cargo.toml +++ b/examples/stm32f2/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32f2-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] } diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml index 4e6b0ea1..d152b145 100644 --- a/examples/stm32f3/Cargo.toml +++ b/examples/stm32f3/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32f3-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] } diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 61fc6dca..edf34b4d 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs @@ -15,9 +15,9 @@ use embassy_executor::Spawner; use embassy_stm32::exti::ExtiInput; use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; use embassy_stm32::peripherals::PA0; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use embassy_time::{with_timeout, Duration, Timer}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; use {defmt_rtt as _, panic_probe as _}; struct Leds<'a> { diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index f93a1d0f..9bfdda92 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "unstable-traits", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "unstable-traits", "defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml index e286d231..a446fe3f 100644 --- a/examples/stm32f7/Cargo.toml +++ b/examples/stm32f7/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32f7-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml index 5c80d43e..30f2b86f 100644 --- a/examples/stm32g0/Cargo.toml +++ b/examples/stm32g0/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32g0-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] } diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml index 74c645cf..f81df0b7 100644 --- a/examples/stm32g4/Cargo.toml +++ b/examples/stm32g4/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32g4-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] } diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index fc5f74f9..0f76f322 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32h7-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "unstable-traits", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } diff --git a/examples/stm32h7/src/bin/signal.rs b/examples/stm32h7/src/bin/signal.rs index be2ac268..ae41b07a 100644 --- a/examples/stm32h7/src/bin/signal.rs +++ b/examples/stm32h7/src/bin/signal.rs @@ -4,8 +4,8 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; +use embassy_sync::channel::signal::Signal; use embassy_time::{Duration, Timer}; -use embassy_util::channel::signal::Signal; use {defmt_rtt as _, panic_probe as _}; static SIGNAL: Signal = Signal::new(); diff --git a/examples/stm32h7/src/bin/usart_split.rs b/examples/stm32h7/src/bin/usart_split.rs index 64080ec4..55630dd3 100644 --- a/examples/stm32h7/src/bin/usart_split.rs +++ b/examples/stm32h7/src/bin/usart_split.rs @@ -7,8 +7,8 @@ use embassy_executor::Spawner; use embassy_stm32::dma::NoDma; use embassy_stm32::peripherals::{DMA1_CH1, UART7}; use embassy_stm32::usart::{Config, Uart, UartRx}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::task] diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index 72365a64..11751a21 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml @@ -8,7 +8,7 @@ default = ["nightly"] nightly = ["embassy-stm32/nightly", "embassy-lora", "lorawan-device", "lorawan", "embedded-io/async"] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml index 43f844b6..18b35b30 100644 --- a/examples/stm32l1/Cargo.toml +++ b/examples/stm32l1/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32l1-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index eaffa253..cb7238e4 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [features] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml index d8e78088..624c73c2 100644 --- a/examples/stm32l5/Cargo.toml +++ b/examples/stm32l5/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [features] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "unstable-traits", "memory-x"] } diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs index 95919551..b21d8629 100644 --- a/examples/stm32l5/src/bin/usb_ethernet.rs +++ b/examples/stm32l5/src/bin/usb_ethernet.rs @@ -15,10 +15,10 @@ use embassy_stm32::rng::Rng; use embassy_stm32::time::Hertz; use embassy_stm32::usb::Driver; use embassy_stm32::{interrupt, Config}; +use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; +use embassy_sync::channel::mpmc::Channel; use embassy_usb::{Builder, UsbDevice}; use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; -use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_util::channel::mpmc::Channel; use embedded_io::asynch::{Read, Write}; use rand_core::RngCore; use static_cell::StaticCell; diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml index 48833664..ff0ec9f4 100644 --- a/examples/stm32u5/Cargo.toml +++ b/examples/stm32u5/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32u5-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32u585ai", "time-driver-any", "memory-x" ] } diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml index b4630076..3b10da0a 100644 --- a/examples/stm32wb/Cargo.toml +++ b/examples/stm32wb/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32wb-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55cc", "time-driver-any", "exti"] } diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml index ae33478a..5f6679f4 100644 --- a/examples/stm32wl/Cargo.toml +++ b/examples/stm32wl/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-stm32wl-examples" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 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", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "subghz", "unstable-pac", "exti"] } diff --git a/examples/stm32wl/src/bin/subghz.rs b/examples/stm32wl/src/bin/subghz.rs index d16e3f5e..6d54e850 100644 --- a/examples/stm32wl/src/bin/subghz.rs +++ b/examples/stm32wl/src/bin/subghz.rs @@ -13,7 +13,7 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::interrupt; use embassy_stm32::interrupt::{Interrupt, InterruptExt}; use embassy_stm32::subghz::*; -use embassy_util::channel::signal::Signal; +use embassy_sync::channel::signal::Signal; use {defmt_rtt as _, panic_probe as _}; const PING_DATA: &str = "PING"; diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml index c7f98036..194e8f4b 100644 --- a/examples/wasm/Cargo.toml +++ b/examples/wasm/Cargo.toml @@ -7,7 +7,7 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["log"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "wasm", "nightly", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "wasm", "nightly"] } diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 8740cc48..4d6877cc 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml @@ -4,7 +4,7 @@ name = "embassy-rp-tests" version = "0.1.0" [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt"] } embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits"] } diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 1d12995a..f1441d00 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -13,7 +13,7 @@ stm32wb55rg = ["embassy-stm32/stm32wb55rg"] # Nucleo stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board [dependencies] -embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } +embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-32768hz"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-tim2"] }