diff options
41 files changed, 238 insertions, 203 deletions
diff --git a/cyw43/Cargo.toml b/cyw43/Cargo.toml index 293c00982..72faad805 100644 --- a/cyw43/Cargo.toml +++ b/cyw43/Cargo.toml | |||
| @@ -23,7 +23,7 @@ cortex-m = "0.7.6" | |||
| 23 | cortex-m-rt = "0.7.0" | 23 | cortex-m-rt = "0.7.0" |
| 24 | futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] } | 24 | futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] } |
| 25 | 25 | ||
| 26 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.2" } | 26 | embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.3" } |
| 27 | num_enum = { version = "0.5.7", default-features = false } | 27 | num_enum = { version = "0.5.7", default-features = false } |
| 28 | 28 | ||
| 29 | [package.metadata.embassy_docs] | 29 | [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 d0c9f4907..54b87662e 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 _}; | |||
| 9 | fn main() -> ! { | 9 | fn main() -> ! { |
| 10 | let p = embassy_stm32::init(Default::default()); | 10 | let p = embassy_stm32::init(Default::default()); |
| 11 | let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh); | 11 | let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh); |
| 12 | let button = Input::new(p.PC13, Pull::Up); | 12 | let mut button = Input::new(p.PC13, Pull::Up); |
| 13 | 13 | ||
| 14 | loop { | 14 | loop { |
| 15 | if button.is_low() { | 15 | if button.is_low() { |
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml index 2a0b25479..f292f952d 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 } | |||
| 23 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ | 23 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ |
| 24 | "unproven", | 24 | "unproven", |
| 25 | ] } | 25 | ] } |
| 26 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 26 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 27 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 27 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 28 | embedded-storage = "0.3.1" | 28 | embedded-storage = "0.3.1" |
| 29 | embedded-storage-async = { version = "0.4.1" } | 29 | embedded-storage-async = { version = "0.4.1" } |
| 30 | nb = "1.0.0" | 30 | nb = "1.0.0" |
diff --git a/embassy-net-adin1110/Cargo.toml b/embassy-net-adin1110/Cargo.toml index d95b2628c..adcdfe80f 100644 --- a/embassy-net-adin1110/Cargo.toml +++ b/embassy-net-adin1110/Cargo.toml | |||
| @@ -13,16 +13,16 @@ edition = "2021" | |||
| 13 | heapless = "0.8" | 13 | heapless = "0.8" |
| 14 | defmt = { version = "0.3", optional = true } | 14 | defmt = { version = "0.3", optional = true } |
| 15 | log = { version = "0.4", default-features = false, optional = true } | 15 | log = { version = "0.4", default-features = false, optional = true } |
| 16 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 16 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 17 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 17 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 18 | embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } | 18 | embedded-hal-bus = { version = "=0.1.0-rc.3", features = ["async"] } |
| 19 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } | 19 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } |
| 20 | embassy-time = { version = "0.2", path = "../embassy-time" } | 20 | embassy-time = { version = "0.2", path = "../embassy-time" } |
| 21 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } | 21 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } |
| 22 | bitfield = "0.14.0" | 22 | bitfield = "0.14.0" |
| 23 | 23 | ||
| 24 | [dev-dependencies] | 24 | [dev-dependencies] |
| 25 | embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "c5c4dca18e043e6386aee02173f61a65fea3981e", features = ["embedded-hal-async", "eh1"] } | 25 | embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "b5a2274759a8c484f4fae71a22f8a083fdd9d5da", features = ["embedded-hal-async", "eh1"] } |
| 26 | crc = "3.0.1" | 26 | crc = "3.0.1" |
| 27 | env_logger = "0.10" | 27 | env_logger = "0.10" |
| 28 | critical-section = { version = "1.1.2", features = ["std"] } | 28 | critical-section = { version = "1.1.2", features = ["std"] } |
diff --git a/embassy-net-enc28j60/Cargo.toml b/embassy-net-enc28j60/Cargo.toml index 72e1d4e5c..8cd723c4c 100644 --- a/embassy-net-enc28j60/Cargo.toml +++ b/embassy-net-enc28j60/Cargo.toml | |||
| @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0" | |||
| 8 | edition = "2021" | 8 | edition = "2021" |
| 9 | 9 | ||
| 10 | [dependencies] | 10 | [dependencies] |
| 11 | embedded-hal = { version = "1.0.0-rc.2" } | 11 | embedded-hal = { version = "1.0.0-rc.3" } |
| 12 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 12 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 13 | embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } | 13 | embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } |
| 14 | embassy-time = { version = "0.2", path = "../embassy-time" } | 14 | embassy-time = { version = "0.2", path = "../embassy-time" } |
| 15 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } | 15 | 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 eb44a6544..70b1bbe2a 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"} | |||
| 12 | embassy-futures = { version = "0.1.0", path = "../embassy-futures"} | 12 | embassy-futures = { version = "0.1.0", path = "../embassy-futures"} |
| 13 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"} | 13 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"} |
| 14 | 14 | ||
| 15 | embedded-hal = { version = "1.0.0-rc.2" } | 15 | embedded-hal = { version = "1.0.0-rc.3" } |
| 16 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 16 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 17 | 17 | ||
| 18 | noproto = { git="https://github.com/embassy-rs/noproto", rev = "f5e6d1f325b6ad4e344f60452b09576e24671f62", default-features = false, features = ["derive"] } | 18 | noproto = { git="https://github.com/embassy-rs/noproto", rev = "f5e6d1f325b6ad4e344f60452b09576e24671f62", default-features = false, features = ["derive"] } |
| 19 | #noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] } | 19 | #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 9c103ebb1..a1f0b0c51 100644 --- a/embassy-net-wiznet/Cargo.toml +++ b/embassy-net-wiznet/Cargo.toml | |||
| @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0" | |||
| 8 | edition = "2021" | 8 | edition = "2021" |
| 9 | 9 | ||
| 10 | [dependencies] | 10 | [dependencies] |
| 11 | embedded-hal = { version = "1.0.0-rc.2" } | 11 | embedded-hal = { version = "1.0.0-rc.3" } |
| 12 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 12 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 13 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } | 13 | embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" } |
| 14 | embassy-time = { version = "0.2", path = "../embassy-time" } | 14 | embassy-time = { version = "0.2", path = "../embassy-time" } |
| 15 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } | 15 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } |
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index a7f3cb35d..6d7440519 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" } | |||
| 94 | embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } | 94 | embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" } |
| 95 | 95 | ||
| 96 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } | 96 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } |
| 97 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 97 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 98 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 98 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 99 | embedded-io = { version = "0.6.0" } | 99 | embedded-io = { version = "0.6.0" } |
| 100 | embedded-io-async = { version = "0.6.1" } | 100 | embedded-io-async = { version = "0.6.1" } |
| 101 | 101 | ||
| @@ -120,4 +120,3 @@ nrf52840-pac = { version = "0.12.0", optional = true } | |||
| 120 | nrf5340-app-pac = { version = "0.12.0", optional = true } | 120 | nrf5340-app-pac = { version = "0.12.0", optional = true } |
| 121 | nrf5340-net-pac = { version = "0.12.0", optional = true } | 121 | nrf5340-net-pac = { version = "0.12.0", optional = true } |
| 122 | nrf9160-pac = { version = "0.12.0", optional = true } | 122 | nrf9160-pac = { version = "0.12.0", optional = true } |
| 123 | |||
diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index cf6225282..85977a804 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs | |||
| @@ -52,19 +52,19 @@ impl<'d, T: Pin> Input<'d, T> { | |||
| 52 | 52 | ||
| 53 | /// Test if current pin level is high. | 53 | /// Test if current pin level is high. |
| 54 | #[inline] | 54 | #[inline] |
| 55 | pub fn is_high(&self) -> bool { | 55 | pub fn is_high(&mut self) -> bool { |
| 56 | self.pin.is_high() | 56 | self.pin.is_high() |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | /// Test if current pin level is low. | 59 | /// Test if current pin level is low. |
| 60 | #[inline] | 60 | #[inline] |
| 61 | pub fn is_low(&self) -> bool { | 61 | pub fn is_low(&mut self) -> bool { |
| 62 | self.pin.is_low() | 62 | self.pin.is_low() |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /// Returns current pin level | 65 | /// Returns current pin level |
| 66 | #[inline] | 66 | #[inline] |
| 67 | pub fn get_level(&self) -> Level { | 67 | pub fn get_level(&mut self) -> Level { |
| 68 | self.pin.get_level() | 68 | self.pin.get_level() |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| @@ -160,19 +160,19 @@ impl<'d, T: Pin> Output<'d, T> { | |||
| 160 | 160 | ||
| 161 | /// Is the output pin set as high? | 161 | /// Is the output pin set as high? |
| 162 | #[inline] | 162 | #[inline] |
| 163 | pub fn is_set_high(&self) -> bool { | 163 | pub fn is_set_high(&mut self) -> bool { |
| 164 | self.pin.is_set_high() | 164 | self.pin.is_set_high() |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | /// Is the output pin set as low? | 167 | /// Is the output pin set as low? |
| 168 | #[inline] | 168 | #[inline] |
| 169 | pub fn is_set_low(&self) -> bool { | 169 | pub fn is_set_low(&mut self) -> bool { |
| 170 | self.pin.is_set_low() | 170 | self.pin.is_set_low() |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /// What level output is set to | 173 | /// What level output is set to |
| 174 | #[inline] | 174 | #[inline] |
| 175 | pub fn get_output_level(&self) -> Level { | 175 | pub fn get_output_level(&mut self) -> Level { |
| 176 | self.pin.get_output_level() | 176 | self.pin.get_output_level() |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| @@ -277,19 +277,24 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 277 | 277 | ||
| 278 | /// Test if current pin level is high. | 278 | /// Test if current pin level is high. |
| 279 | #[inline] | 279 | #[inline] |
| 280 | pub fn is_high(&self) -> bool { | 280 | pub fn is_high(&mut self) -> bool { |
| 281 | !self.is_low() | 281 | !self.is_low() |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | /// Test if current pin level is low. | 284 | /// Test if current pin level is low. |
| 285 | #[inline] | 285 | #[inline] |
| 286 | pub fn is_low(&self) -> bool { | 286 | pub fn is_low(&mut self) -> bool { |
| 287 | self.ref_is_low() | ||
| 288 | } | ||
| 289 | |||
| 290 | #[inline] | ||
| 291 | pub(crate) fn ref_is_low(&self) -> bool { | ||
| 287 | self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0 | 292 | self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0 |
| 288 | } | 293 | } |
| 289 | 294 | ||
| 290 | /// Returns current pin level | 295 | /// Returns current pin level |
| 291 | #[inline] | 296 | #[inline] |
| 292 | pub fn get_level(&self) -> Level { | 297 | pub fn get_level(&mut self) -> Level { |
| 293 | self.is_high().into() | 298 | self.is_high().into() |
| 294 | } | 299 | } |
| 295 | 300 | ||
| @@ -316,19 +321,25 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 316 | 321 | ||
| 317 | /// Is the output pin set as high? | 322 | /// Is the output pin set as high? |
| 318 | #[inline] | 323 | #[inline] |
| 319 | pub fn is_set_high(&self) -> bool { | 324 | pub fn is_set_high(&mut self) -> bool { |
| 320 | !self.is_set_low() | 325 | !self.is_set_low() |
| 321 | } | 326 | } |
| 322 | 327 | ||
| 323 | /// Is the output pin set as low? | 328 | /// Is the output pin set as low? |
| 324 | #[inline] | 329 | #[inline] |
| 325 | pub fn is_set_low(&self) -> bool { | 330 | pub fn is_set_low(&mut self) -> bool { |
| 331 | self.ref_is_set_low() | ||
| 332 | } | ||
| 333 | |||
| 334 | /// Is the output pin set as low? | ||
| 335 | #[inline] | ||
| 336 | pub(crate) fn ref_is_set_low(&self) -> bool { | ||
| 326 | self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0 | 337 | self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0 |
| 327 | } | 338 | } |
| 328 | 339 | ||
| 329 | /// What level output is set to | 340 | /// What level output is set to |
| 330 | #[inline] | 341 | #[inline] |
| 331 | pub fn get_output_level(&self) -> Level { | 342 | pub fn get_output_level(&mut self) -> Level { |
| 332 | self.is_set_high().into() | 343 | self.is_set_high().into() |
| 333 | } | 344 | } |
| 334 | } | 345 | } |
| @@ -498,11 +509,11 @@ mod eh02 { | |||
| 498 | type Error = Infallible; | 509 | type Error = Infallible; |
| 499 | 510 | ||
| 500 | fn is_high(&self) -> Result<bool, Self::Error> { | 511 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 501 | Ok(self.is_high()) | 512 | Ok(!self.pin.ref_is_low()) |
| 502 | } | 513 | } |
| 503 | 514 | ||
| 504 | fn is_low(&self) -> Result<bool, Self::Error> { | 515 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 505 | Ok(self.is_low()) | 516 | Ok(self.pin.ref_is_low()) |
| 506 | } | 517 | } |
| 507 | } | 518 | } |
| 508 | 519 | ||
| @@ -520,11 +531,11 @@ mod eh02 { | |||
| 520 | 531 | ||
| 521 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { | 532 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { |
| 522 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 533 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 523 | Ok(self.is_set_high()) | 534 | Ok(!self.pin.ref_is_set_low()) |
| 524 | } | 535 | } |
| 525 | 536 | ||
| 526 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 537 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 527 | Ok(self.is_set_low()) | 538 | Ok(self.pin.ref_is_set_low()) |
| 528 | } | 539 | } |
| 529 | } | 540 | } |
| 530 | 541 | ||
| @@ -535,11 +546,11 @@ mod eh02 { | |||
| 535 | type Error = Infallible; | 546 | type Error = Infallible; |
| 536 | 547 | ||
| 537 | fn is_high(&self) -> Result<bool, Self::Error> { | 548 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 538 | Ok(self.is_high()) | 549 | Ok(!self.ref_is_low()) |
| 539 | } | 550 | } |
| 540 | 551 | ||
| 541 | fn is_low(&self) -> Result<bool, Self::Error> { | 552 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 542 | Ok(self.is_low()) | 553 | Ok(self.ref_is_low()) |
| 543 | } | 554 | } |
| 544 | } | 555 | } |
| 545 | 556 | ||
| @@ -557,11 +568,11 @@ mod eh02 { | |||
| 557 | 568 | ||
| 558 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { | 569 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { |
| 559 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 570 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 560 | Ok(self.is_set_high()) | 571 | Ok(!self.ref_is_set_low()) |
| 561 | } | 572 | } |
| 562 | 573 | ||
| 563 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 574 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 564 | Ok(self.is_set_low()) | 575 | Ok(self.ref_is_set_low()) |
| 565 | } | 576 | } |
| 566 | } | 577 | } |
| 567 | } | 578 | } |
| @@ -571,11 +582,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { | |||
| 571 | } | 582 | } |
| 572 | 583 | ||
| 573 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | 584 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { |
| 574 | fn is_high(&self) -> Result<bool, Self::Error> { | 585 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 575 | Ok(self.is_high()) | 586 | Ok(self.is_high()) |
| 576 | } | 587 | } |
| 577 | 588 | ||
| 578 | fn is_low(&self) -> Result<bool, Self::Error> { | 589 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 579 | Ok(self.is_low()) | 590 | Ok(self.is_low()) |
| 580 | } | 591 | } |
| 581 | } | 592 | } |
| @@ -595,11 +606,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | |||
| 595 | } | 606 | } |
| 596 | 607 | ||
| 597 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | 608 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { |
| 598 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 609 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 599 | Ok(self.is_set_high()) | 610 | Ok(self.is_set_high()) |
| 600 | } | 611 | } |
| 601 | 612 | ||
| 602 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 613 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 603 | Ok(self.is_set_low()) | 614 | Ok(self.is_set_low()) |
| 604 | } | 615 | } |
| 605 | } | 616 | } |
| @@ -612,11 +623,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { | |||
| 612 | /// | 623 | /// |
| 613 | /// If the pin is not in input mode the result is unspecified. | 624 | /// If the pin is not in input mode the result is unspecified. |
| 614 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | 625 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { |
| 615 | fn is_high(&self) -> Result<bool, Self::Error> { | 626 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 616 | Ok(self.is_high()) | 627 | Ok(self.is_high()) |
| 617 | } | 628 | } |
| 618 | 629 | ||
| 619 | fn is_low(&self) -> Result<bool, Self::Error> { | 630 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 620 | Ok(self.is_low()) | 631 | Ok(self.is_low()) |
| 621 | } | 632 | } |
| 622 | } | 633 | } |
| @@ -632,11 +643,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | |||
| 632 | } | 643 | } |
| 633 | 644 | ||
| 634 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | 645 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { |
| 635 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 646 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 636 | Ok(self.is_set_high()) | 647 | Ok(self.is_set_high()) |
| 637 | } | 648 | } |
| 638 | 649 | ||
| 639 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 650 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 640 | Ok(self.is_set_low()) | 651 | Ok(self.is_set_low()) |
| 641 | } | 652 | } |
| 642 | } | 653 | } |
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index fd629ea76..07196abf7 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> { | |||
| 243 | 243 | ||
| 244 | impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> { | 244 | impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> { |
| 245 | /// Create a new GPIOTE output channel driver. | 245 | /// Create a new GPIOTE output channel driver. |
| 246 | pub fn new(ch: impl Peripheral<P = C> + 'd, pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self { | 246 | pub fn new(ch: impl Peripheral<P = C> + 'd, mut pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self { |
| 247 | into_ref!(ch); | 247 | into_ref!(ch); |
| 248 | let g = regs(); | 248 | let g = regs(); |
| 249 | let num = ch.number(); | 249 | let num = ch.number(); |
| @@ -481,11 +481,11 @@ mod eh02 { | |||
| 481 | type Error = Infallible; | 481 | type Error = Infallible; |
| 482 | 482 | ||
| 483 | fn is_high(&self) -> Result<bool, Self::Error> { | 483 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 484 | Ok(self.pin.is_high()) | 484 | Ok(!self.pin.pin.ref_is_low()) |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | fn is_low(&self) -> Result<bool, Self::Error> { | 487 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 488 | Ok(self.pin.is_low()) | 488 | Ok(self.pin.pin.ref_is_low()) |
| 489 | } | 489 | } |
| 490 | } | 490 | } |
| 491 | } | 491 | } |
| @@ -495,11 +495,11 @@ impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::ErrorType for InputCha | |||
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> { | 497 | impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> { |
| 498 | fn is_high(&self) -> Result<bool, Self::Error> { | 498 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 499 | Ok(self.pin.is_high()) | 499 | Ok(self.pin.is_high()) |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | fn is_low(&self) -> Result<bool, Self::Error> { | 502 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 503 | Ok(self.pin.is_low()) | 503 | Ok(self.pin.is_low()) |
| 504 | } | 504 | } |
| 505 | } | 505 | } |
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index dfdd1fee9..c557940b1 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -78,9 +78,9 @@ fixed = "1.23.1" | |||
| 78 | rp-pac = { version = "6" } | 78 | rp-pac = { version = "6" } |
| 79 | 79 | ||
| 80 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } | 80 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } |
| 81 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 81 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 82 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 82 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 83 | embedded-hal-nb = { version = "=1.0.0-rc.2" } | 83 | embedded-hal-nb = { version = "=1.0.0-rc.3" } |
| 84 | 84 | ||
| 85 | pio-proc = {version= "0.2" } | 85 | pio-proc = {version= "0.2" } |
| 86 | pio = {version= "0.2.1" } | 86 | pio = {version= "0.2.1" } |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 9034f3f36..23273e627 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -105,18 +105,18 @@ impl<'d, T: Pin> Input<'d, T> { | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | #[inline] | 107 | #[inline] |
| 108 | pub fn is_high(&self) -> bool { | 108 | pub fn is_high(&mut self) -> bool { |
| 109 | self.pin.is_high() | 109 | self.pin.is_high() |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | #[inline] | 112 | #[inline] |
| 113 | pub fn is_low(&self) -> bool { | 113 | pub fn is_low(&mut self) -> bool { |
| 114 | self.pin.is_low() | 114 | self.pin.is_low() |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /// Returns current pin level | 117 | /// Returns current pin level |
| 118 | #[inline] | 118 | #[inline] |
| 119 | pub fn get_level(&self) -> Level { | 119 | pub fn get_level(&mut self) -> Level { |
| 120 | self.pin.get_level() | 120 | self.pin.get_level() |
| 121 | } | 121 | } |
| 122 | 122 | ||
| @@ -357,19 +357,19 @@ impl<'d, T: Pin> Output<'d, T> { | |||
| 357 | 357 | ||
| 358 | /// Is the output pin set as high? | 358 | /// Is the output pin set as high? |
| 359 | #[inline] | 359 | #[inline] |
| 360 | pub fn is_set_high(&self) -> bool { | 360 | pub fn is_set_high(&mut self) -> bool { |
| 361 | self.pin.is_set_high() | 361 | self.pin.is_set_high() |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | /// Is the output pin set as low? | 364 | /// Is the output pin set as low? |
| 365 | #[inline] | 365 | #[inline] |
| 366 | pub fn is_set_low(&self) -> bool { | 366 | pub fn is_set_low(&mut self) -> bool { |
| 367 | self.pin.is_set_low() | 367 | self.pin.is_set_low() |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | /// What level output is set to | 370 | /// What level output is set to |
| 371 | #[inline] | 371 | #[inline] |
| 372 | pub fn get_output_level(&self) -> Level { | 372 | pub fn get_output_level(&mut self) -> Level { |
| 373 | self.pin.get_output_level() | 373 | self.pin.get_output_level() |
| 374 | } | 374 | } |
| 375 | 375 | ||
| @@ -434,19 +434,19 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 434 | 434 | ||
| 435 | /// Is the output level high? | 435 | /// Is the output level high? |
| 436 | #[inline] | 436 | #[inline] |
| 437 | pub fn is_set_high(&self) -> bool { | 437 | pub fn is_set_high(&mut self) -> bool { |
| 438 | !self.is_set_low() | 438 | !self.is_set_low() |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | /// Is the output level low? | 441 | /// Is the output level low? |
| 442 | #[inline] | 442 | #[inline] |
| 443 | pub fn is_set_low(&self) -> bool { | 443 | pub fn is_set_low(&mut self) -> bool { |
| 444 | self.pin.is_set_as_output() | 444 | self.pin.is_set_as_output() |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | /// What level output is set to | 447 | /// What level output is set to |
| 448 | #[inline] | 448 | #[inline] |
| 449 | pub fn get_output_level(&self) -> Level { | 449 | pub fn get_output_level(&mut self) -> Level { |
| 450 | self.is_set_high().into() | 450 | self.is_set_high().into() |
| 451 | } | 451 | } |
| 452 | 452 | ||
| @@ -457,18 +457,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | #[inline] | 459 | #[inline] |
| 460 | pub fn is_high(&self) -> bool { | 460 | pub fn is_high(&mut self) -> bool { |
| 461 | self.pin.is_high() | 461 | self.pin.is_high() |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | #[inline] | 464 | #[inline] |
| 465 | pub fn is_low(&self) -> bool { | 465 | pub fn is_low(&mut self) -> bool { |
| 466 | self.pin.is_low() | 466 | self.pin.is_low() |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | /// Returns current pin level | 469 | /// Returns current pin level |
| 470 | #[inline] | 470 | #[inline] |
| 471 | pub fn get_level(&self) -> Level { | 471 | pub fn get_level(&mut self) -> Level { |
| 472 | self.is_high().into() | 472 | self.is_high().into() |
| 473 | } | 473 | } |
| 474 | 474 | ||
| @@ -590,7 +590,12 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 590 | } | 590 | } |
| 591 | 591 | ||
| 592 | #[inline] | 592 | #[inline] |
| 593 | fn is_set_as_output(&self) -> bool { | 593 | pub fn is_set_as_output(&mut self) -> bool { |
| 594 | self.ref_is_set_as_output() | ||
| 595 | } | ||
| 596 | |||
| 597 | #[inline] | ||
| 598 | pub(crate) fn ref_is_set_as_output(&self) -> bool { | ||
| 594 | (self.pin.sio_oe().value().read() & self.bit()) != 0 | 599 | (self.pin.sio_oe().value().read() & self.bit()) != 0 |
| 595 | } | 600 | } |
| 596 | 601 | ||
| @@ -600,18 +605,23 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 600 | } | 605 | } |
| 601 | 606 | ||
| 602 | #[inline] | 607 | #[inline] |
| 603 | pub fn is_high(&self) -> bool { | 608 | pub fn is_high(&mut self) -> bool { |
| 604 | !self.is_low() | 609 | !self.is_low() |
| 605 | } | 610 | } |
| 606 | 611 | ||
| 607 | #[inline] | 612 | #[inline] |
| 608 | pub fn is_low(&self) -> bool { | 613 | pub fn is_low(&mut self) -> bool { |
| 614 | self.ref_is_low() | ||
| 615 | } | ||
| 616 | |||
| 617 | #[inline] | ||
| 618 | pub(crate) fn ref_is_low(&self) -> bool { | ||
| 609 | self.pin.sio_in().read() & self.bit() == 0 | 619 | self.pin.sio_in().read() & self.bit() == 0 |
| 610 | } | 620 | } |
| 611 | 621 | ||
| 612 | /// Returns current pin level | 622 | /// Returns current pin level |
| 613 | #[inline] | 623 | #[inline] |
| 614 | pub fn get_level(&self) -> Level { | 624 | pub fn get_level(&mut self) -> Level { |
| 615 | self.is_high().into() | 625 | self.is_high().into() |
| 616 | } | 626 | } |
| 617 | 627 | ||
| @@ -638,19 +648,24 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 638 | 648 | ||
| 639 | /// Is the output level high? | 649 | /// Is the output level high? |
| 640 | #[inline] | 650 | #[inline] |
| 641 | pub fn is_set_high(&self) -> bool { | 651 | pub fn is_set_high(&mut self) -> bool { |
| 642 | !self.is_set_low() | 652 | !self.is_set_low() |
| 643 | } | 653 | } |
| 644 | 654 | ||
| 645 | /// Is the output level low? | 655 | /// Is the output level low? |
| 646 | #[inline] | 656 | #[inline] |
| 647 | pub fn is_set_low(&self) -> bool { | 657 | pub fn is_set_low(&mut self) -> bool { |
| 658 | self.ref_is_set_low() | ||
| 659 | } | ||
| 660 | |||
| 661 | #[inline] | ||
| 662 | pub(crate) fn ref_is_set_low(&self) -> bool { | ||
| 648 | (self.pin.sio_out().value().read() & self.bit()) == 0 | 663 | (self.pin.sio_out().value().read() & self.bit()) == 0 |
| 649 | } | 664 | } |
| 650 | 665 | ||
| 651 | /// What level output is set to | 666 | /// What level output is set to |
| 652 | #[inline] | 667 | #[inline] |
| 653 | pub fn get_output_level(&self) -> Level { | 668 | pub fn get_output_level(&mut self) -> Level { |
| 654 | self.is_set_high().into() | 669 | self.is_set_high().into() |
| 655 | } | 670 | } |
| 656 | 671 | ||
| @@ -912,11 +927,11 @@ mod eh02 { | |||
| 912 | type Error = Infallible; | 927 | type Error = Infallible; |
| 913 | 928 | ||
| 914 | fn is_high(&self) -> Result<bool, Self::Error> { | 929 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 915 | Ok(self.is_high()) | 930 | Ok(!self.pin.ref_is_low()) |
| 916 | } | 931 | } |
| 917 | 932 | ||
| 918 | fn is_low(&self) -> Result<bool, Self::Error> { | 933 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 919 | Ok(self.is_low()) | 934 | Ok(self.pin.ref_is_low()) |
| 920 | } | 935 | } |
| 921 | } | 936 | } |
| 922 | 937 | ||
| @@ -934,11 +949,11 @@ mod eh02 { | |||
| 934 | 949 | ||
| 935 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { | 950 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { |
| 936 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 951 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 937 | Ok(self.is_set_high()) | 952 | Ok(!self.pin.ref_is_set_low()) |
| 938 | } | 953 | } |
| 939 | 954 | ||
| 940 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 955 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 941 | Ok(self.is_set_low()) | 956 | Ok(self.pin.ref_is_set_low()) |
| 942 | } | 957 | } |
| 943 | } | 958 | } |
| 944 | 959 | ||
| @@ -954,11 +969,11 @@ mod eh02 { | |||
| 954 | type Error = Infallible; | 969 | type Error = Infallible; |
| 955 | 970 | ||
| 956 | fn is_high(&self) -> Result<bool, Self::Error> { | 971 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 957 | Ok(self.is_high()) | 972 | Ok(!self.pin.ref_is_low()) |
| 958 | } | 973 | } |
| 959 | 974 | ||
| 960 | fn is_low(&self) -> Result<bool, Self::Error> { | 975 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 961 | Ok(self.is_low()) | 976 | Ok(self.pin.ref_is_low()) |
| 962 | } | 977 | } |
| 963 | } | 978 | } |
| 964 | 979 | ||
| @@ -978,11 +993,11 @@ mod eh02 { | |||
| 978 | 993 | ||
| 979 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { | 994 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { |
| 980 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 995 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 981 | Ok(self.is_set_high()) | 996 | Ok(!self.pin.ref_is_set_as_output()) |
| 982 | } | 997 | } |
| 983 | 998 | ||
| 984 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 999 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 985 | Ok(self.is_set_low()) | 1000 | Ok(self.pin.ref_is_set_as_output()) |
| 986 | } | 1001 | } |
| 987 | } | 1002 | } |
| 988 | 1003 | ||
| @@ -998,11 +1013,11 @@ mod eh02 { | |||
| 998 | type Error = Infallible; | 1013 | type Error = Infallible; |
| 999 | 1014 | ||
| 1000 | fn is_high(&self) -> Result<bool, Self::Error> { | 1015 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 1001 | Ok(self.is_high()) | 1016 | Ok(!self.ref_is_low()) |
| 1002 | } | 1017 | } |
| 1003 | 1018 | ||
| 1004 | fn is_low(&self) -> Result<bool, Self::Error> { | 1019 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 1005 | Ok(self.is_low()) | 1020 | Ok(self.ref_is_low()) |
| 1006 | } | 1021 | } |
| 1007 | } | 1022 | } |
| 1008 | 1023 | ||
| @@ -1020,11 +1035,11 @@ mod eh02 { | |||
| 1020 | 1035 | ||
| 1021 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { | 1036 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { |
| 1022 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1037 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 1023 | Ok(self.is_set_high()) | 1038 | Ok(!self.ref_is_set_low()) |
| 1024 | } | 1039 | } |
| 1025 | 1040 | ||
| 1026 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1041 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 1027 | Ok(self.is_set_low()) | 1042 | Ok(self.ref_is_set_low()) |
| 1028 | } | 1043 | } |
| 1029 | } | 1044 | } |
| 1030 | 1045 | ||
| @@ -1042,11 +1057,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { | |||
| 1042 | } | 1057 | } |
| 1043 | 1058 | ||
| 1044 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | 1059 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { |
| 1045 | fn is_high(&self) -> Result<bool, Self::Error> { | 1060 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1046 | Ok(self.is_high()) | 1061 | Ok(self.is_high()) |
| 1047 | } | 1062 | } |
| 1048 | 1063 | ||
| 1049 | fn is_low(&self) -> Result<bool, Self::Error> { | 1064 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 1050 | Ok(self.is_low()) | 1065 | Ok(self.is_low()) |
| 1051 | } | 1066 | } |
| 1052 | } | 1067 | } |
| @@ -1066,11 +1081,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | |||
| 1066 | } | 1081 | } |
| 1067 | 1082 | ||
| 1068 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | 1083 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { |
| 1069 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1084 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1070 | Ok(self.is_set_high()) | 1085 | Ok(self.is_set_high()) |
| 1071 | } | 1086 | } |
| 1072 | 1087 | ||
| 1073 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1088 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 1074 | Ok(self.is_set_low()) | 1089 | Ok(self.is_set_low()) |
| 1075 | } | 1090 | } |
| 1076 | } | 1091 | } |
| @@ -1096,11 +1111,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | |||
| 1096 | } | 1111 | } |
| 1097 | 1112 | ||
| 1098 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1113 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { |
| 1099 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1114 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1100 | Ok(self.is_set_high()) | 1115 | Ok(self.is_set_high()) |
| 1101 | } | 1116 | } |
| 1102 | 1117 | ||
| 1103 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1118 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 1104 | Ok(self.is_set_low()) | 1119 | Ok(self.is_set_low()) |
| 1105 | } | 1120 | } |
| 1106 | } | 1121 | } |
| @@ -1112,11 +1127,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai | |||
| 1112 | } | 1127 | } |
| 1113 | 1128 | ||
| 1114 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | 1129 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { |
| 1115 | fn is_high(&self) -> Result<bool, Self::Error> { | 1130 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1116 | Ok(self.is_high()) | 1131 | Ok(self.is_high()) |
| 1117 | } | 1132 | } |
| 1118 | 1133 | ||
| 1119 | fn is_low(&self) -> Result<bool, Self::Error> { | 1134 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 1120 | Ok(self.is_low()) | 1135 | Ok(self.is_low()) |
| 1121 | } | 1136 | } |
| 1122 | } | 1137 | } |
| @@ -1126,11 +1141,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { | |||
| 1126 | } | 1141 | } |
| 1127 | 1142 | ||
| 1128 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | 1143 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { |
| 1129 | fn is_high(&self) -> Result<bool, Self::Error> { | 1144 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1130 | Ok(self.is_high()) | 1145 | Ok(self.is_high()) |
| 1131 | } | 1146 | } |
| 1132 | 1147 | ||
| 1133 | fn is_low(&self) -> Result<bool, Self::Error> { | 1148 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 1134 | Ok(self.is_low()) | 1149 | Ok(self.is_low()) |
| 1135 | } | 1150 | } |
| 1136 | } | 1151 | } |
| @@ -1146,11 +1161,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | |||
| 1146 | } | 1161 | } |
| 1147 | 1162 | ||
| 1148 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | 1163 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { |
| 1149 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1164 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1150 | Ok(self.is_set_high()) | 1165 | Ok(self.is_set_high()) |
| 1151 | } | 1166 | } |
| 1152 | 1167 | ||
| 1153 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1168 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 1154 | Ok(self.is_set_low()) | 1169 | Ok(self.is_set_low()) |
| 1155 | } | 1170 | } |
| 1156 | } | 1171 | } |
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 074538d3b..3de15debe 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" } | |||
| 42 | embassy-executor = { version = "0.4.0", path = "../embassy-executor", optional = true } | 42 | embassy-executor = { version = "0.4.0", path = "../embassy-executor", optional = true } |
| 43 | 43 | ||
| 44 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } | 44 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } |
| 45 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 45 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 46 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 46 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 47 | embedded-hal-nb = { version = "=1.0.0-rc.2" } | 47 | embedded-hal-nb = { version = "=1.0.0-rc.3" } |
| 48 | 48 | ||
| 49 | embedded-storage = "0.3.1" | 49 | embedded-storage = "0.3.1" |
| 50 | embedded-storage-async = { version = "0.4.1" } | 50 | embedded-storage-async = { version = "0.4.1" } |
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index dbd24804f..e77ac30fb 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs | |||
| @@ -97,15 +97,15 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> { | |||
| 97 | Self { pin } | 97 | Self { pin } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub fn is_high(&self) -> bool { | 100 | pub fn is_high(&mut self) -> bool { |
| 101 | self.pin.is_high() | 101 | self.pin.is_high() |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | pub fn is_low(&self) -> bool { | 104 | pub fn is_low(&mut self) -> bool { |
| 105 | self.pin.is_low() | 105 | self.pin.is_low() |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | pub fn get_level(&self) -> Level { | 108 | pub fn get_level(&mut self) -> Level { |
| 109 | self.pin.get_level() | 109 | self.pin.get_level() |
| 110 | } | 110 | } |
| 111 | 111 | ||
| @@ -142,11 +142,11 @@ impl<'d, T: GpioPin> embedded_hal_02::digital::v2::InputPin for ExtiInput<'d, T> | |||
| 142 | type Error = Infallible; | 142 | type Error = Infallible; |
| 143 | 143 | ||
| 144 | fn is_high(&self) -> Result<bool, Self::Error> { | 144 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 145 | Ok(self.is_high()) | 145 | Ok(!self.pin.pin.ref_is_low()) |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | fn is_low(&self) -> Result<bool, Self::Error> { | 148 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 149 | Ok(self.is_low()) | 149 | Ok(self.pin.pin.ref_is_low()) |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -155,11 +155,11 @@ impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> { | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> { | 157 | impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> { |
| 158 | fn is_high(&self) -> Result<bool, Self::Error> { | 158 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 159 | Ok(self.is_high()) | 159 | Ok(self.is_high()) |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | fn is_low(&self) -> Result<bool, Self::Error> { | 162 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 163 | Ok(self.is_low()) | 163 | Ok(self.is_low()) |
| 164 | } | 164 | } |
| 165 | } | 165 | } |
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index b863c4ffe..bb3cf2bc4 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs | |||
| @@ -142,36 +142,46 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | #[inline] | 144 | #[inline] |
| 145 | pub fn is_high(&self) -> bool { | 145 | pub fn is_high(&mut self) -> bool { |
| 146 | !self.is_low() | 146 | !self.ref_is_low() |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | #[inline] | 149 | #[inline] |
| 150 | pub fn is_low(&self) -> bool { | 150 | pub fn is_low(&mut self) -> bool { |
| 151 | self.ref_is_low() | ||
| 152 | } | ||
| 153 | |||
| 154 | #[inline] | ||
| 155 | pub(crate) fn ref_is_low(&self) -> bool { | ||
| 151 | let state = self.pin.block().idr().read().idr(self.pin.pin() as _); | 156 | let state = self.pin.block().idr().read().idr(self.pin.pin() as _); |
| 152 | state == vals::Idr::LOW | 157 | state == vals::Idr::LOW |
| 153 | } | 158 | } |
| 154 | 159 | ||
| 155 | #[inline] | 160 | #[inline] |
| 156 | pub fn get_level(&self) -> Level { | 161 | pub fn get_level(&mut self) -> Level { |
| 157 | self.is_high().into() | 162 | self.is_high().into() |
| 158 | } | 163 | } |
| 159 | 164 | ||
| 160 | #[inline] | 165 | #[inline] |
| 161 | pub fn is_set_high(&self) -> bool { | 166 | pub fn is_set_high(&mut self) -> bool { |
| 162 | !self.is_set_low() | 167 | !self.ref_is_set_low() |
| 163 | } | 168 | } |
| 164 | 169 | ||
| 165 | /// Is the output pin set as low? | 170 | /// Is the output pin set as low? |
| 166 | #[inline] | 171 | #[inline] |
| 167 | pub fn is_set_low(&self) -> bool { | 172 | pub fn is_set_low(&mut self) -> bool { |
| 173 | self.ref_is_set_low() | ||
| 174 | } | ||
| 175 | |||
| 176 | #[inline] | ||
| 177 | pub(crate) fn ref_is_set_low(&self) -> bool { | ||
| 168 | let state = self.pin.block().odr().read().odr(self.pin.pin() as _); | 178 | let state = self.pin.block().odr().read().odr(self.pin.pin() as _); |
| 169 | state == vals::Odr::LOW | 179 | state == vals::Odr::LOW |
| 170 | } | 180 | } |
| 171 | 181 | ||
| 172 | /// What level output is set to | 182 | /// What level output is set to |
| 173 | #[inline] | 183 | #[inline] |
| 174 | pub fn get_output_level(&self) -> Level { | 184 | pub fn get_output_level(&mut self) -> Level { |
| 175 | self.is_set_high().into() | 185 | self.is_set_high().into() |
| 176 | } | 186 | } |
| 177 | 187 | ||
| @@ -310,17 +320,17 @@ impl<'d, T: Pin> Input<'d, T> { | |||
| 310 | } | 320 | } |
| 311 | 321 | ||
| 312 | #[inline] | 322 | #[inline] |
| 313 | pub fn is_high(&self) -> bool { | 323 | pub fn is_high(&mut self) -> bool { |
| 314 | self.pin.is_high() | 324 | self.pin.is_high() |
| 315 | } | 325 | } |
| 316 | 326 | ||
| 317 | #[inline] | 327 | #[inline] |
| 318 | pub fn is_low(&self) -> bool { | 328 | pub fn is_low(&mut self) -> bool { |
| 319 | self.pin.is_low() | 329 | self.pin.is_low() |
| 320 | } | 330 | } |
| 321 | 331 | ||
| 322 | #[inline] | 332 | #[inline] |
| 323 | pub fn get_level(&self) -> Level { | 333 | pub fn get_level(&mut self) -> Level { |
| 324 | self.pin.get_level() | 334 | self.pin.get_level() |
| 325 | } | 335 | } |
| 326 | } | 336 | } |
| @@ -399,19 +409,19 @@ impl<'d, T: Pin> Output<'d, T> { | |||
| 399 | 409 | ||
| 400 | /// Is the output pin set as high? | 410 | /// Is the output pin set as high? |
| 401 | #[inline] | 411 | #[inline] |
| 402 | pub fn is_set_high(&self) -> bool { | 412 | pub fn is_set_high(&mut self) -> bool { |
| 403 | self.pin.is_set_high() | 413 | self.pin.is_set_high() |
| 404 | } | 414 | } |
| 405 | 415 | ||
| 406 | /// Is the output pin set as low? | 416 | /// Is the output pin set as low? |
| 407 | #[inline] | 417 | #[inline] |
| 408 | pub fn is_set_low(&self) -> bool { | 418 | pub fn is_set_low(&mut self) -> bool { |
| 409 | self.pin.is_set_low() | 419 | self.pin.is_set_low() |
| 410 | } | 420 | } |
| 411 | 421 | ||
| 412 | /// What level output is set to | 422 | /// What level output is set to |
| 413 | #[inline] | 423 | #[inline] |
| 414 | pub fn get_output_level(&self) -> Level { | 424 | pub fn get_output_level(&mut self) -> Level { |
| 415 | self.pin.get_output_level() | 425 | self.pin.get_output_level() |
| 416 | } | 426 | } |
| 417 | 427 | ||
| @@ -453,18 +463,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 453 | } | 463 | } |
| 454 | 464 | ||
| 455 | #[inline] | 465 | #[inline] |
| 456 | pub fn is_high(&self) -> bool { | 466 | pub fn is_high(&mut self) -> bool { |
| 457 | !self.pin.is_low() | 467 | !self.pin.is_low() |
| 458 | } | 468 | } |
| 459 | 469 | ||
| 460 | #[inline] | 470 | #[inline] |
| 461 | pub fn is_low(&self) -> bool { | 471 | pub fn is_low(&mut self) -> bool { |
| 462 | self.pin.is_low() | 472 | self.pin.is_low() |
| 463 | } | 473 | } |
| 464 | 474 | ||
| 465 | /// Returns current pin level | 475 | /// Returns current pin level |
| 466 | #[inline] | 476 | #[inline] |
| 467 | pub fn get_level(&self) -> Level { | 477 | pub fn get_level(&mut self) -> Level { |
| 468 | self.pin.get_level() | 478 | self.pin.get_level() |
| 469 | } | 479 | } |
| 470 | 480 | ||
| @@ -488,19 +498,19 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 488 | 498 | ||
| 489 | /// Is the output pin set as high? | 499 | /// Is the output pin set as high? |
| 490 | #[inline] | 500 | #[inline] |
| 491 | pub fn is_set_high(&self) -> bool { | 501 | pub fn is_set_high(&mut self) -> bool { |
| 492 | self.pin.is_set_high() | 502 | self.pin.is_set_high() |
| 493 | } | 503 | } |
| 494 | 504 | ||
| 495 | /// Is the output pin set as low? | 505 | /// Is the output pin set as low? |
| 496 | #[inline] | 506 | #[inline] |
| 497 | pub fn is_set_low(&self) -> bool { | 507 | pub fn is_set_low(&mut self) -> bool { |
| 498 | self.pin.is_set_low() | 508 | self.pin.is_set_low() |
| 499 | } | 509 | } |
| 500 | 510 | ||
| 501 | /// What level output is set to | 511 | /// What level output is set to |
| 502 | #[inline] | 512 | #[inline] |
| 503 | pub fn get_output_level(&self) -> Level { | 513 | pub fn get_output_level(&mut self) -> Level { |
| 504 | self.pin.get_output_level() | 514 | self.pin.get_output_level() |
| 505 | } | 515 | } |
| 506 | 516 | ||
| @@ -777,12 +787,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Input<'d, T> { | |||
| 777 | 787 | ||
| 778 | #[inline] | 788 | #[inline] |
| 779 | fn is_high(&self) -> Result<bool, Self::Error> { | 789 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 780 | Ok(self.is_high()) | 790 | Ok(!self.pin.ref_is_low()) |
| 781 | } | 791 | } |
| 782 | 792 | ||
| 783 | #[inline] | 793 | #[inline] |
| 784 | fn is_low(&self) -> Result<bool, Self::Error> { | 794 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 785 | Ok(self.is_low()) | 795 | Ok(self.pin.ref_is_low()) |
| 786 | } | 796 | } |
| 787 | } | 797 | } |
| 788 | 798 | ||
| @@ -805,13 +815,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Output<'d, T> { | |||
| 805 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { | 815 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { |
| 806 | #[inline] | 816 | #[inline] |
| 807 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 817 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 808 | Ok(self.is_set_high()) | 818 | Ok(!self.pin.ref_is_set_low()) |
| 809 | } | 819 | } |
| 810 | 820 | ||
| 811 | /// Is the output pin set as low? | 821 | /// Is the output pin set as low? |
| 812 | #[inline] | 822 | #[inline] |
| 813 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 823 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 814 | Ok(self.is_set_low()) | 824 | Ok(self.pin.ref_is_set_low()) |
| 815 | } | 825 | } |
| 816 | } | 826 | } |
| 817 | 827 | ||
| @@ -843,13 +853,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, | |||
| 843 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { | 853 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { |
| 844 | #[inline] | 854 | #[inline] |
| 845 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 855 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 846 | Ok(self.is_set_high()) | 856 | Ok(!self.pin.ref_is_set_low()) |
| 847 | } | 857 | } |
| 848 | 858 | ||
| 849 | /// Is the output pin set as low? | 859 | /// Is the output pin set as low? |
| 850 | #[inline] | 860 | #[inline] |
| 851 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 861 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 852 | Ok(self.is_set_low()) | 862 | Ok(self.pin.ref_is_set_low()) |
| 853 | } | 863 | } |
| 854 | } | 864 | } |
| 855 | 865 | ||
| @@ -867,12 +877,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Flex<'d, T> { | |||
| 867 | 877 | ||
| 868 | #[inline] | 878 | #[inline] |
| 869 | fn is_high(&self) -> Result<bool, Self::Error> { | 879 | fn is_high(&self) -> Result<bool, Self::Error> { |
| 870 | Ok(self.is_high()) | 880 | Ok(!self.ref_is_low()) |
| 871 | } | 881 | } |
| 872 | 882 | ||
| 873 | #[inline] | 883 | #[inline] |
| 874 | fn is_low(&self) -> Result<bool, Self::Error> { | 884 | fn is_low(&self) -> Result<bool, Self::Error> { |
| 875 | Ok(self.is_low()) | 885 | Ok(self.ref_is_low()) |
| 876 | } | 886 | } |
| 877 | } | 887 | } |
| 878 | 888 | ||
| @@ -895,13 +905,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Flex<'d, T> { | |||
| 895 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { | 905 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { |
| 896 | #[inline] | 906 | #[inline] |
| 897 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 907 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 898 | Ok(self.is_set_high()) | 908 | Ok(!self.ref_is_set_low()) |
| 899 | } | 909 | } |
| 900 | 910 | ||
| 901 | /// Is the output pin set as low? | 911 | /// Is the output pin set as low? |
| 902 | #[inline] | 912 | #[inline] |
| 903 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 913 | fn is_set_low(&self) -> Result<bool, Self::Error> { |
| 904 | Ok(self.is_set_low()) | 914 | Ok(self.ref_is_set_low()) |
| 905 | } | 915 | } |
| 906 | } | 916 | } |
| 907 | 917 | ||
| @@ -920,12 +930,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { | |||
| 920 | 930 | ||
| 921 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | 931 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { |
| 922 | #[inline] | 932 | #[inline] |
| 923 | fn is_high(&self) -> Result<bool, Self::Error> { | 933 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 924 | Ok(self.is_high()) | 934 | Ok(self.is_high()) |
| 925 | } | 935 | } |
| 926 | 936 | ||
| 927 | #[inline] | 937 | #[inline] |
| 928 | fn is_low(&self) -> Result<bool, Self::Error> { | 938 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 929 | Ok(self.is_low()) | 939 | Ok(self.is_low()) |
| 930 | } | 940 | } |
| 931 | } | 941 | } |
| @@ -948,13 +958,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | |||
| 948 | 958 | ||
| 949 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | 959 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { |
| 950 | #[inline] | 960 | #[inline] |
| 951 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 961 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 952 | Ok(self.is_set_high()) | 962 | Ok(self.is_set_high()) |
| 953 | } | 963 | } |
| 954 | 964 | ||
| 955 | /// Is the output pin set as low? | 965 | /// Is the output pin set as low? |
| 956 | #[inline] | 966 | #[inline] |
| 957 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 967 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 958 | Ok(self.is_set_low()) | 968 | Ok(self.is_set_low()) |
| 959 | } | 969 | } |
| 960 | } | 970 | } |
| @@ -972,12 +982,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d, T> { | |||
| 972 | 982 | ||
| 973 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | 983 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { |
| 974 | #[inline] | 984 | #[inline] |
| 975 | fn is_high(&self) -> Result<bool, Self::Error> { | 985 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 976 | Ok(self.is_high()) | 986 | Ok(self.is_high()) |
| 977 | } | 987 | } |
| 978 | 988 | ||
| 979 | #[inline] | 989 | #[inline] |
| 980 | fn is_low(&self) -> Result<bool, Self::Error> { | 990 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 981 | Ok(self.is_low()) | 991 | Ok(self.is_low()) |
| 982 | } | 992 | } |
| 983 | } | 993 | } |
| @@ -996,13 +1006,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | |||
| 996 | 1006 | ||
| 997 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1007 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { |
| 998 | #[inline] | 1008 | #[inline] |
| 999 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1009 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1000 | Ok(self.is_set_high()) | 1010 | Ok(self.is_set_high()) |
| 1001 | } | 1011 | } |
| 1002 | 1012 | ||
| 1003 | /// Is the output pin set as low? | 1013 | /// Is the output pin set as low? |
| 1004 | #[inline] | 1014 | #[inline] |
| 1005 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1015 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 1006 | Ok(self.is_set_low()) | 1016 | Ok(self.is_set_low()) |
| 1007 | } | 1017 | } |
| 1008 | } | 1018 | } |
| @@ -1016,12 +1026,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai | |||
| 1016 | 1026 | ||
| 1017 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | 1027 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { |
| 1018 | #[inline] | 1028 | #[inline] |
| 1019 | fn is_high(&self) -> Result<bool, Self::Error> { | 1029 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1020 | Ok(self.is_high()) | 1030 | Ok(self.is_high()) |
| 1021 | } | 1031 | } |
| 1022 | 1032 | ||
| 1023 | #[inline] | 1033 | #[inline] |
| 1024 | fn is_low(&self) -> Result<bool, Self::Error> { | 1034 | fn is_low(&mut self) -> Result<bool, Self::Error> { |
| 1025 | Ok(self.is_low()) | 1035 | Ok(self.is_low()) |
| 1026 | } | 1036 | } |
| 1027 | } | 1037 | } |
| @@ -1051,13 +1061,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { | |||
| 1051 | 1061 | ||
| 1052 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | 1062 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { |
| 1053 | #[inline] | 1063 | #[inline] |
| 1054 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1064 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1055 | Ok(self.is_set_high()) | 1065 | Ok(self.is_set_high()) |
| 1056 | } | 1066 | } |
| 1057 | 1067 | ||
| 1058 | /// Is the output pin set as low? | 1068 | /// Is the output pin set as low? |
| 1059 | #[inline] | 1069 | #[inline] |
| 1060 | fn is_set_low(&self) -> Result<bool, Self::Error> { | 1070 | fn is_set_low(&mut self) -> Result<bool, Self::Error> { |
| 1061 | Ok(self.is_set_low()) | 1071 | Ok(self.is_set_low()) |
| 1062 | } | 1072 | } |
| 1063 | } | 1073 | } |
diff --git a/embassy-time/CHANGELOG.md b/embassy-time/CHANGELOG.md index d8c0c7d08..99f6ef7ac 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 | |||
| 24 | 24 | ||
| 25 | ## 0.1.3 - 2023-08-28 | 25 | ## 0.1.3 - 2023-08-28 |
| 26 | 26 | ||
| 27 | - Update `embedded-hal-async` to `1.0.0-rc.2` | 27 | - Update `embedded-hal-async` to `1.0.0-rc.3` |
| 28 | - Update `embedded-hal v1` to `1.0.0-rc.2` | 28 | - Update `embedded-hal v1` to `1.0.0-rc.3` |
| 29 | 29 | ||
| 30 | ## 0.1.2 - 2023-07-05 | 30 | ## 0.1.2 - 2023-07-05 |
| 31 | 31 | ||
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml index 94e79382f..6d9b7aa69 100644 --- a/embassy-time/Cargo.toml +++ b/embassy-time/Cargo.toml | |||
| @@ -235,8 +235,8 @@ defmt = { version = "0.3", optional = true } | |||
| 235 | log = { version = "0.4.14", optional = true } | 235 | log = { version = "0.4.14", optional = true } |
| 236 | 236 | ||
| 237 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } | 237 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } |
| 238 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 238 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 239 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 239 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 240 | 240 | ||
| 241 | futures-util = { version = "0.3.17", default-features = false } | 241 | futures-util = { version = "0.3.17", default-features = false } |
| 242 | critical-section = "1.1" | 242 | critical-section = "1.1" |
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml index 65cd631f8..1c49c32e1 100644 --- a/examples/nrf52840/Cargo.toml +++ b/examples/nrf52840/Cargo.toml | |||
| @@ -36,9 +36,9 @@ rand = { version = "0.8.4", default-features = false } | |||
| 36 | embedded-storage = "0.3.1" | 36 | embedded-storage = "0.3.1" |
| 37 | usbd-hid = "0.6.0" | 37 | usbd-hid = "0.6.0" |
| 38 | serde = { version = "1.0.136", default-features = false } | 38 | serde = { version = "1.0.136", default-features = false } |
| 39 | embedded-hal = { version = "1.0.0-rc.2" } | 39 | embedded-hal = { version = "1.0.0-rc.3" } |
| 40 | embedded-hal-async = { version = "1.0.0-rc.2" } | 40 | embedded-hal-async = { version = "1.0.0-rc.3" } |
| 41 | embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] } | 41 | embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } |
| 42 | num-integer = { version = "0.1.45", default-features = false } | 42 | num-integer = { version = "0.1.45", default-features = false } |
| 43 | microfft = "0.5.0" | 43 | microfft = "0.5.0" |
| 44 | 44 | ||
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index 7f637758d..521f17b82 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -38,9 +38,9 @@ smart-leds = "0.3.0" | |||
| 38 | heapless = "0.8" | 38 | heapless = "0.8" |
| 39 | usbd-hid = "0.6.1" | 39 | usbd-hid = "0.6.1" |
| 40 | 40 | ||
| 41 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 41 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 42 | embedded-hal-async = "1.0.0-rc.2" | 42 | embedded-hal-async = "1.0.0-rc.3" |
| 43 | embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] } | 43 | embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } |
| 44 | embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } | 44 | embedded-io-async = { version = "0.6.1", features = ["defmt-03"] } |
| 45 | embedded-storage = { version = "0.3" } | 45 | embedded-storage = { version = "0.3" } |
| 46 | static_cell = { version = "2", features = ["nightly"]} | 46 | static_cell = { version = "2", features = ["nightly"]} |
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs index d7aa89410..a9f34ab5d 100644 --- a/examples/rp/src/bin/button.rs +++ b/examples/rp/src/bin/button.rs | |||
| @@ -17,7 +17,7 @@ async fn main(_spawner: Spawner) { | |||
| 17 | 17 | ||
| 18 | // Use PIN_28, Pin34 on J0 for RP Pico, as a input. | 18 | // Use PIN_28, Pin34 on J0 for RP Pico, as a input. |
| 19 | // You need to add your own button. | 19 | // You need to add your own button. |
| 20 | let button = Input::new(p.PIN_28, Pull::Up); | 20 | let mut button = Input::new(p.PIN_28, Pull::Up); |
| 21 | 21 | ||
| 22 | loop { | 22 | loop { |
| 23 | if button.is_high() { | 23 | if button.is_high() { |
diff --git a/examples/stm32c0/src/bin/button.rs b/examples/stm32c0/src/bin/button.rs index 72a3f5cbf..40c58013b 100644 --- a/examples/stm32c0/src/bin/button.rs +++ b/examples/stm32c0/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PC13, Pull::Up); | 16 | let mut button = Input::new(p.PC13, Pull::Up); |
| 17 | 17 | ||
| 18 | loop { | 18 | loop { |
| 19 | if button.is_high() { | 19 | if button.is_high() { |
diff --git a/examples/stm32f3/src/bin/button.rs b/examples/stm32f3/src/bin/button.rs index b55bf3901..2f47d8f80 100644 --- a/examples/stm32f3/src/bin/button.rs +++ b/examples/stm32f3/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PA0, Pull::Down); | 16 | let mut button = Input::new(p.PA0, Pull::Down); |
| 17 | let mut led1 = Output::new(p.PE9, Level::High, Speed::Low); | 17 | let mut led1 = Output::new(p.PE9, Level::High, Speed::Low); |
| 18 | let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); | 18 | let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); |
| 19 | 19 | ||
diff --git a/examples/stm32f4/src/bin/button.rs b/examples/stm32f4/src/bin/button.rs index b13e64531..aa1eed46f 100644 --- a/examples/stm32f4/src/bin/button.rs +++ b/examples/stm32f4/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PC13, Pull::Down); | 16 | let mut button = Input::new(p.PC13, Pull::Down); |
| 17 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); | 17 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); |
| 18 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); | 18 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); |
| 19 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); | 19 | 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 b13e64531..aa1eed46f 100644 --- a/examples/stm32f7/src/bin/button.rs +++ b/examples/stm32f7/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PC13, Pull::Down); | 16 | let mut button = Input::new(p.PC13, Pull::Down); |
| 17 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); | 17 | let mut led1 = Output::new(p.PB0, Level::High, Speed::Low); |
| 18 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); | 18 | let _led2 = Output::new(p.PB7, Level::High, Speed::Low); |
| 19 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); | 19 | 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 72a3f5cbf..40c58013b 100644 --- a/examples/stm32g0/src/bin/button.rs +++ b/examples/stm32g0/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PC13, Pull::Up); | 16 | let mut button = Input::new(p.PC13, Pull::Up); |
| 17 | 17 | ||
| 18 | loop { | 18 | loop { |
| 19 | if button.is_high() { | 19 | if button.is_high() { |
diff --git a/examples/stm32g4/src/bin/button.rs b/examples/stm32g4/src/bin/button.rs index 15abd86d9..127efb08a 100644 --- a/examples/stm32g4/src/bin/button.rs +++ b/examples/stm32g4/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PC13, Pull::Down); | 16 | let mut button = Input::new(p.PC13, Pull::Down); |
| 17 | 17 | ||
| 18 | loop { | 18 | loop { |
| 19 | if button.is_high() { | 19 | if button.is_high() { |
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml index 0ed0ce3c0..f714a3984 100644 --- a/examples/stm32h5/Cargo.toml +++ b/examples/stm32h5/Cargo.toml | |||
| @@ -19,8 +19,8 @@ defmt-rtt = "0.4" | |||
| 19 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 19 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
| 20 | cortex-m-rt = "0.7.0" | 20 | cortex-m-rt = "0.7.0" |
| 21 | embedded-hal = "0.2.6" | 21 | embedded-hal = "0.2.6" |
| 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 23 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 23 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 24 | embedded-io-async = { version = "0.6.1" } | 24 | embedded-io-async = { version = "0.6.1" } |
| 25 | embedded-nal-async = { version = "0.7.1" } | 25 | embedded-nal-async = { version = "0.7.1" } |
| 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index baa530cf6..c6aea3e11 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml | |||
| @@ -19,8 +19,8 @@ defmt-rtt = "0.4" | |||
| 19 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 19 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
| 20 | cortex-m-rt = "0.7.0" | 20 | cortex-m-rt = "0.7.0" |
| 21 | embedded-hal = "0.2.6" | 21 | embedded-hal = "0.2.6" |
| 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 23 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 23 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 24 | embedded-nal-async = { version = "0.7.1" } | 24 | embedded-nal-async = { version = "0.7.1" } |
| 25 | embedded-io-async = { version = "0.6.1" } | 25 | embedded-io-async = { version = "0.6.1" } |
| 26 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 26 | 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 9d194471e..3e56160e9 100644 --- a/examples/stm32l0/src/bin/button.rs +++ b/examples/stm32l0/src/bin/button.rs | |||
| @@ -12,7 +12,7 @@ async fn main(_spawner: Spawner) { | |||
| 12 | let p = embassy_stm32::init(Default::default()); | 12 | let p = embassy_stm32::init(Default::default()); |
| 13 | info!("Hello World!"); | 13 | info!("Hello World!"); |
| 14 | 14 | ||
| 15 | let button = Input::new(p.PB2, Pull::Up); | 15 | let mut button = Input::new(p.PB2, Pull::Up); |
| 16 | let mut led1 = Output::new(p.PA5, Level::High, Speed::Low); | 16 | let mut led1 = Output::new(p.PA5, Level::High, Speed::Low); |
| 17 | let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); | 17 | let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); |
| 18 | 18 | ||
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml index a936d27c3..2861216d4 100644 --- a/examples/stm32l4/Cargo.toml +++ b/examples/stm32l4/Cargo.toml | |||
| @@ -24,9 +24,9 @@ defmt-rtt = "0.4" | |||
| 24 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 24 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 25 | cortex-m-rt = "0.7.0" | 25 | cortex-m-rt = "0.7.0" |
| 26 | embedded-hal = "0.2.6" | 26 | embedded-hal = "0.2.6" |
| 27 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 27 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 28 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 28 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 29 | embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } | 29 | embedded-hal-bus = { version = "=0.1.0-rc.3", features = ["async"] } |
| 30 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 30 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 31 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 31 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 32 | heapless = { version = "0.8", default-features = false } | 32 | heapless = { version = "0.8", default-features = false } |
diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs index 73b1962e8..0a102c2d6 100644 --- a/examples/stm32l4/src/bin/button.rs +++ b/examples/stm32l4/src/bin/button.rs | |||
| @@ -12,7 +12,7 @@ fn main() -> ! { | |||
| 12 | 12 | ||
| 13 | let p = embassy_stm32::init(Default::default()); | 13 | let p = embassy_stm32::init(Default::default()); |
| 14 | 14 | ||
| 15 | let button = Input::new(p.PC13, Pull::Up); | 15 | let mut button = Input::new(p.PC13, Pull::Up); |
| 16 | 16 | ||
| 17 | loop { | 17 | loop { |
| 18 | if button.is_high() { | 18 | 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 4826e0bed..8ec810c7f 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) { | |||
| 114 | let led_uc4_blue = Output::new(dp.PG15, Level::High, Speed::Low); | 114 | let led_uc4_blue = Output::new(dp.PG15, Level::High, Speed::Low); |
| 115 | 115 | ||
| 116 | // Read the uc_cfg switches | 116 | // Read the uc_cfg switches |
| 117 | let uc_cfg0 = Input::new(dp.PB2, Pull::None); | 117 | let mut uc_cfg0 = Input::new(dp.PB2, Pull::None); |
| 118 | let uc_cfg1 = Input::new(dp.PF11, Pull::None); | 118 | let mut uc_cfg1 = Input::new(dp.PF11, Pull::None); |
| 119 | let _uc_cfg2 = Input::new(dp.PG6, Pull::None); | 119 | let _uc_cfg2 = Input::new(dp.PG6, Pull::None); |
| 120 | let _uc_cfg3 = Input::new(dp.PG11, Pull::None); | 120 | let _uc_cfg3 = Input::new(dp.PG11, Pull::None); |
| 121 | 121 | ||
| @@ -133,8 +133,8 @@ async fn main(spawner: Spawner) { | |||
| 133 | 133 | ||
| 134 | // Setup IO and SPI for the SPE chip | 134 | // Setup IO and SPI for the SPE chip |
| 135 | let spe_reset_n = Output::new(dp.PC7, Level::Low, Speed::Low); | 135 | let spe_reset_n = Output::new(dp.PC7, Level::Low, Speed::Low); |
| 136 | let spe_cfg0 = Input::new(dp.PC8, Pull::None); | 136 | let mut spe_cfg0 = Input::new(dp.PC8, Pull::None); |
| 137 | let spe_cfg1 = Input::new(dp.PC9, Pull::None); | 137 | let mut spe_cfg1 = Input::new(dp.PC9, Pull::None); |
| 138 | let _spe_ts_capt = Output::new(dp.PC6, Level::Low, Speed::Low); | 138 | let _spe_ts_capt = Output::new(dp.PC6, Level::Low, Speed::Low); |
| 139 | 139 | ||
| 140 | let spe_int = Input::new(dp.PB11, Pull::None); | 140 | 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 f1b80087c..903ca58df 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) { | |||
| 30 | let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); | 30 | let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); |
| 31 | let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); | 31 | let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); |
| 32 | let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); | 32 | let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); |
| 33 | let ready = Input::new(p.PE1, Pull::Up); | 33 | let mut ready = Input::new(p.PE1, Pull::Up); |
| 34 | 34 | ||
| 35 | cortex_m::asm::delay(100_000); | 35 | cortex_m::asm::delay(100_000); |
| 36 | reset.set_high(); | 36 | reset.set_high(); |
diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs index ff9b5b43b..58cf2e51e 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) { | |||
| 25 | let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); | 25 | let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh); |
| 26 | let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); | 26 | let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh); |
| 27 | let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); | 27 | let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh); |
| 28 | let ready = Input::new(p.PE1, Pull::Up); | 28 | let mut ready = Input::new(p.PE1, Pull::Up); |
| 29 | 29 | ||
| 30 | cortex_m::asm::delay(100_000); | 30 | cortex_m::asm::delay(100_000); |
| 31 | reset.set_high(); | 31 | reset.set_high(); |
diff --git a/examples/stm32wl/src/bin/button.rs b/examples/stm32wl/src/bin/button.rs index 982a7a112..6c1f5a5ef 100644 --- a/examples/stm32wl/src/bin/button.rs +++ b/examples/stm32wl/src/bin/button.rs | |||
| @@ -13,7 +13,7 @@ fn main() -> ! { | |||
| 13 | 13 | ||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PA0, Pull::Up); | 16 | let mut button = Input::new(p.PA0, Pull::Up); |
| 17 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); | 17 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); |
| 18 | let mut led2 = Output::new(p.PB9, Level::High, Speed::Low); | 18 | let mut led2 = Output::new(p.PB9, Level::High, Speed::Low); |
| 19 | 19 | ||
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index 7b0d59ee2..b6067abcc 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"] } | |||
| 16 | embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } | 16 | embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] } |
| 17 | embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] } | 17 | embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] } |
| 18 | embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"] } | 18 | embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"] } |
| 19 | embedded-hal-async = { version = "1.0.0-rc.2" } | 19 | embedded-hal-async = { version = "1.0.0-rc.3" } |
| 20 | embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] } | 20 | embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] } |
| 21 | static_cell = { version = "2", features = [ "nightly" ] } | 21 | static_cell = { version = "2", features = [ "nightly" ] } |
| 22 | perf-client = { path = "../perf-client" } | 22 | perf-client = { path = "../perf-client" } |
| 23 | 23 | ||
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 44fb7bed6..028ce43ee 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -24,9 +24,9 @@ defmt-rtt = "0.4" | |||
| 24 | cortex-m = { version = "0.7.6" } | 24 | cortex-m = { version = "0.7.6" } |
| 25 | cortex-m-rt = "0.7.0" | 25 | cortex-m-rt = "0.7.0" |
| 26 | embedded-hal = "0.2.6" | 26 | embedded-hal = "0.2.6" |
| 27 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 27 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 28 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 28 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 29 | embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] } | 29 | embedded-hal-bus = { version = "=0.1.0-rc.3", features = ["async"] } |
| 30 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 30 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } |
| 31 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 31 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 32 | embedded-io-async = { version = "0.6.1" } | 32 | embedded-io-async = { version = "0.6.1" } |
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index e0c309887..a57d5d9e8 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs | |||
| @@ -16,10 +16,10 @@ async fn main(_spawner: Spawner) { | |||
| 16 | 16 | ||
| 17 | // Test initial output | 17 | // Test initial output |
| 18 | { | 18 | { |
| 19 | let b = Input::new(&mut b, Pull::None); | 19 | let mut b = Input::new(&mut b, Pull::None); |
| 20 | 20 | ||
| 21 | { | 21 | { |
| 22 | let a = Output::new(&mut a, Level::Low); | 22 | let mut a = Output::new(&mut a, Level::Low); |
| 23 | delay(); | 23 | delay(); |
| 24 | assert!(b.is_low()); | 24 | assert!(b.is_low()); |
| 25 | assert!(!b.is_high()); | 25 | assert!(!b.is_high()); |
| @@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) { | |||
| 64 | 64 | ||
| 65 | // Test input no pull | 65 | // Test input no pull |
| 66 | { | 66 | { |
| 67 | let b = Input::new(&mut b, Pull::None); | 67 | let mut b = Input::new(&mut b, Pull::None); |
| 68 | // no pull, the status is undefined | 68 | // no pull, the status is undefined |
| 69 | 69 | ||
| 70 | let mut a = Output::new(&mut a, Level::Low); | 70 | let mut a = Output::new(&mut a, Level::Low); |
| @@ -77,7 +77,7 @@ async fn main(_spawner: Spawner) { | |||
| 77 | 77 | ||
| 78 | // Test input pulldown | 78 | // Test input pulldown |
| 79 | { | 79 | { |
| 80 | let b = Input::new(&mut b, Pull::Down); | 80 | let mut b = Input::new(&mut b, Pull::Down); |
| 81 | delay(); | 81 | delay(); |
| 82 | assert!(b.is_low()); | 82 | assert!(b.is_low()); |
| 83 | 83 | ||
| @@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) { | |||
| 91 | 91 | ||
| 92 | // Test input pullup | 92 | // Test input pullup |
| 93 | { | 93 | { |
| 94 | let b = Input::new(&mut b, Pull::Up); | 94 | let mut b = Input::new(&mut b, Pull::Up); |
| 95 | delay(); | 95 | delay(); |
| 96 | assert!(b.is_high()); | 96 | assert!(b.is_high()); |
| 97 | 97 | ||
diff --git a/tests/rp/src/bin/pwm.rs b/tests/rp/src/bin/pwm.rs index e71d9e610..3fc0bb2a0 100644 --- a/tests/rp/src/bin/pwm.rs +++ b/tests/rp/src/bin/pwm.rs | |||
| @@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) { | |||
| 45 | 45 | ||
| 46 | // Test output from A | 46 | // Test output from A |
| 47 | { | 47 | { |
| 48 | let pin1 = Input::new(&mut p9, Pull::None); | 48 | let mut pin1 = Input::new(&mut p9, Pull::None); |
| 49 | let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone()); | 49 | let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone()); |
| 50 | Timer::after_millis(1).await; | 50 | Timer::after_millis(1).await; |
| 51 | assert_eq!(pin1.is_low(), invert_a); | 51 | assert_eq!(pin1.is_low(), invert_a); |
| @@ -59,7 +59,7 @@ async fn main(_spawner: Spawner) { | |||
| 59 | 59 | ||
| 60 | // Test output from B | 60 | // Test output from B |
| 61 | { | 61 | { |
| 62 | let pin2 = Input::new(&mut p11, Pull::None); | 62 | let mut pin2 = Input::new(&mut p11, Pull::None); |
| 63 | let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone()); | 63 | let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone()); |
| 64 | Timer::after_millis(1).await; | 64 | Timer::after_millis(1).await; |
| 65 | assert_ne!(pin2.is_low(), invert_a); | 65 | assert_ne!(pin2.is_low(), invert_a); |
| @@ -73,8 +73,8 @@ async fn main(_spawner: Spawner) { | |||
| 73 | 73 | ||
| 74 | // Test output from A+B | 74 | // Test output from A+B |
| 75 | { | 75 | { |
| 76 | let pin1 = Input::new(&mut p9, Pull::None); | 76 | let mut pin1 = Input::new(&mut p9, Pull::None); |
| 77 | let pin2 = Input::new(&mut p11, Pull::None); | 77 | let mut pin2 = Input::new(&mut p11, Pull::None); |
| 78 | let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone()); | 78 | let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone()); |
| 79 | Timer::after_millis(1).await; | 79 | Timer::after_millis(1).await; |
| 80 | assert_eq!(pin1.is_low(), invert_a); | 80 | assert_eq!(pin1.is_low(), invert_a); |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 4f53e84f0..bdec41571 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -63,8 +63,8 @@ defmt-rtt = "0.4" | |||
| 63 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | 63 | cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } |
| 64 | cortex-m-rt = "0.7.0" | 64 | cortex-m-rt = "0.7.0" |
| 65 | embedded-hal = "0.2.6" | 65 | embedded-hal = "0.2.6" |
| 66 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 66 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" } |
| 67 | embedded-hal-async = { version = "=1.0.0-rc.2" } | 67 | embedded-hal-async = { version = "=1.0.0-rc.3" } |
| 68 | micromath = "2.0.0" | 68 | micromath = "2.0.0" |
| 69 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 69 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } |
| 70 | rand_core = { version = "0.6", default-features = false } | 70 | 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 c4e2fe161..9f1993024 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs | |||
| @@ -20,10 +20,10 @@ async fn main(_spawner: Spawner) { | |||
| 20 | 20 | ||
| 21 | // Test initial output | 21 | // Test initial output |
| 22 | { | 22 | { |
| 23 | let b = Input::new(&mut b, Pull::None); | 23 | let mut b = Input::new(&mut b, Pull::None); |
| 24 | 24 | ||
| 25 | { | 25 | { |
| 26 | let a = Output::new(&mut a, Level::Low, Speed::Low); | 26 | let mut a = Output::new(&mut a, Level::Low, Speed::Low); |
| 27 | delay(); | 27 | delay(); |
| 28 | assert!(b.is_low()); | 28 | assert!(b.is_low()); |
| 29 | assert!(!b.is_high()); | 29 | assert!(!b.is_high()); |
| @@ -68,7 +68,7 @@ async fn main(_spawner: Spawner) { | |||
| 68 | 68 | ||
| 69 | // Test input no pull | 69 | // Test input no pull |
| 70 | { | 70 | { |
| 71 | let b = Input::new(&mut b, Pull::None); | 71 | let mut b = Input::new(&mut b, Pull::None); |
| 72 | // no pull, the status is undefined | 72 | // no pull, the status is undefined |
| 73 | 73 | ||
| 74 | let mut a = Output::new(&mut a, Level::Low, Speed::Low); | 74 | let mut a = Output::new(&mut a, Level::Low, Speed::Low); |
| @@ -81,7 +81,7 @@ async fn main(_spawner: Spawner) { | |||
| 81 | 81 | ||
| 82 | // Test input pulldown | 82 | // Test input pulldown |
| 83 | { | 83 | { |
| 84 | let b = Input::new(&mut b, Pull::Down); | 84 | let mut b = Input::new(&mut b, Pull::Down); |
| 85 | delay(); | 85 | delay(); |
| 86 | assert!(b.is_low()); | 86 | assert!(b.is_low()); |
| 87 | 87 | ||
| @@ -95,7 +95,7 @@ async fn main(_spawner: Spawner) { | |||
| 95 | 95 | ||
| 96 | // Test input pullup | 96 | // Test input pullup |
| 97 | { | 97 | { |
| 98 | let b = Input::new(&mut b, Pull::Up); | 98 | let mut b = Input::new(&mut b, Pull::Up); |
| 99 | delay(); | 99 | delay(); |
| 100 | assert!(b.is_high()); | 100 | assert!(b.is_high()); |
| 101 | 101 | ||
| @@ -109,7 +109,7 @@ async fn main(_spawner: Spawner) { | |||
| 109 | 109 | ||
| 110 | // Test output open drain | 110 | // Test output open drain |
| 111 | { | 111 | { |
| 112 | let b = Input::new(&mut b, Pull::Down); | 112 | let mut b = Input::new(&mut b, Pull::Down); |
| 113 | // no pull, the status is undefined | 113 | // no pull, the status is undefined |
| 114 | 114 | ||
| 115 | let mut a = OutputOpenDrain::new(&mut a, Level::Low, Speed::Low, Pull::None); | 115 | let mut a = OutputOpenDrain::new(&mut a, Level::Low, Speed::Low, Pull::None); |
