From 9d8dbd67fe769a128a51f4faac3b2d15269b2cfb Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Thu, 14 Dec 2023 16:01:51 +0100 Subject: [PATCH] Update embedded-hal to 1.0.0-rc.3 --- cyw43/Cargo.toml | 2 +- .../layer-by-layer/blinky-hal/src/main.rs | 2 +- embassy-embedded-hal/Cargo.toml | 4 +- embassy-net-adin1110/Cargo.toml | 8 +- embassy-net-enc28j60/Cargo.toml | 4 +- embassy-net-esp-hosted/Cargo.toml | 4 +- embassy-net-wiznet/Cargo.toml | 4 +- embassy-nrf/Cargo.toml | 5 +- embassy-nrf/src/gpio.rs | 67 +++++++----- embassy-nrf/src/gpiote.rs | 10 +- embassy-rp/Cargo.toml | 6 +- embassy-rp/src/gpio.rs | 101 ++++++++++-------- embassy-stm32/Cargo.toml | 6 +- embassy-stm32/src/exti.rs | 14 +-- embassy-stm32/src/gpio.rs | 94 ++++++++-------- embassy-time/CHANGELOG.md | 4 +- embassy-time/Cargo.toml | 4 +- examples/nrf52840/Cargo.toml | 6 +- examples/rp/Cargo.toml | 6 +- examples/rp/src/bin/button.rs | 2 +- examples/stm32c0/src/bin/button.rs | 2 +- examples/stm32f3/src/bin/button.rs | 2 +- examples/stm32f4/src/bin/button.rs | 2 +- examples/stm32f7/src/bin/button.rs | 2 +- examples/stm32g0/src/bin/button.rs | 2 +- examples/stm32g4/src/bin/button.rs | 2 +- examples/stm32h5/Cargo.toml | 4 +- examples/stm32h7/Cargo.toml | 4 +- examples/stm32l0/src/bin/button.rs | 2 +- examples/stm32l4/Cargo.toml | 6 +- examples/stm32l4/src/bin/button.rs | 2 +- .../src/bin/spe_adin1110_http_server.rs | 8 +- .../stm32l4/src/bin/spi_blocking_async.rs | 2 +- examples/stm32l4/src/bin/spi_dma.rs | 2 +- examples/stm32wl/src/bin/button.rs | 2 +- tests/nrf/Cargo.toml | 4 +- tests/rp/Cargo.toml | 6 +- tests/rp/src/bin/gpio.rs | 10 +- tests/rp/src/bin/pwm.rs | 8 +- tests/stm32/Cargo.toml | 4 +- tests/stm32/src/bin/gpio.rs | 12 +-- 41 files changed, 238 insertions(+), 203 deletions(-) diff --git a/cyw43/Cargo.toml b/cyw43/Cargo.toml index 293c0098..72faad80 100644 --- a/cyw43/Cargo.toml +++ b/cyw43/Cargo.toml @@ -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.2" } +embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.3" } num_enum = { version = "0.5.7", default-features = false } [package.metadata.embassy_docs] diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs index d0c9f490..54b87662 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs @@ -9,7 +9,7 @@ use {defmt_rtt as _, panic_probe as _}; fn main() -> ! { let p = embassy_stm32::init(Default::default()); let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh); - let button = Input::new(p.PC13, Pull::Up); + let mut button = Input::new(p.PC13, Pull::Up); loop { if button.is_low() { diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml index 2a0b2547..f292f952 100644 --- a/embassy-embedded-hal/Cargo.toml +++ b/embassy-embedded-hal/Cargo.toml @@ -23,8 +23,8 @@ embassy-time = { version = "0.2", 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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embedded-storage = "0.3.1" embedded-storage-async = { version = "0.4.1" } nb = "1.0.0" diff --git a/embassy-net-adin1110/Cargo.toml b/embassy-net-adin1110/Cargo.toml index d95b2628..adcdfe80 100644 --- a/embassy-net-adin1110/Cargo.toml +++ b/embassy-net-adin1110/Cargo.toml @@ -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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } -embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } +embedded-hal-bus = { version = "=0.1.0-rc.3", features = ["async"] } embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } embassy-time = { version = "0.2", path = "../embassy-time" } embassy-futures = { version = "0.1.0", path = "../embassy-futures" } bitfield = "0.14.0" [dev-dependencies] -embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "c5c4dca18e043e6386aee02173f61a65fea3981e", features = ["embedded-hal-async", "eh1"] } +embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "b5a2274759a8c484f4fae71a22f8a083fdd9d5da", features = ["embedded-hal-async", "eh1"] } crc = "3.0.1" env_logger = "0.10" critical-section = { version = "1.1.2", features = ["std"] } diff --git a/embassy-net-enc28j60/Cargo.toml b/embassy-net-enc28j60/Cargo.toml index 72e1d4e5..8cd723c4 100644 --- a/embassy-net-enc28j60/Cargo.toml +++ b/embassy-net-enc28j60/Cargo.toml @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0" edition = "2021" [dependencies] -embedded-hal = { version = "1.0.0-rc.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal = { version = "1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } embassy-time = { version = "0.2", path = "../embassy-time" } embassy-futures = { version = "0.1.0", path = "../embassy-futures" } diff --git a/embassy-net-esp-hosted/Cargo.toml b/embassy-net-esp-hosted/Cargo.toml index eb44a654..70b1bbe2 100644 --- a/embassy-net-esp-hosted/Cargo.toml +++ b/embassy-net-esp-hosted/Cargo.toml @@ -12,8 +12,8 @@ embassy-sync = { version = "0.5.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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal = { version = "1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } 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"] } diff --git a/embassy-net-wiznet/Cargo.toml b/embassy-net-wiznet/Cargo.toml index 9c103ebb..a1f0b0c5 100644 --- a/embassy-net-wiznet/Cargo.toml +++ b/embassy-net-wiznet/Cargo.toml @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0" edition = "2021" [dependencies] -embedded-hal = { version = "1.0.0-rc.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal = { version = "1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } embassy-time = { version = "0.2", path = "../embassy-time" } embassy-futures = { version = "0.1.0", path = "../embassy-futures" } diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index a7f3cb35..6d744051 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml @@ -94,8 +94,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } -embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embedded-io = { version = "0.6.0" } embedded-io-async = { version = "0.6.1" } @@ -120,4 +120,3 @@ nrf52840-pac = { version = "0.12.0", optional = true } nrf5340-app-pac = { version = "0.12.0", optional = true } nrf5340-net-pac = { version = "0.12.0", optional = true } nrf9160-pac = { version = "0.12.0", optional = true } - diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index cf622528..85977a80 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs @@ -52,19 +52,19 @@ impl<'d, T: Pin> Input<'d, T> { /// Test if current pin level is high. #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { self.pin.is_high() } /// Test if current pin level is low. #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.pin.get_level() } } @@ -160,19 +160,19 @@ impl<'d, T: Pin> Output<'d, T> { /// Is the output pin set as high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { self.pin.is_set_high() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { self.pin.is_set_low() } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.pin.get_output_level() } } @@ -277,19 +277,24 @@ impl<'d, T: Pin> Flex<'d, T> { /// Test if current pin level is high. #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { !self.is_low() } /// Test if current pin level is low. #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { + self.ref_is_low() + } + + #[inline] + pub(crate) fn ref_is_low(&self) -> bool { self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0 } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.is_high().into() } @@ -316,19 +321,25 @@ impl<'d, T: Pin> Flex<'d, T> { /// Is the output pin set as high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { !self.is_set_low() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { + self.ref_is_set_low() + } + + /// Is the output pin set as low? + #[inline] + pub(crate) fn ref_is_set_low(&self) -> bool { self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0 } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.is_set_high().into() } } @@ -498,11 +509,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.pin.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.pin.ref_is_low()) } } @@ -520,11 +531,11 @@ mod eh02 { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.pin.ref_is_set_low()) } fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.pin.ref_is_set_low()) } } @@ -535,11 +546,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.ref_is_low()) } } @@ -557,11 +568,11 @@ mod eh02 { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.ref_is_set_low()) } fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.ref_is_set_low()) } } } @@ -571,11 +582,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -595,11 +606,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } @@ -612,11 +623,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { /// /// If the pin is not in input mode the result is unspecified. impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -632,11 +643,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index fd629ea7..07196abf 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -243,7 +243,7 @@ impl<'d, C: Channel, T: GpioPin> Drop for OutputChannel<'d, C, T> { impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> { /// Create a new GPIOTE output channel driver. - pub fn new(ch: impl Peripheral

+ 'd, pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self { + pub fn new(ch: impl Peripheral

+ 'd, mut pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self { into_ref!(ch); let g = regs(); let num = ch.number(); @@ -481,11 +481,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.pin.is_high()) + Ok(!self.pin.pin.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.pin.is_low()) + Ok(self.pin.pin.ref_is_low()) } } } @@ -495,11 +495,11 @@ impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::ErrorType for InputCha } impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.pin.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.pin.is_low()) } } diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index dfdd1fee..c557940b 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml @@ -78,9 +78,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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } -embedded-hal-nb = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } +embedded-hal-nb = { version = "=1.0.0-rc.3" } pio-proc = {version= "0.2" } pio = {version= "0.2.1" } diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 9034f3f3..23273e62 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -105,18 +105,18 @@ impl<'d, T: Pin> Input<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { self.pin.is_high() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.pin.get_level() } @@ -357,19 +357,19 @@ impl<'d, T: Pin> Output<'d, T> { /// Is the output pin set as high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { self.pin.is_set_high() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { self.pin.is_set_low() } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.pin.get_output_level() } @@ -434,19 +434,19 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { /// Is the output level high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { !self.is_set_low() } /// Is the output level low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { self.pin.is_set_as_output() } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.is_set_high().into() } @@ -457,18 +457,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { self.pin.is_high() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.is_high().into() } @@ -590,7 +590,12 @@ impl<'d, T: Pin> Flex<'d, T> { } #[inline] - fn is_set_as_output(&self) -> bool { + pub fn is_set_as_output(&mut self) -> bool { + self.ref_is_set_as_output() + } + + #[inline] + pub(crate) fn ref_is_set_as_output(&self) -> bool { (self.pin.sio_oe().value().read() & self.bit()) != 0 } @@ -600,18 +605,23 @@ impl<'d, T: Pin> Flex<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { !self.is_low() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { + self.ref_is_low() + } + + #[inline] + pub(crate) fn ref_is_low(&self) -> bool { self.pin.sio_in().read() & self.bit() == 0 } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.is_high().into() } @@ -638,19 +648,24 @@ impl<'d, T: Pin> Flex<'d, T> { /// Is the output level high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { !self.is_set_low() } /// Is the output level low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { + self.ref_is_set_low() + } + + #[inline] + pub(crate) fn ref_is_set_low(&self) -> bool { (self.pin.sio_out().value().read() & self.bit()) == 0 } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.is_set_high().into() } @@ -912,11 +927,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.pin.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.pin.ref_is_low()) } } @@ -934,11 +949,11 @@ mod eh02 { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.pin.ref_is_set_low()) } fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.pin.ref_is_set_low()) } } @@ -954,11 +969,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.pin.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.pin.ref_is_low()) } } @@ -978,11 +993,11 @@ mod eh02 { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.pin.ref_is_set_as_output()) } fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.pin.ref_is_set_as_output()) } } @@ -998,11 +1013,11 @@ mod eh02 { type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.ref_is_low()) } } @@ -1020,11 +1035,11 @@ mod eh02 { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.ref_is_set_low()) } fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.ref_is_set_low()) } } @@ -1042,11 +1057,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -1066,11 +1081,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } @@ -1096,11 +1111,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } @@ -1112,11 +1127,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai } impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -1126,11 +1141,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -1146,11 +1161,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { } impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index f54d5608..4a7a2f2c 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -42,9 +42,9 @@ embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } embassy-executor = { version = "0.4.0", 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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } -embedded-hal-nb = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } +embedded-hal-nb = { version = "=1.0.0-rc.3" } embedded-storage = "0.3.1" embedded-storage-async = { version = "0.4.1" } diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index dbd24804..e77ac30f 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -97,15 +97,15 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> { Self { pin } } - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { self.pin.is_high() } - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.pin.get_level() } @@ -142,11 +142,11 @@ impl<'d, T: GpioPin> embedded_hal_02::digital::v2::InputPin for ExtiInput<'d, T> type Error = Infallible; fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.pin.pin.ref_is_low()) } fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.pin.pin.ref_is_low()) } } @@ -155,11 +155,11 @@ impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> { } impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index b863c4ff..bb3cf2bc 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -142,36 +142,46 @@ impl<'d, T: Pin> Flex<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { - !self.is_low() + pub fn is_high(&mut self) -> bool { + !self.ref_is_low() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { + self.ref_is_low() + } + + #[inline] + pub(crate) fn ref_is_low(&self) -> bool { let state = self.pin.block().idr().read().idr(self.pin.pin() as _); state == vals::Idr::LOW } #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.is_high().into() } #[inline] - pub fn is_set_high(&self) -> bool { - !self.is_set_low() + pub fn is_set_high(&mut self) -> bool { + !self.ref_is_set_low() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { + self.ref_is_set_low() + } + + #[inline] + pub(crate) fn ref_is_set_low(&self) -> bool { let state = self.pin.block().odr().read().odr(self.pin.pin() as _); state == vals::Odr::LOW } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.is_set_high().into() } @@ -310,17 +320,17 @@ impl<'d, T: Pin> Input<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { self.pin.is_high() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.pin.get_level() } } @@ -399,19 +409,19 @@ impl<'d, T: Pin> Output<'d, T> { /// Is the output pin set as high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { self.pin.is_set_high() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { self.pin.is_set_low() } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.pin.get_output_level() } @@ -453,18 +463,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { } #[inline] - pub fn is_high(&self) -> bool { + pub fn is_high(&mut self) -> bool { !self.pin.is_low() } #[inline] - pub fn is_low(&self) -> bool { + pub fn is_low(&mut self) -> bool { self.pin.is_low() } /// Returns current pin level #[inline] - pub fn get_level(&self) -> Level { + pub fn get_level(&mut self) -> Level { self.pin.get_level() } @@ -488,19 +498,19 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { /// Is the output pin set as high? #[inline] - pub fn is_set_high(&self) -> bool { + pub fn is_set_high(&mut self) -> bool { self.pin.is_set_high() } /// Is the output pin set as low? #[inline] - pub fn is_set_low(&self) -> bool { + pub fn is_set_low(&mut self) -> bool { self.pin.is_set_low() } /// What level output is set to #[inline] - pub fn get_output_level(&self) -> Level { + pub fn get_output_level(&mut self) -> Level { self.pin.get_output_level() } @@ -777,12 +787,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Input<'d, T> { #[inline] fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.pin.ref_is_low()) } #[inline] fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.pin.ref_is_low()) } } @@ -805,13 +815,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { #[inline] fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.pin.ref_is_set_low()) } /// Is the output pin set as low? #[inline] fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.pin.ref_is_set_low()) } } @@ -843,13 +853,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { #[inline] fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.pin.ref_is_set_low()) } /// Is the output pin set as low? #[inline] fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.pin.ref_is_set_low()) } } @@ -867,12 +877,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Flex<'d, T> { #[inline] fn is_high(&self) -> Result { - Ok(self.is_high()) + Ok(!self.ref_is_low()) } #[inline] fn is_low(&self) -> Result { - Ok(self.is_low()) + Ok(self.ref_is_low()) } } @@ -895,13 +905,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { #[inline] fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) + Ok(!self.ref_is_set_low()) } /// Is the output pin set as low? #[inline] fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) + Ok(self.ref_is_set_low()) } } @@ -920,12 +930,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { #[inline] - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } #[inline] - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -948,13 +958,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { #[inline] - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } /// Is the output pin set as low? #[inline] - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } @@ -972,12 +982,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { #[inline] - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } #[inline] - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -996,13 +1006,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { #[inline] - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } /// Is the output pin set as low? #[inline] - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } @@ -1016,12 +1026,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { #[inline] - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(self.is_high()) } #[inline] - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(self.is_low()) } } @@ -1051,13 +1061,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { #[inline] - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(self.is_set_high()) } /// Is the output pin set as low? #[inline] - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(self.is_set_low()) } } diff --git a/embassy-time/CHANGELOG.md b/embassy-time/CHANGELOG.md index d8c0c7d0..99f6ef7a 100644 --- a/embassy-time/CHANGELOG.md +++ b/embassy-time/CHANGELOG.md @@ -24,8 +24,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.2` -- Update `embedded-hal v1` to `1.0.0-rc.2` +- Update `embedded-hal-async` to `1.0.0-rc.3` +- Update `embedded-hal v1` to `1.0.0-rc.3` ## 0.1.2 - 2023-07-05 diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml index 94e79382..6d9b7aa6 100644 --- a/embassy-time/Cargo.toml +++ b/embassy-time/Cargo.toml @@ -235,8 +235,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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } futures-util = { version = "0.3.17", default-features = false } critical-section = "1.1" diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml index 65cd631f..1c49c32e 100644 --- a/examples/nrf52840/Cargo.toml +++ b/examples/nrf52840/Cargo.toml @@ -36,9 +36,9 @@ rand = { version = "0.8.4", default-features = false } embedded-storage = "0.3.1" usbd-hid = "0.6.0" serde = { version = "1.0.136", default-features = false } -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"] } +embedded-hal = { version = "1.0.0-rc.3" } +embedded-hal-async = { version = "1.0.0-rc.3" } +embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } num-integer = { version = "0.1.45", default-features = false } microfft = "0.5.0" diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index 7f637758..521f17b8 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml @@ -38,9 +38,9 @@ smart-leds = "0.3.0" heapless = "0.8" usbd-hid = "0.6.1" -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-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = "1.0.0-rc.3" +embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } embedded-storage = { version = "0.3" } static_cell = { version = "2", features = ["nightly"]} diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index d7aa8941..a9f34ab5 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs @@ -17,7 +17,7 @@ async fn main(_spawner: Spawner) { // Use PIN_28, Pin34 on J0 for RP Pico, as a input. // You need to add your own button. - let button = Input::new(p.PIN_28, Pull::Up); + let mut button = Input::new(p.PIN_28, Pull::Up); loop { if button.is_high() { diff --git a/examples/stm32c0/src/bin/button.rs b/examples/stm32c0/src/bin/button.rs index 72a3f5cb..40c58013 100644 --- a/examples/stm32c0/src/bin/button.rs +++ b/examples/stm32c0/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Up); + let mut button = Input::new(p.PC13, Pull::Up); loop { if button.is_high() { diff --git a/examples/stm32f3/src/bin/button.rs b/examples/stm32f3/src/bin/button.rs index b55bf390..2f47d8f8 100644 --- a/examples/stm32f3/src/bin/button.rs +++ b/examples/stm32f3/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PA0, Pull::Down); + let mut button = Input::new(p.PA0, Pull::Down); let mut led1 = Output::new(p.PE9, Level::High, Speed::Low); let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); diff --git a/examples/stm32f4/src/bin/button.rs b/examples/stm32f4/src/bin/button.rs index b13e6453..aa1eed46 100644 --- a/examples/stm32f4/src/bin/button.rs +++ b/examples/stm32f4/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Down); + let mut button = Input::new(p.PC13, Pull::Down); let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); let _led2 = Output::new(p.PB7, Level::High, Speed::Low); let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); diff --git a/examples/stm32f7/src/bin/button.rs b/examples/stm32f7/src/bin/button.rs index b13e6453..aa1eed46 100644 --- a/examples/stm32f7/src/bin/button.rs +++ b/examples/stm32f7/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Down); + let mut button = Input::new(p.PC13, Pull::Down); let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); let _led2 = Output::new(p.PB7, Level::High, Speed::Low); let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); diff --git a/examples/stm32g0/src/bin/button.rs b/examples/stm32g0/src/bin/button.rs index 72a3f5cb..40c58013 100644 --- a/examples/stm32g0/src/bin/button.rs +++ b/examples/stm32g0/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Up); + let mut button = Input::new(p.PC13, Pull::Up); loop { if button.is_high() { diff --git a/examples/stm32g4/src/bin/button.rs b/examples/stm32g4/src/bin/button.rs index 15abd86d..127efb08 100644 --- a/examples/stm32g4/src/bin/button.rs +++ b/examples/stm32g4/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Down); + let mut button = Input::new(p.PC13, Pull::Down); loop { if button.is_high() { diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml index 0ed0ce3c..f714a398 100644 --- a/examples/stm32h5/Cargo.toml +++ b/examples/stm32h5/Cargo.toml @@ -19,8 +19,8 @@ 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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embedded-io-async = { version = "0.6.1" } embedded-nal-async = { version = "0.7.1" } panic-probe = { version = "0.3", features = ["print-defmt"] } diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index baa530cf..c6aea3e1 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml @@ -19,8 +19,8 @@ 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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } embedded-nal-async = { version = "0.7.1" } embedded-io-async = { version = "0.6.1" } panic-probe = { version = "0.3", features = ["print-defmt"] } diff --git a/examples/stm32l0/src/bin/button.rs b/examples/stm32l0/src/bin/button.rs index 9d194471..3e56160e 100644 --- a/examples/stm32l0/src/bin/button.rs +++ b/examples/stm32l0/src/bin/button.rs @@ -12,7 +12,7 @@ async fn main(_spawner: Spawner) { let p = embassy_stm32::init(Default::default()); info!("Hello World!"); - let button = Input::new(p.PB2, Pull::Up); + let mut button = Input::new(p.PB2, Pull::Up); let mut led1 = Output::new(p.PA5, Level::High, Speed::Low); let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index a936d27c..2861216d 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml @@ -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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } -embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } +embedded-hal-bus = { version = "=0.1.0-rc.3", 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 } diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs index 73b1962e..0a102c2d 100644 --- a/examples/stm32l4/src/bin/button.rs +++ b/examples/stm32l4/src/bin/button.rs @@ -12,7 +12,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PC13, Pull::Up); + let mut button = Input::new(p.PC13, Pull::Up); loop { if button.is_high() { diff --git a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs index 4826e0be..8ec810c7 100644 --- a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs +++ b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs @@ -114,8 +114,8 @@ async fn main(spawner: Spawner) { let led_uc4_blue = Output::new(dp.PG15, Level::High, Speed::Low); // Read the uc_cfg switches - let uc_cfg0 = Input::new(dp.PB2, Pull::None); - let uc_cfg1 = Input::new(dp.PF11, Pull::None); + let mut uc_cfg0 = Input::new(dp.PB2, Pull::None); + let mut uc_cfg1 = Input::new(dp.PF11, Pull::None); let _uc_cfg2 = Input::new(dp.PG6, Pull::None); let _uc_cfg3 = Input::new(dp.PG11, Pull::None); @@ -133,8 +133,8 @@ async fn main(spawner: Spawner) { // Setup IO and SPI for the SPE chip let spe_reset_n = Output::new(dp.PC7, Level::Low, Speed::Low); - let spe_cfg0 = Input::new(dp.PC8, Pull::None); - let spe_cfg1 = Input::new(dp.PC9, Pull::None); + let mut spe_cfg0 = Input::new(dp.PC8, Pull::None); + let mut spe_cfg1 = Input::new(dp.PC9, Pull::None); let _spe_ts_capt = Output::new(dp.PC6, Level::Low, Speed::Low); let spe_int = Input::new(dp.PB11, Pull::None); diff --git a/examples/stm32l4/src/bin/spi_blocking_async.rs b/examples/stm32l4/src/bin/spi_blocking_async.rs index f1b80087..903ca58d 100644 --- a/examples/stm32l4/src/bin/spi_blocking_async.rs +++ b/examples/stm32l4/src/bin/spi_blocking_async.rs @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); - let ready = Input::new(p.PE1, Pull::Up); + let mut ready = Input::new(p.PE1, Pull::Up); cortex_m::asm::delay(100_000); reset.set_high(); diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs index ff9b5b43..58cf2e51 100644 --- a/examples/stm32l4/src/bin/spi_dma.rs +++ b/examples/stm32l4/src/bin/spi_dma.rs @@ -25,7 +25,7 @@ async fn main(_spawner: Spawner) { let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); - let ready = Input::new(p.PE1, Pull::Up); + let mut ready = Input::new(p.PE1, Pull::Up); cortex_m::asm::delay(100_000); reset.set_high(); diff --git a/examples/stm32wl/src/bin/button.rs b/examples/stm32wl/src/bin/button.rs index 982a7a11..6c1f5a5e 100644 --- a/examples/stm32wl/src/bin/button.rs +++ b/examples/stm32wl/src/bin/button.rs @@ -13,7 +13,7 @@ fn main() -> ! { let p = embassy_stm32::init(Default::default()); - let button = Input::new(p.PA0, Pull::Up); + let mut button = Input::new(p.PA0, Pull::Up); let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); let mut led2 = Output::new(p.PB9, Level::High, Speed::Low); diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index 7b0d59ee..b6067abc 100644 --- a/tests/nrf/Cargo.toml +++ b/tests/nrf/Cargo.toml @@ -16,8 +16,8 @@ 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", ] } 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.2" } -embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] } +embedded-hal-async = { version = "1.0.0-rc.3" } +embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } static_cell = { version = "2", features = [ "nightly" ] } perf-client = { path = "../perf-client" } diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 44fb7bed..028ce43e 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml @@ -24,9 +24,9 @@ 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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } -embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } +embedded-hal-bus = { version = "=0.1.0-rc.3", 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.1" } diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index e0c30988..a57d5d9e 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs @@ -16,10 +16,10 @@ async fn main(_spawner: Spawner) { // Test initial output { - let b = Input::new(&mut b, Pull::None); + let mut b = Input::new(&mut b, Pull::None); { - let a = Output::new(&mut a, Level::Low); + let mut a = Output::new(&mut a, Level::Low); delay(); assert!(b.is_low()); assert!(!b.is_high()); @@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) { // Test input no pull { - let b = Input::new(&mut b, Pull::None); + let mut b = Input::new(&mut b, Pull::None); // no pull, the status is undefined let mut a = Output::new(&mut a, Level::Low); @@ -77,7 +77,7 @@ async fn main(_spawner: Spawner) { // Test input pulldown { - let b = Input::new(&mut b, Pull::Down); + let mut b = Input::new(&mut b, Pull::Down); delay(); assert!(b.is_low()); @@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) { // Test input pullup { - let b = Input::new(&mut b, Pull::Up); + let mut b = Input::new(&mut b, Pull::Up); delay(); assert!(b.is_high()); diff --git a/tests/rp/src/bin/pwm.rs b/tests/rp/src/bin/pwm.rs index e71d9e61..3fc0bb2a 100644 --- a/tests/rp/src/bin/pwm.rs +++ b/tests/rp/src/bin/pwm.rs @@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) { // Test output from A { - let pin1 = Input::new(&mut p9, Pull::None); + let mut pin1 = Input::new(&mut p9, Pull::None); let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone()); Timer::after_millis(1).await; assert_eq!(pin1.is_low(), invert_a); @@ -59,7 +59,7 @@ async fn main(_spawner: Spawner) { // Test output from B { - let pin2 = Input::new(&mut p11, Pull::None); + let mut pin2 = Input::new(&mut p11, Pull::None); let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone()); Timer::after_millis(1).await; assert_ne!(pin2.is_low(), invert_a); @@ -73,8 +73,8 @@ async fn main(_spawner: Spawner) { // Test output from A+B { - let pin1 = Input::new(&mut p9, Pull::None); - let pin2 = Input::new(&mut p11, Pull::None); + let mut pin1 = Input::new(&mut p9, Pull::None); + let mut pin2 = Input::new(&mut p11, Pull::None); let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone()); Timer::after_millis(1).await; assert_eq!(pin1.is_low(), invert_a); diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 4f53e84f..bdec4157 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -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.2" } -embedded-hal-async = { version = "=1.0.0-rc.2" } +embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } +embedded-hal-async = { version = "=1.0.0-rc.3" } micromath = "2.0.0" panic-probe = { version = "0.3.0", features = ["print-defmt"] } rand_core = { version = "0.6", default-features = false } diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index c4e2fe16..9f199302 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs @@ -20,10 +20,10 @@ async fn main(_spawner: Spawner) { // Test initial output { - let b = Input::new(&mut b, Pull::None); + let mut b = Input::new(&mut b, Pull::None); { - let a = Output::new(&mut a, Level::Low, Speed::Low); + let mut a = Output::new(&mut a, Level::Low, Speed::Low); delay(); assert!(b.is_low()); assert!(!b.is_high()); @@ -68,7 +68,7 @@ async fn main(_spawner: Spawner) { // Test input no pull { - let b = Input::new(&mut b, Pull::None); + let mut b = Input::new(&mut b, Pull::None); // no pull, the status is undefined let mut a = Output::new(&mut a, Level::Low, Speed::Low); @@ -81,7 +81,7 @@ async fn main(_spawner: Spawner) { // Test input pulldown { - let b = Input::new(&mut b, Pull::Down); + let mut b = Input::new(&mut b, Pull::Down); delay(); assert!(b.is_low()); @@ -95,7 +95,7 @@ async fn main(_spawner: Spawner) { // Test input pullup { - let b = Input::new(&mut b, Pull::Up); + let mut b = Input::new(&mut b, Pull::Up); delay(); assert!(b.is_high()); @@ -109,7 +109,7 @@ async fn main(_spawner: Spawner) { // Test output open drain { - let b = Input::new(&mut b, Pull::Down); + let mut b = Input::new(&mut b, Pull::Down); // no pull, the status is undefined let mut a = OutputOpenDrain::new(&mut a, Level::Low, Speed::Low, Pull::None);