diff --git a/Cargo.toml b/Cargo.toml index 74a8c0b..efe9bc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "embedded-hal-fuzz" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2021" authors = ["Nathaniel Brough"] repository = "https://github.com/silvergasp/embedded-hal-fuzz" @@ -11,7 +11,7 @@ license = "MIT" [dependencies] arbitrary = { version = "1.3.2", features = ["derive"] } -embedded-hal = {version = "1.0.0-rc.1"} +embedded-hal = {version = "1.0.0"} nb = "1.0.0" thiserror = "1.0.50" diff --git a/src/delay.rs b/src/delay.rs index c679d5d..46a8cda 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -2,15 +2,15 @@ //! this in as a value from the fuzz_target macro e.g. //! ```rust //! use libfuzzer_sys::fuzz_target; -//! use embedded_hal_fuzz::delay::ArbitraryDelayUs; -//! use embedded_hal::delay::DelayUs; -//! fuzz_target!(|delay_handle: ArbitraryDelayUs| { +//! use embedded_hal_fuzz::delay::ArbitraryDelayNs; +//! use embedded_hal::delay::DelayNs; +//! fuzz_target!(|delay_handle: ArbitraryDelayNs| { //! let mut delay_handle = delay_handle; //! delay_handle.delay_us(10); //! }); //! ``` use arbitrary::Arbitrary; -use embedded_hal::delay::DelayUs; +use embedded_hal::delay::DelayNs; /// An arbitrary delay implmentation that is a no-op /// when we are fuzzing we typically don't want to @@ -19,10 +19,10 @@ use embedded_hal::delay::DelayUs; /// delays to avoid race-conditions as this is poor /// design. #[derive(Debug, Arbitrary)] -pub struct ArbitraryDelayUs; +pub struct ArbitraryDelayNs; -impl DelayUs for ArbitraryDelayUs { - fn delay_us(&mut self, _us: u32) { +impl DelayNs for ArbitraryDelayNs { + fn delay_ns(&mut self, _us: u32) { // no-op } fn delay_ms(&mut self, _ms: u32) { diff --git a/src/digital.rs b/src/digital.rs index 12d4de2..1588396 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -50,7 +50,7 @@ impl ErrorType for ArbitraryInputPin { } impl InputPin for ArbitraryInputPin { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { match self.pin_states.try_borrow_mut() { Ok(mut pin_states) => match pin_states.pop() { Some(result) => result, @@ -59,7 +59,7 @@ impl InputPin for ArbitraryInputPin { Err(_) => Err(Error), } } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { self.is_high().map(|x| !x) } } @@ -102,14 +102,14 @@ impl OutputPin for ArbitraryOutputPin { } impl StatefulOutputPin for ArbitraryOutputPin { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { match self.maybe_error.try_borrow_mut().map_err(|_| Error)?.pop() { Some(Some(error)) => Err(error), _ => Ok(self.state == PinState::High), } } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { match self.maybe_error.try_borrow_mut().map_err(|_| Error)?.pop() { Some(Some(error)) => Err(error), _ => Ok(self.state == PinState::Low), diff --git a/src/pwm.rs b/src/pwm.rs index 4a526f1..68e1360 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -56,7 +56,7 @@ impl ErrorType for ArbitraryPwm { } impl SetDutyCycle for ArbitraryPwm { - fn get_max_duty_cycle(&self) -> u16 { + fn max_duty_cycle(&self) -> u16 { self.max_duty_cycle }