mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 14:22:33 +00:00
Update embedded-(hal,io,nal).
This commit is contained in:
parent
1b9925e3da
commit
4634316749
@ -23,7 +23,7 @@ cortex-m = "0.7.6"
|
||||
cortex-m-rt = "0.7.0"
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
|
||||
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.1" }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.2" }
|
||||
num_enum = { version = "0.5.7", default-features = false }
|
||||
|
||||
[package.metadata.embassy_docs]
|
||||
|
@ -25,8 +25,8 @@ embassy-time = { version = "0.1.5", path = "../embassy-time", optional = true }
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
|
||||
"unproven",
|
||||
] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true }
|
||||
embedded-storage = "0.3.0"
|
||||
embedded-storage-async = { version = "0.4.0", optional = true }
|
||||
nb = "1.0.0"
|
||||
|
@ -63,6 +63,10 @@ where
|
||||
CS: OutputPin,
|
||||
{
|
||||
async fn transaction(&mut self, operations: &mut [spi::Operation<'_, u8>]) -> Result<(), Self::Error> {
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
|
||||
return Err(SpiDeviceError::DelayNotSupported);
|
||||
}
|
||||
|
||||
let mut bus = self.bus.lock().await;
|
||||
self.cs.set_low().map_err(SpiDeviceError::Cs)?;
|
||||
|
||||
@ -74,12 +78,12 @@ where
|
||||
Operation::Transfer(read, write) => bus.transfer(read, write).await,
|
||||
Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await,
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(us) => return Err(SpiDeviceError::DelayUsNotSupported),
|
||||
Operation::DelayNs(_) => unreachable!(),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => match bus.flush().await {
|
||||
Operation::DelayNs(ns) => match bus.flush().await {
|
||||
Err(e) => Err(e),
|
||||
Ok(()) => {
|
||||
embassy_time::Timer::after_micros(*us as _).await;
|
||||
embassy_time::Timer::after_nanos(*ns as _).await;
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
@ -137,6 +141,10 @@ where
|
||||
CS: OutputPin,
|
||||
{
|
||||
async fn transaction(&mut self, operations: &mut [spi::Operation<'_, u8>]) -> Result<(), Self::Error> {
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
|
||||
return Err(SpiDeviceError::DelayNotSupported);
|
||||
}
|
||||
|
||||
let mut bus = self.bus.lock().await;
|
||||
bus.set_config(&self.config).map_err(|_| SpiDeviceError::Config)?;
|
||||
self.cs.set_low().map_err(SpiDeviceError::Cs)?;
|
||||
@ -149,12 +157,12 @@ where
|
||||
Operation::Transfer(read, write) => bus.transfer(read, write).await,
|
||||
Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await,
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(us) => return Err(SpiDeviceError::DelayUsNotSupported),
|
||||
Operation::DelayNs(_) => unreachable!(),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => match bus.flush().await {
|
||||
Operation::DelayNs(ns) => match bus.flush().await {
|
||||
Err(e) => Err(e),
|
||||
Ok(()) => {
|
||||
embassy_time::Timer::after_micros(*us as _).await;
|
||||
embassy_time::Timer::after_nanos(*ns as _).await;
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
|
@ -55,8 +55,8 @@ where
|
||||
CS: OutputPin,
|
||||
{
|
||||
fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> {
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayUs(_))) {
|
||||
return Err(SpiDeviceError::DelayUsNotSupported);
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
|
||||
return Err(SpiDeviceError::DelayNotSupported);
|
||||
}
|
||||
|
||||
self.bus.lock(|bus| {
|
||||
@ -69,10 +69,10 @@ where
|
||||
Operation::Transfer(read, write) => bus.transfer(read, write),
|
||||
Operation::TransferInPlace(buf) => bus.transfer_in_place(buf),
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(_) => unreachable!(),
|
||||
Operation::DelayNs(_) => unreachable!(),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => {
|
||||
embassy_time::block_for(embassy_time::Duration::from_micros(*us as _));
|
||||
Operation::DelayNs(ns) => {
|
||||
embassy_time::block_for(embassy_time::Duration::from_nanos(*ns as _));
|
||||
Ok(())
|
||||
}
|
||||
});
|
||||
@ -165,8 +165,8 @@ where
|
||||
CS: OutputPin,
|
||||
{
|
||||
fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> {
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayUs(_))) {
|
||||
return Err(SpiDeviceError::DelayUsNotSupported);
|
||||
if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) {
|
||||
return Err(SpiDeviceError::DelayNotSupported);
|
||||
}
|
||||
|
||||
self.bus.lock(|bus| {
|
||||
@ -180,10 +180,10 @@ where
|
||||
Operation::Transfer(read, write) => bus.transfer(read, write),
|
||||
Operation::TransferInPlace(buf) => bus.transfer_in_place(buf),
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(_) => unreachable!(),
|
||||
Operation::DelayNs(_) => unreachable!(),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => {
|
||||
embassy_time::block_for(embassy_time::Duration::from_micros(*us as _));
|
||||
Operation::DelayNs(ns) => {
|
||||
embassy_time::block_for(embassy_time::Duration::from_nanos(*ns as _));
|
||||
Ok(())
|
||||
}
|
||||
});
|
||||
|
@ -39,8 +39,8 @@ pub enum SpiDeviceError<BUS, CS> {
|
||||
Spi(BUS),
|
||||
/// Setting the value of the Chip Select (CS) pin failed.
|
||||
Cs(CS),
|
||||
/// DelayUs operations are not supported when the `time` Cargo feature is not enabled.
|
||||
DelayUsNotSupported,
|
||||
/// Delay operations are not supported when the `time` Cargo feature is not enabled.
|
||||
DelayNotSupported,
|
||||
/// The SPI bus could not be configured.
|
||||
Config,
|
||||
}
|
||||
@ -54,7 +54,7 @@ where
|
||||
match self {
|
||||
Self::Spi(e) => e.kind(),
|
||||
Self::Cs(_) => spi::ErrorKind::Other,
|
||||
Self::DelayUsNotSupported => spi::ErrorKind::Other,
|
||||
Self::DelayNotSupported => spi::ErrorKind::Other,
|
||||
Self::Config => spi::ErrorKind::Other,
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,16 @@ edition = "2021"
|
||||
heapless = "0.8"
|
||||
defmt = { version = "0.3", optional = true }
|
||||
log = { version = "0.4", default-features = false, optional = true }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.1", features = ["async"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] }
|
||||
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
|
||||
embassy-time = { version = "0.1.5", path = "../embassy-time" }
|
||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||
bitfield = "0.14.0"
|
||||
|
||||
[dev-dependencies]
|
||||
embedded-hal-mock = { version = "=0.10.0-rc.1", features = ["embedded-hal-async", "eh1"] }
|
||||
embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "c5c4dca18e043e6386aee02173f61a65fea3981e", features = ["embedded-hal-async", "eh1"] }
|
||||
crc = "3.0.1"
|
||||
env_logger = "0.10"
|
||||
critical-section = { version = "1.1.2", features = ["std"] }
|
||||
|
@ -729,7 +729,7 @@ mod tests {
|
||||
use core::convert::Infallible;
|
||||
|
||||
use embedded_hal_1::digital::{ErrorType, OutputPin};
|
||||
use embedded_hal_async::delay::DelayUs;
|
||||
use embedded_hal_async::delay::DelayNs;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use embedded_hal_mock::common::Generic;
|
||||
use embedded_hal_mock::eh1::spi::{Mock as SpiMock, Transaction as SpiTransaction};
|
||||
@ -760,7 +760,11 @@ mod tests {
|
||||
// see https://github.com/rust-embedded/embedded-hal/pull/462#issuecomment-1560014426
|
||||
struct MockDelay {}
|
||||
|
||||
impl DelayUs for MockDelay {
|
||||
impl DelayNs for MockDelay {
|
||||
async fn delay_ns(&mut self, _ns: u32) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn delay_us(&mut self, _us: u32) {
|
||||
todo!()
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
embedded-hal = { version = "1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
|
||||
embassy-time = { version = "0.1.5", path = "../embassy-time" }
|
||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||
|
@ -12,8 +12,8 @@ embassy-sync = { version = "0.4.0", path = "../embassy-sync"}
|
||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
|
||||
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"}
|
||||
|
||||
embedded-hal = { version = "1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
|
||||
noproto = { git="https://github.com/embassy-rs/noproto", rev = "f5e6d1f325b6ad4e344f60452b09576e24671f62", default-features = false, features = ["derive"] }
|
||||
#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] }
|
||||
|
@ -15,7 +15,7 @@ log = ["dep:log", "ppproto/log"]
|
||||
defmt = { version = "0.3", optional = true }
|
||||
log = { version = "0.4.14", optional = true }
|
||||
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
|
||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||
ppproto = { version = "0.1.2"}
|
||||
|
@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
embedded-hal = { version = "1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
|
||||
embassy-time = { version = "0.1.5", path = "../embassy-time" }
|
||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||
|
@ -54,7 +54,7 @@ smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "b57e2f9e70
|
||||
embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
|
||||
embassy-time = { version = "0.1.5", path = "../embassy-time" }
|
||||
embassy-sync = { version = "0.4.0", path = "../embassy-sync" }
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
|
||||
managed = { version = "0.8.0", default-features = false, features = [ "map" ] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
@ -63,4 +63,4 @@ generic-array = { version = "0.14.4", default-features = false }
|
||||
stable_deref_trait = { version = "1.2.0", default-features = false }
|
||||
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
|
||||
atomic-pool = "1.0"
|
||||
embedded-nal-async = { version = "0.7", optional = true }
|
||||
embedded-nal-async = { version = "0.7.1", optional = true }
|
||||
|
@ -101,10 +101,10 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
|
||||
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
|
||||
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-io = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
|
||||
defmt = { version = "0.3", optional = true }
|
||||
log = { version = "0.4.14", optional = true }
|
||||
|
@ -76,7 +76,7 @@ critical-section = "1.1"
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
chrono = { version = "0.4", default-features = false, optional = true }
|
||||
embedded-io = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
embedded-storage = { version = "0.3" }
|
||||
embedded-storage-async = { version = "0.4.0", optional = true }
|
||||
rand_core = "0.6.4"
|
||||
@ -85,9 +85,9 @@ fixed = "1.23.1"
|
||||
rp-pac = { version = "6" }
|
||||
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-nb = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-nb = { version = "=1.0.0-rc.2", optional = true}
|
||||
|
||||
pio-proc = {version= "0.2" }
|
||||
pio = {version= "0.2.1" }
|
||||
|
@ -42,9 +42,9 @@ embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optiona
|
||||
embassy-executor = { version = "0.3.3", path = "../embassy-executor", optional = true }
|
||||
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-nb = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-nb = { version = "=1.0.0-rc.2", optional = true}
|
||||
|
||||
embedded-storage = "0.3.0"
|
||||
embedded-storage-async = { version = "0.4.0", optional = true }
|
||||
@ -65,7 +65,7 @@ nb = "1.0.0"
|
||||
stm32-fmc = "0.3.0"
|
||||
cfg-if = "1.0.0"
|
||||
embedded-io = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
chrono = { version = "^0.4", default-features = false, optional = true}
|
||||
bit_field = "0.10.2"
|
||||
document-features = "0.2.7"
|
||||
|
@ -35,7 +35,7 @@ futures-util = { version = "0.3.17", default-features = false }
|
||||
critical-section = "1.1"
|
||||
heapless = "0.8"
|
||||
cfg-if = "1.0.0"
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
futures-executor = { version = "0.3.17", features = [ "thread-pool" ] }
|
||||
|
@ -22,8 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## 0.1.3 - 2023-08-28
|
||||
|
||||
- Update `embedded-hal-async` to `1.0.0-rc.1`
|
||||
- Update `embedded-hal v1` to `1.0.0-rc.1`
|
||||
- Update `embedded-hal-async` to `1.0.0-rc.2`
|
||||
- Update `embedded-hal v1` to `1.0.0-rc.2`
|
||||
|
||||
## 0.1.2 - 2023-07-05
|
||||
|
||||
|
@ -242,8 +242,8 @@ defmt = { version = "0.3", optional = true }
|
||||
log = { version = "0.4.14", optional = true }
|
||||
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true}
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2", optional = true}
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true}
|
||||
|
||||
futures-util = { version = "0.3.17", default-features = false }
|
||||
critical-section = "1.1"
|
||||
|
@ -18,7 +18,11 @@ pub struct Delay;
|
||||
mod eh1 {
|
||||
use super::*;
|
||||
|
||||
impl embedded_hal_1::delay::DelayUs for Delay {
|
||||
impl embedded_hal_1::delay::DelayNs for Delay {
|
||||
fn delay_ns(&mut self, ns: u32) {
|
||||
block_for(Duration::from_nanos(ns as u64))
|
||||
}
|
||||
|
||||
fn delay_us(&mut self, us: u32) {
|
||||
block_for(Duration::from_micros(us as u64))
|
||||
}
|
||||
@ -34,13 +38,17 @@ mod eha {
|
||||
use super::*;
|
||||
use crate::Timer;
|
||||
|
||||
impl embedded_hal_async::delay::DelayUs for Delay {
|
||||
async fn delay_us(&mut self, micros: u32) {
|
||||
Timer::after_micros(micros as _).await
|
||||
impl embedded_hal_async::delay::DelayNs for Delay {
|
||||
async fn delay_ns(&mut self, ns: u32) {
|
||||
Timer::after_nanos(ns as _).await
|
||||
}
|
||||
|
||||
async fn delay_ms(&mut self, millis: u32) {
|
||||
Timer::after_millis(millis as _).await
|
||||
async fn delay_us(&mut self, us: u32) {
|
||||
Timer::after_micros(us as _).await
|
||||
}
|
||||
|
||||
async fn delay_ms(&mut self, ms: u32) {
|
||||
Timer::after_millis(ms as _).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ use core::fmt;
|
||||
use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
||||
|
||||
use super::{GCD_1K, GCD_1M, TICK_HZ};
|
||||
use crate::GCD_1G;
|
||||
|
||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
@ -61,6 +62,14 @@ impl Duration {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a duration from the specified number of nanoseconds, rounding up.
|
||||
/// NOTE: Delays this small may be inaccurate.
|
||||
pub const fn from_nanos(micros: u64) -> Duration {
|
||||
Duration {
|
||||
ticks: div_ceil(micros * (TICK_HZ / GCD_1G), 1_000_000_000 / GCD_1G),
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a duration from the specified number of seconds, rounding down.
|
||||
pub const fn from_secs_floor(secs: u64) -> Duration {
|
||||
Duration { ticks: secs * TICK_HZ }
|
||||
|
@ -52,6 +52,7 @@ const fn gcd(a: u64, b: u64) -> u64 {
|
||||
|
||||
pub(crate) const GCD_1K: u64 = gcd(TICK_HZ, 1_000);
|
||||
pub(crate) const GCD_1M: u64 = gcd(TICK_HZ, 1_000_000);
|
||||
pub(crate) const GCD_1G: u64 = gcd(TICK_HZ, 1_000_000_000);
|
||||
|
||||
#[cfg(feature = "defmt-timestamp-uptime")]
|
||||
defmt::timestamp! {"{=u64:us}", Instant::now().as_micros() }
|
||||
|
@ -74,6 +74,15 @@ impl Timer {
|
||||
Self::after(Duration::from_ticks(ticks))
|
||||
}
|
||||
|
||||
/// Expire after the specified number of nanoseconds.
|
||||
///
|
||||
/// This method is a convenience wrapper for calling `Timer::after(Duration::from_nanos())`.
|
||||
/// For more details, refer to [`Timer::after()`] and [`Duration::from_nanos()`].
|
||||
#[inline]
|
||||
pub fn after_nanos(nanos: u64) -> Self {
|
||||
Self::after(Duration::from_nanos(nanos))
|
||||
}
|
||||
|
||||
/// Expire after the specified number of microseconds.
|
||||
///
|
||||
/// This method is a convenience wrapper for calling `Timer::after(Duration::from_micros())`.
|
||||
|
@ -32,7 +32,7 @@ embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defm
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet"], optional = true }
|
||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true }
|
||||
embedded-io = { version = "0.6.0", features = ["defmt-03"] }
|
||||
embedded-io-async = { version = "0.6.0", optional = true, features = ["defmt-03"] }
|
||||
embedded-io-async = { version = "0.6.1", optional = true, features = ["defmt-03"] }
|
||||
embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"], optional = true }
|
||||
embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"], optional = true }
|
||||
|
||||
@ -49,9 +49,9 @@ rand = { version = "0.8.4", default-features = false }
|
||||
embedded-storage = "0.3.0"
|
||||
usbd-hid = "0.6.0"
|
||||
serde = { version = "1.0.136", default-features = false }
|
||||
embedded-hal = { version = "1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "1.0.0-rc.1", optional = true }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.1" }
|
||||
embedded-hal = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "1.0.0-rc.2", optional = true }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.2" }
|
||||
num-integer = { version = "0.1.45", default-features = false }
|
||||
microfft = "0.5.0"
|
||||
|
||||
|
@ -37,7 +37,7 @@ embassy-net = { version = "0.2.0", path = "../../embassy-net", features = [
|
||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = [
|
||||
"defmt",
|
||||
] }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
|
||||
defmt = "0.3"
|
||||
defmt-rtt = "0.4"
|
||||
|
@ -38,10 +38,10 @@ smart-leds = "0.3.0"
|
||||
heapless = "0.8"
|
||||
usbd-hid = "0.6.1"
|
||||
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = "1.0.0-rc.1"
|
||||
embedded-hal-bus = { version = "0.1.0-rc.1", features = ["async"] }
|
||||
embedded-io-async = { version = "0.6.0", features = ["defmt-03"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = "1.0.0-rc.2"
|
||||
embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] }
|
||||
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
||||
embedded-storage = { version = "0.3" }
|
||||
static_cell = { version = "2", features = ["nightly"]}
|
||||
portable-atomic = { version = "1.5", features = ["critical-section"] }
|
||||
|
@ -11,8 +11,8 @@ embassy-time = { version = "0.1.5", path = "../../embassy-time", features = ["lo
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features=[ "std", "nightly", "log", "medium-ethernet", "medium-ip", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6"] }
|
||||
embassy-net-tuntap = { version = "0.1.0", path = "../../embassy-net-tuntap" }
|
||||
embassy-net-ppp = { version = "0.1.0", path = "../../embassy-net-ppp", features = ["log"]}
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-adapters = { version = "0.6.0", features = ["futures-03"] }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embedded-io-adapters = { version = "0.6.1", features = ["futures-03"] }
|
||||
critical-section = { version = "1.1", features = ["std"] }
|
||||
|
||||
async-io = "1.6.0"
|
||||
|
@ -20,7 +20,7 @@ cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-sing
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-io = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
|
@ -11,7 +11,7 @@ embassy-sync = { version = "0.4.0", path = "../../embassy-sync", features = ["de
|
||||
embassy-executor = { version = "0.3.3", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
|
||||
embassy-time = { version = "0.1.5", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet"] }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
|
||||
|
||||
defmt = "0.3"
|
||||
|
@ -11,7 +11,7 @@ embassy-sync = { version = "0.4.0", path = "../../embassy-sync", features = ["de
|
||||
embassy-executor = { version = "0.3.3", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
|
||||
embassy-time = { version = "0.1.5", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
|
||||
|
||||
defmt = "0.3"
|
||||
@ -20,9 +20,9 @@ defmt-rtt = "0.4"
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-nal-async = { version = "0.7" }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embedded-nal-async = { version = "0.7.1" }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
|
@ -11,7 +11,7 @@ embassy-sync = { version = "0.4.0", path = "../../embassy-sync", features = ["de
|
||||
embassy-executor = { version = "0.3.3", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
|
||||
embassy-time = { version = "0.1.5", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6", "dns"] }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
|
||||
|
||||
defmt = "0.3"
|
||||
@ -20,9 +20,9 @@ defmt-rtt = "0.4"
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-nal-async = { version = "0.7" }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embedded-nal-async = { version = "0.7.1" }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
|
@ -20,7 +20,7 @@ defmt-rtt = "0.4"
|
||||
|
||||
embedded-storage = "0.3.0"
|
||||
embedded-io = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
|
@ -15,7 +15,7 @@ embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defm
|
||||
embassy-net-adin1110 = { version = "0.2.0", path = "../../embassy-net-adin1110" }
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "nightly", "udp", "tcp", "dhcpv4", "medium-ethernet"] }
|
||||
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
|
||||
embedded-io-async = { version = "0.6.0", features = ["defmt-03"] }
|
||||
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
||||
embedded-io = { version = "0.6.0", features = ["defmt-03"] }
|
||||
|
||||
defmt = "0.3"
|
||||
@ -24,9 +24,9 @@ defmt-rtt = "0.4"
|
||||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.1", features = ["async"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
|
@ -25,7 +25,7 @@ embedded-hal = "0.2.6"
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
rand_core = { version = "0.6.3", default-features = false }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
static_cell = { version = "2", features = ["nightly"]}
|
||||
|
||||
[profile.release]
|
||||
|
@ -12,12 +12,12 @@ embassy-sync = { version = "0.4.0", path = "../../embassy-sync", features = ["de
|
||||
embassy-executor = { version = "0.3.3", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "task-arena-size-16384", "integrated-timers"] }
|
||||
embassy-time = { version = "0.1.5", path = "../../embassy-time", features = ["defmt", "nightly", "unstable-traits", "defmt-timestamp-uptime"] }
|
||||
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nightly", "unstable-traits", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
|
||||
embedded-io-async = { version = "0.6.0", features = ["defmt-03"] }
|
||||
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
||||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] }
|
||||
embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] }
|
||||
embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"] }
|
||||
embedded-hal-async = { version = "1.0.0-rc.1" }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.1", features = ["async"] }
|
||||
embedded-hal-async = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] }
|
||||
static_cell = { version = "2", features = [ "nightly" ] }
|
||||
perf-client = { path = "../perf-client" }
|
||||
|
||||
|
@ -24,12 +24,12 @@ defmt-rtt = "0.4"
|
||||
cortex-m = { version = "0.7.6" }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.1", features = ["async"] }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] }
|
||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
embedded-io-async = { version = "0.6.0" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
embedded-storage = { version = "0.3" }
|
||||
static_cell = { version = "2", features = ["nightly"]}
|
||||
portable-atomic = { version = "1.5", features = ["critical-section"] }
|
||||
|
@ -63,8 +63,8 @@ defmt-rtt = "0.4"
|
||||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.1" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.1" }
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = { version = "=1.0.0-rc.2" }
|
||||
micromath = "2.0.0"
|
||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||
rand_core = { version = "0.6", default-features = false }
|
||||
|
Loading…
Reference in New Issue
Block a user