split embassy-util
into embassy-futures
, embassy-sync
.
This commit is contained in:
parent
61356181b2
commit
21072bee48
118 changed files with 391 additions and 142 deletions
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
|
@ -69,4 +69,4 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: cd embassy-util && cargo test
|
||||
run: cd embassy-sync && cargo test
|
||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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"}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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<Mutex::<ThreadModeRawMutex, Twim<TWISPI0>>> = 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;
|
||||
|
|
|
@ -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<Mutex<ThreadModeRawMutex, spim::Spim<SPI3>>> = 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;
|
||||
|
|
|
@ -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<NoopMutex<RefCell<Twim<TWISPI0>>>> = 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;
|
||||
|
||||
|
|
|
@ -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<NoopMutex<RefCell<Spim<SPI3>>>> = 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;
|
||||
|
|
14
embassy-futures/Cargo.toml
Normal file
14
embassy-futures/Cargo.toml
Normal file
|
@ -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 }
|
12
embassy-futures/src/lib.rs
Normal file
12
embassy-futures/src/lib.rs
Normal file
|
@ -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::*;
|
|
@ -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" }
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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 _;
|
||||
|
|
|
@ -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 _;
|
||||
|
|
|
@ -526,7 +526,7 @@ cfg_if::cfg_if! {
|
|||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
use embassy_util::waitqueue::AtomicWaker;
|
||||
use embassy_sync::waitqueue::AtomicWaker;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"]}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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"
|
||||
|
|
@ -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::<NoopRawMutex, u32, 3>::new();
|
|
@ -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
|
|
@ -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,
|
228
embassy-sync/src/fmt.rs
Normal file
228
embassy-sync/src/fmt.rs
Normal file
|
@ -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<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
|
||||
}
|
||||
}
|
|
@ -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::*;
|
|
@ -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::<NoopRawMutex, 256>::new();
|
|
@ -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 }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 _};
|
||||
|
||||
|
|
|
@ -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<ThreadModeRawMutex, u32> = Mutex::new(0);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<ThreadModeRawMutex, [u8; 8], 1> = Channel::new();
|
||||
|
|
|
@ -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 _};
|
||||
|
|
|
@ -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 _};
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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"] }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue