diff --git a/Cargo.toml b/Cargo.toml index 523163d..b20382b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,8 @@ helpers = [ "clap", "humantime", "std", "pcap-file", "libc", "byteorder", "rolli default = [ ] [dependencies] -embedded-hal = "1.0.0-rc.1" -embedded-hal-mock = { version = "0.9.0", optional = true } +embedded-hal = "1.0.0" +embedded-hal-mock = { version = "0.10.0", optional = true } nb = "1.0.0" log = { version = "0.4.14", default_features = false } diff --git a/src/blocking.rs b/src/blocking.rs index 3431ea4..5ff4959 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -1,6 +1,6 @@ //! Blocking APIs on top of the base radio traits //! -//! These implementations use the radio's DelayUs implementation to +//! These implementations use the radio's DelayNs implementation to //! poll on completion of operations. //! //! ## @@ -9,7 +9,7 @@ use core::fmt::Debug; use core::time::Duration; -use embedded_hal::delay::DelayUs; +use embedded_hal::delay::DelayNs; #[cfg(feature = "defmt")] use defmt::debug; @@ -63,7 +63,7 @@ impl From for BlockingError { } /// Blocking transmit function implemented over `radio::Transmit` and `radio::Power` using the provided -/// `BlockingOptions` and radio-internal `DelayUs` impl to poll for completion +/// `BlockingOptions` and radio-internal `DelayNs` impl to poll for completion #[cfg_attr( feature = "mock", doc = r##" @@ -75,7 +75,7 @@ use radio::{BlockingTransmit, BlockingOptions}; # let mut radio = MockRadio::new(&[ # Transaction::start_transmit(vec![0xaa, 0xbb], None), # Transaction::check_transmit(Ok(false)), -# Transaction::delay_us(100), +# Transaction::delay_ns(100000), # Transaction::check_transmit(Ok(true)), # ]); # @@ -99,7 +99,7 @@ pub trait BlockingTransmit { impl BlockingTransmit for T where - T: Transmit + DelayUs, + T: Transmit + DelayNs, E: Debug, { fn do_transmit( @@ -137,7 +137,7 @@ where } /// Blocking receive function implemented over `radio::Receive` using the provided `BlockingOptions` -/// and radio-internal `DelayUs` impl to poll for completion +/// and radio-internal `DelayNs` impl to poll for completion #[cfg_attr( feature = "mock", doc = r##" @@ -152,7 +152,7 @@ let info = BasicInfo::new(-81, 0); # let mut radio = MockRadio::new(&[ # Transaction::start_receive(None), # Transaction::check_receive(true, Ok(false)), -# Transaction::delay_us(100), +# Transaction::delay_ns(100000), # Transaction::check_receive(true, Ok(true)), # Transaction::get_received(Ok((data.to_vec(), info.clone()))), # ]); @@ -184,7 +184,7 @@ pub trait BlockingReceive { impl BlockingReceive for T where - T: Receive + DelayUs, + T: Receive + DelayNs, ::Info: Debug, I: Debug, E: Debug, @@ -228,7 +228,7 @@ pub trait BlockingSetState { impl BlockingSetState for T where - T: State + DelayUs, + T: State + DelayNs, S: Debug + core::cmp::PartialEq + Copy, E: Debug, { diff --git a/src/helpers.rs b/src/helpers.rs index 9c46487..1f61d9e 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -18,7 +18,7 @@ use log::{debug, info}; use defmt::{debug, info}; use clap::Parser; -use embedded_hal::delay::DelayUs; +use embedded_hal::delay::DelayNs; use humantime::Duration as HumanDuration; use byteorder::{ByteOrder, NetworkEndian}; @@ -62,7 +62,7 @@ where + Receive + Rssi + Power - + DelayUs, + + DelayNs, I: ReceiveInfo + Default + std::fmt::Debug, E: std::fmt::Debug, { @@ -102,7 +102,7 @@ pub struct TransmitOptions { pub fn do_transmit(radio: &mut T, options: TransmitOptions) -> Result<(), BlockingError> where - T: Transmit + Power + DelayUs, + T: Transmit + Power + DelayNs, E: core::fmt::Debug, { // Set output power if specified @@ -218,7 +218,7 @@ pub fn do_receive( options: ReceiveOptions, ) -> Result where - T: Receive + DelayUs, + T: Receive + DelayNs, I: std::fmt::Debug, E: std::fmt::Debug, { @@ -282,7 +282,7 @@ pub struct RssiOptions { pub fn do_rssi(radio: &mut T, options: RssiOptions) -> Result<(), E> where - T: Receive + Rssi + DelayUs, + T: Receive + Rssi + DelayNs, I: std::fmt::Debug, E: std::fmt::Debug, { @@ -336,7 +336,7 @@ pub fn do_echo( options: EchoOptions, ) -> Result> where - T: Receive + Transmit + Power + DelayUs, + T: Receive + Transmit + Power + DelayNs, I: ReceiveInfo + std::fmt::Debug, E: std::fmt::Debug, { @@ -421,7 +421,7 @@ pub fn do_ping_pong( options: PingPongOptions, ) -> Result> where - T: Receive + Transmit + Power + DelayUs, + T: Receive + Transmit + Power + DelayNs, I: ReceiveInfo, E: std::fmt::Debug, { diff --git a/src/mock.rs b/src/mock.rs index 4c682d0..96fde02 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -13,7 +13,7 @@ use std::vec::Vec; use log::debug; -use embedded_hal::delay::DelayUs; +use embedded_hal::delay::DelayNs; use embedded_hal_mock::common::Generic; @@ -217,9 +217,9 @@ impl Transaction { } /// Delay for a certain time - pub fn delay_us(ms: u32) -> Self { + pub fn delay_ns(ns: u32) -> Self { Self { - request: Request::DelayUs(ms), + request: Request::DelayNs(ns), response: Response::Ok, } } @@ -247,7 +247,7 @@ enum Request { CheckReceive(bool), GetReceived, - DelayUs(u32), + DelayNs(u32), } #[derive(Debug, Clone, PartialEq)] @@ -271,7 +271,7 @@ impl From> for Response { } } -impl DelayUs for Radio +impl DelayNs for Radio where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, @@ -280,10 +280,10 @@ where Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone, { - fn delay_us(&mut self, ms: u32) { - let n = self.next().expect("no expectation for delay_us call"); + fn delay_ns(&mut self, ns: u32) { + let n = self.next().expect("no expectation for delay_ns call"); - assert_eq!(&n.request, &Request::DelayUs(ms)); + assert_eq!(&n.request, &Request::DelayNs(ns)); } }