diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-01-22 21:30:29 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-01-22 21:32:10 +0100 |
| commit | ee0ebe3121e5d51240e671d8c5cc19ad878b9db9 (patch) | |
| tree | caabf0c20ce7d2d07e292690b1afb9baa606610f /embassy-rp | |
| parent | 2bc5e9523d4373002487614ecfef1e3f0858fd66 (diff) | |
rp/gpio: remove generics.
Diffstat (limited to 'embassy-rp')
| -rw-r--r-- | embassy-rp/src/gpio.rs | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 7eb57bbe6..93b29bbf9 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -8,6 +8,7 @@ use core::task::{Context, Poll}; | |||
| 8 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; | 8 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | 10 | ||
| 11 | use self::sealed::Pin as _; | ||
| 11 | use crate::interrupt::InterruptExt; | 12 | use crate::interrupt::InterruptExt; |
| 12 | use crate::pac::common::{Reg, RW}; | 13 | use crate::pac::common::{Reg, RW}; |
| 13 | use crate::pac::SIO; | 14 | use crate::pac::SIO; |
| @@ -105,14 +106,14 @@ pub struct DormantWakeConfig { | |||
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /// GPIO input driver. | 108 | /// GPIO input driver. |
| 108 | pub struct Input<'d, T: Pin> { | 109 | pub struct Input<'d> { |
| 109 | pin: Flex<'d, T>, | 110 | pin: Flex<'d>, |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | impl<'d, T: Pin> Input<'d, T> { | 113 | impl<'d> Input<'d> { |
| 113 | /// Create GPIO input driver for a [Pin] with the provided [Pull] configuration. | 114 | /// Create GPIO input driver for a [Pin] with the provided [Pull] configuration. |
| 114 | #[inline] | 115 | #[inline] |
| 115 | pub fn new(pin: impl Peripheral<P = T> + 'd, pull: Pull) -> Self { | 116 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, pull: Pull) -> Self { |
| 116 | let mut pin = Flex::new(pin); | 117 | let mut pin = Flex::new(pin); |
| 117 | pin.set_as_input(); | 118 | pin.set_as_input(); |
| 118 | pin.set_pull(pull); | 119 | pin.set_pull(pull); |
| @@ -175,7 +176,7 @@ impl<'d, T: Pin> Input<'d, T> { | |||
| 175 | 176 | ||
| 176 | /// Configure dormant wake. | 177 | /// Configure dormant wake. |
| 177 | #[inline] | 178 | #[inline] |
| 178 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<T> { | 179 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_> { |
| 179 | self.pin.dormant_wake(cfg) | 180 | self.pin.dormant_wake(cfg) |
| 180 | } | 181 | } |
| 181 | } | 182 | } |
| @@ -255,14 +256,12 @@ fn IO_IRQ_QSPI() { | |||
| 255 | } | 256 | } |
| 256 | 257 | ||
| 257 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 258 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 258 | struct InputFuture<'a, T: Pin> { | 259 | struct InputFuture<'d> { |
| 259 | pin: PeripheralRef<'a, T>, | 260 | pin: PeripheralRef<'d, AnyPin>, |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | impl<'d, T: Pin> InputFuture<'d, T> { | 263 | impl<'d> InputFuture<'d> { |
| 263 | /// Create a new future wiating for input trigger. | 264 | fn new(pin: PeripheralRef<'d, AnyPin>, level: InterruptTrigger) -> Self { |
| 264 | pub fn new(pin: impl Peripheral<P = T> + 'd, level: InterruptTrigger) -> Self { | ||
| 265 | into_ref!(pin); | ||
| 266 | let pin_group = (pin.pin() % 8) as usize; | 265 | let pin_group = (pin.pin() % 8) as usize; |
| 267 | // first, clear the INTR register bits. without this INTR will still | 266 | // first, clear the INTR register bits. without this INTR will still |
| 268 | // contain reports of previous edges, causing the IRQ to fire early | 267 | // contain reports of previous edges, causing the IRQ to fire early |
| @@ -305,7 +304,7 @@ impl<'d, T: Pin> InputFuture<'d, T> { | |||
| 305 | } | 304 | } |
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | impl<'d, T: Pin> Future for InputFuture<'d, T> { | 307 | impl<'d> Future for InputFuture<'d> { |
| 309 | type Output = (); | 308 | type Output = (); |
| 310 | 309 | ||
| 311 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 310 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| @@ -344,14 +343,14 @@ impl<'d, T: Pin> Future for InputFuture<'d, T> { | |||
| 344 | } | 343 | } |
| 345 | 344 | ||
| 346 | /// GPIO output driver. | 345 | /// GPIO output driver. |
| 347 | pub struct Output<'d, T: Pin> { | 346 | pub struct Output<'d> { |
| 348 | pin: Flex<'d, T>, | 347 | pin: Flex<'d>, |
| 349 | } | 348 | } |
| 350 | 349 | ||
| 351 | impl<'d, T: Pin> Output<'d, T> { | 350 | impl<'d> Output<'d> { |
| 352 | /// Create GPIO output driver for a [Pin] with the provided [Level]. | 351 | /// Create GPIO output driver for a [Pin] with the provided [Level]. |
| 353 | #[inline] | 352 | #[inline] |
| 354 | pub fn new(pin: impl Peripheral<P = T> + 'd, initial_output: Level) -> Self { | 353 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, initial_output: Level) -> Self { |
| 355 | let mut pin = Flex::new(pin); | 354 | let mut pin = Flex::new(pin); |
| 356 | match initial_output { | 355 | match initial_output { |
| 357 | Level::High => pin.set_high(), | 356 | Level::High => pin.set_high(), |
| @@ -418,14 +417,14 @@ impl<'d, T: Pin> Output<'d, T> { | |||
| 418 | } | 417 | } |
| 419 | 418 | ||
| 420 | /// GPIO output open-drain. | 419 | /// GPIO output open-drain. |
| 421 | pub struct OutputOpenDrain<'d, T: Pin> { | 420 | pub struct OutputOpenDrain<'d> { |
| 422 | pin: Flex<'d, T>, | 421 | pin: Flex<'d>, |
| 423 | } | 422 | } |
| 424 | 423 | ||
| 425 | impl<'d, T: Pin> OutputOpenDrain<'d, T> { | 424 | impl<'d> OutputOpenDrain<'d> { |
| 426 | /// Create GPIO output driver for a [Pin] in open drain mode with the provided [Level]. | 425 | /// Create GPIO output driver for a [Pin] in open drain mode with the provided [Level]. |
| 427 | #[inline] | 426 | #[inline] |
| 428 | pub fn new(pin: impl Peripheral<P = T> + 'd, initial_output: Level) -> Self { | 427 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, initial_output: Level) -> Self { |
| 429 | let mut pin = Flex::new(pin); | 428 | let mut pin = Flex::new(pin); |
| 430 | pin.set_low(); | 429 | pin.set_low(); |
| 431 | match initial_output { | 430 | match initial_output { |
| @@ -548,17 +547,17 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 548 | /// This pin can be either an input or output pin. The output level register bit will remain | 547 | /// This pin can be either an input or output pin. The output level register bit will remain |
| 549 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output | 548 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output |
| 550 | /// mode. | 549 | /// mode. |
| 551 | pub struct Flex<'d, T: Pin> { | 550 | pub struct Flex<'d> { |
| 552 | pin: PeripheralRef<'d, T>, | 551 | pin: PeripheralRef<'d, AnyPin>, |
| 553 | } | 552 | } |
| 554 | 553 | ||
| 555 | impl<'d, T: Pin> Flex<'d, T> { | 554 | impl<'d> Flex<'d> { |
| 556 | /// Wrap the pin in a `Flex`. | 555 | /// Wrap the pin in a `Flex`. |
| 557 | /// | 556 | /// |
| 558 | /// The pin remains disconnected. The initial output level is unspecified, but can be changed | 557 | /// The pin remains disconnected. The initial output level is unspecified, but can be changed |
| 559 | /// before the pin is put into output mode. | 558 | /// before the pin is put into output mode. |
| 560 | #[inline] | 559 | #[inline] |
| 561 | pub fn new(pin: impl Peripheral<P = T> + 'd) -> Self { | 560 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd) -> Self { |
| 562 | into_ref!(pin); | 561 | into_ref!(pin); |
| 563 | 562 | ||
| 564 | pin.pad_ctrl().write(|w| { | 563 | pin.pad_ctrl().write(|w| { |
| @@ -569,7 +568,7 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 569 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _); | 568 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _); |
| 570 | }); | 569 | }); |
| 571 | 570 | ||
| 572 | Self { pin } | 571 | Self { pin: pin.map_into() } |
| 573 | } | 572 | } |
| 574 | 573 | ||
| 575 | #[inline] | 574 | #[inline] |
| @@ -716,36 +715,36 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 716 | /// Wait until the pin is high. If it is already high, return immediately. | 715 | /// Wait until the pin is high. If it is already high, return immediately. |
| 717 | #[inline] | 716 | #[inline] |
| 718 | pub async fn wait_for_high(&mut self) { | 717 | pub async fn wait_for_high(&mut self) { |
| 719 | InputFuture::new(&mut self.pin, InterruptTrigger::LevelHigh).await; | 718 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::LevelHigh).await; |
| 720 | } | 719 | } |
| 721 | 720 | ||
| 722 | /// Wait until the pin is low. If it is already low, return immediately. | 721 | /// Wait until the pin is low. If it is already low, return immediately. |
| 723 | #[inline] | 722 | #[inline] |
| 724 | pub async fn wait_for_low(&mut self) { | 723 | pub async fn wait_for_low(&mut self) { |
| 725 | InputFuture::new(&mut self.pin, InterruptTrigger::LevelLow).await; | 724 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::LevelLow).await; |
| 726 | } | 725 | } |
| 727 | 726 | ||
| 728 | /// Wait for the pin to undergo a transition from low to high. | 727 | /// Wait for the pin to undergo a transition from low to high. |
| 729 | #[inline] | 728 | #[inline] |
| 730 | pub async fn wait_for_rising_edge(&mut self) { | 729 | pub async fn wait_for_rising_edge(&mut self) { |
| 731 | InputFuture::new(&mut self.pin, InterruptTrigger::EdgeHigh).await; | 730 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::EdgeHigh).await; |
| 732 | } | 731 | } |
| 733 | 732 | ||
| 734 | /// Wait for the pin to undergo a transition from high to low. | 733 | /// Wait for the pin to undergo a transition from high to low. |
| 735 | #[inline] | 734 | #[inline] |
| 736 | pub async fn wait_for_falling_edge(&mut self) { | 735 | pub async fn wait_for_falling_edge(&mut self) { |
| 737 | InputFuture::new(&mut self.pin, InterruptTrigger::EdgeLow).await; | 736 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::EdgeLow).await; |
| 738 | } | 737 | } |
| 739 | 738 | ||
| 740 | /// Wait for the pin to undergo any transition, i.e low to high OR high to low. | 739 | /// Wait for the pin to undergo any transition, i.e low to high OR high to low. |
| 741 | #[inline] | 740 | #[inline] |
| 742 | pub async fn wait_for_any_edge(&mut self) { | 741 | pub async fn wait_for_any_edge(&mut self) { |
| 743 | InputFuture::new(&mut self.pin, InterruptTrigger::AnyEdge).await; | 742 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::AnyEdge).await; |
| 744 | } | 743 | } |
| 745 | 744 | ||
| 746 | /// Configure dormant wake. | 745 | /// Configure dormant wake. |
| 747 | #[inline] | 746 | #[inline] |
| 748 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<T> { | 747 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_> { |
| 749 | let idx = self.pin._pin() as usize; | 748 | let idx = self.pin._pin() as usize; |
| 750 | self.pin.io().intr(idx / 8).write(|w| { | 749 | self.pin.io().intr(idx / 8).write(|w| { |
| 751 | w.set_edge_high(idx % 8, cfg.edge_high); | 750 | w.set_edge_high(idx % 8, cfg.edge_high); |
| @@ -764,7 +763,7 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 764 | } | 763 | } |
| 765 | } | 764 | } |
| 766 | 765 | ||
| 767 | impl<'d, T: Pin> Drop for Flex<'d, T> { | 766 | impl<'d> Drop for Flex<'d> { |
| 768 | #[inline] | 767 | #[inline] |
| 769 | fn drop(&mut self) { | 768 | fn drop(&mut self) { |
| 770 | let idx = self.pin._pin() as usize; | 769 | let idx = self.pin._pin() as usize; |
| @@ -782,12 +781,12 @@ impl<'d, T: Pin> Drop for Flex<'d, T> { | |||
| 782 | } | 781 | } |
| 783 | 782 | ||
| 784 | /// Dormant wake driver. | 783 | /// Dormant wake driver. |
| 785 | pub struct DormantWake<'w, T: Pin> { | 784 | pub struct DormantWake<'w> { |
| 786 | pin: PeripheralRef<'w, T>, | 785 | pin: PeripheralRef<'w, AnyPin>, |
| 787 | cfg: DormantWakeConfig, | 786 | cfg: DormantWakeConfig, |
| 788 | } | 787 | } |
| 789 | 788 | ||
| 790 | impl<'w, T: Pin> Drop for DormantWake<'w, T> { | 789 | impl<'w> Drop for DormantWake<'w> { |
| 791 | fn drop(&mut self) { | 790 | fn drop(&mut self) { |
| 792 | let idx = self.pin._pin() as usize; | 791 | let idx = self.pin._pin() as usize; |
| 793 | self.pin.io().intr(idx / 8).write(|w| { | 792 | self.pin.io().intr(idx / 8).write(|w| { |
| @@ -970,7 +969,7 @@ mod eh02 { | |||
| 970 | 969 | ||
| 971 | use super::*; | 970 | use super::*; |
| 972 | 971 | ||
| 973 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Input<'d, T> { | 972 | impl<'d> embedded_hal_02::digital::v2::InputPin for Input<'d> { |
| 974 | type Error = Infallible; | 973 | type Error = Infallible; |
| 975 | 974 | ||
| 976 | fn is_high(&self) -> Result<bool, Self::Error> { | 975 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -982,7 +981,7 @@ mod eh02 { | |||
| 982 | } | 981 | } |
| 983 | } | 982 | } |
| 984 | 983 | ||
| 985 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Output<'d, T> { | 984 | impl<'d> embedded_hal_02::digital::v2::OutputPin for Output<'d> { |
| 986 | type Error = Infallible; | 985 | type Error = Infallible; |
| 987 | 986 | ||
| 988 | fn set_high(&mut self) -> Result<(), Self::Error> { | 987 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| @@ -994,7 +993,7 @@ mod eh02 { | |||
| 994 | } | 993 | } |
| 995 | } | 994 | } |
| 996 | 995 | ||
| 997 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { | 996 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d> { |
| 998 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 997 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 999 | Ok(self.is_set_high()) | 998 | Ok(self.is_set_high()) |
| 1000 | } | 999 | } |
| @@ -1004,7 +1003,7 @@ mod eh02 { | |||
| 1004 | } | 1003 | } |
| 1005 | } | 1004 | } |
| 1006 | 1005 | ||
| 1007 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for Output<'d, T> { | 1006 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for Output<'d> { |
| 1008 | type Error = Infallible; | 1007 | type Error = Infallible; |
| 1009 | #[inline] | 1008 | #[inline] |
| 1010 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1009 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1012,7 +1011,7 @@ mod eh02 { | |||
| 1012 | } | 1011 | } |
| 1013 | } | 1012 | } |
| 1014 | 1013 | ||
| 1015 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for OutputOpenDrain<'d, T> { | 1014 | impl<'d> embedded_hal_02::digital::v2::InputPin for OutputOpenDrain<'d> { |
| 1016 | type Error = Infallible; | 1015 | type Error = Infallible; |
| 1017 | 1016 | ||
| 1018 | fn is_high(&self) -> Result<bool, Self::Error> { | 1017 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -1024,7 +1023,7 @@ mod eh02 { | |||
| 1024 | } | 1023 | } |
| 1025 | } | 1024 | } |
| 1026 | 1025 | ||
| 1027 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, T> { | 1026 | impl<'d> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d> { |
| 1028 | type Error = Infallible; | 1027 | type Error = Infallible; |
| 1029 | 1028 | ||
| 1030 | #[inline] | 1029 | #[inline] |
| @@ -1038,7 +1037,7 @@ mod eh02 { | |||
| 1038 | } | 1037 | } |
| 1039 | } | 1038 | } |
| 1040 | 1039 | ||
| 1041 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1040 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d> { |
| 1042 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1041 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 1043 | Ok(self.is_set_high()) | 1042 | Ok(self.is_set_high()) |
| 1044 | } | 1043 | } |
| @@ -1048,7 +1047,7 @@ mod eh02 { | |||
| 1048 | } | 1047 | } |
| 1049 | } | 1048 | } |
| 1050 | 1049 | ||
| 1051 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for OutputOpenDrain<'d, T> { | 1050 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for OutputOpenDrain<'d> { |
| 1052 | type Error = Infallible; | 1051 | type Error = Infallible; |
| 1053 | #[inline] | 1052 | #[inline] |
| 1054 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1053 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1056,7 +1055,7 @@ mod eh02 { | |||
| 1056 | } | 1055 | } |
| 1057 | } | 1056 | } |
| 1058 | 1057 | ||
| 1059 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Flex<'d, T> { | 1058 | impl<'d> embedded_hal_02::digital::v2::InputPin for Flex<'d> { |
| 1060 | type Error = Infallible; | 1059 | type Error = Infallible; |
| 1061 | 1060 | ||
| 1062 | fn is_high(&self) -> Result<bool, Self::Error> { | 1061 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -1068,7 +1067,7 @@ mod eh02 { | |||
| 1068 | } | 1067 | } |
| 1069 | } | 1068 | } |
| 1070 | 1069 | ||
| 1071 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Flex<'d, T> { | 1070 | impl<'d> embedded_hal_02::digital::v2::OutputPin for Flex<'d> { |
| 1072 | type Error = Infallible; | 1071 | type Error = Infallible; |
| 1073 | 1072 | ||
| 1074 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1073 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| @@ -1080,7 +1079,7 @@ mod eh02 { | |||
| 1080 | } | 1079 | } |
| 1081 | } | 1080 | } |
| 1082 | 1081 | ||
| 1083 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { | 1082 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d> { |
| 1084 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1083 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 1085 | Ok(self.is_set_high()) | 1084 | Ok(self.is_set_high()) |
| 1086 | } | 1085 | } |
| @@ -1090,7 +1089,7 @@ mod eh02 { | |||
| 1090 | } | 1089 | } |
| 1091 | } | 1090 | } |
| 1092 | 1091 | ||
| 1093 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for Flex<'d, T> { | 1092 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for Flex<'d> { |
| 1094 | type Error = Infallible; | 1093 | type Error = Infallible; |
| 1095 | #[inline] | 1094 | #[inline] |
| 1096 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1095 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1099,11 +1098,11 @@ mod eh02 { | |||
| 1099 | } | 1098 | } |
| 1100 | } | 1099 | } |
| 1101 | 1100 | ||
| 1102 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { | 1101 | impl<'d> embedded_hal_1::digital::ErrorType for Input<'d> { |
| 1103 | type Error = Infallible; | 1102 | type Error = Infallible; |
| 1104 | } | 1103 | } |
| 1105 | 1104 | ||
| 1106 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | 1105 | impl<'d> embedded_hal_1::digital::InputPin for Input<'d> { |
| 1107 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1106 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1108 | Ok((*self).is_high()) | 1107 | Ok((*self).is_high()) |
| 1109 | } | 1108 | } |
| @@ -1113,11 +1112,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | |||
| 1113 | } | 1112 | } |
| 1114 | } | 1113 | } |
| 1115 | 1114 | ||
| 1116 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Output<'d, T> { | 1115 | impl<'d> embedded_hal_1::digital::ErrorType for Output<'d> { |
| 1117 | type Error = Infallible; | 1116 | type Error = Infallible; |
| 1118 | } | 1117 | } |
| 1119 | 1118 | ||
| 1120 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | 1119 | impl<'d> embedded_hal_1::digital::OutputPin for Output<'d> { |
| 1121 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1120 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1122 | Ok(self.set_high()) | 1121 | Ok(self.set_high()) |
| 1123 | } | 1122 | } |
| @@ -1127,7 +1126,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | |||
| 1127 | } | 1126 | } |
| 1128 | } | 1127 | } |
| 1129 | 1128 | ||
| 1130 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | 1129 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for Output<'d> { |
| 1131 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1130 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1132 | Ok((*self).is_set_high()) | 1131 | Ok((*self).is_set_high()) |
| 1133 | } | 1132 | } |
| @@ -1137,11 +1136,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | |||
| 1137 | } | 1136 | } |
| 1138 | } | 1137 | } |
| 1139 | 1138 | ||
| 1140 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d, T> { | 1139 | impl<'d> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d> { |
| 1141 | type Error = Infallible; | 1140 | type Error = Infallible; |
| 1142 | } | 1141 | } |
| 1143 | 1142 | ||
| 1144 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | 1143 | impl<'d> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d> { |
| 1145 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1144 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1146 | Ok(self.set_high()) | 1145 | Ok(self.set_high()) |
| 1147 | } | 1146 | } |
| @@ -1151,7 +1150,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | |||
| 1151 | } | 1150 | } |
| 1152 | } | 1151 | } |
| 1153 | 1152 | ||
| 1154 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1153 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d> { |
| 1155 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1154 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1156 | Ok((*self).is_set_high()) | 1155 | Ok((*self).is_set_high()) |
| 1157 | } | 1156 | } |
| @@ -1161,7 +1160,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain< | |||
| 1161 | } | 1160 | } |
| 1162 | } | 1161 | } |
| 1163 | 1162 | ||
| 1164 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | 1163 | impl<'d> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d> { |
| 1165 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1164 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1166 | Ok((*self).is_high()) | 1165 | Ok((*self).is_high()) |
| 1167 | } | 1166 | } |
| @@ -1171,11 +1170,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | |||
| 1171 | } | 1170 | } |
| 1172 | } | 1171 | } |
| 1173 | 1172 | ||
| 1174 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { | 1173 | impl<'d> embedded_hal_1::digital::ErrorType for Flex<'d> { |
| 1175 | type Error = Infallible; | 1174 | type Error = Infallible; |
| 1176 | } | 1175 | } |
| 1177 | 1176 | ||
| 1178 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | 1177 | impl<'d> embedded_hal_1::digital::InputPin for Flex<'d> { |
| 1179 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1178 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1180 | Ok((*self).is_high()) | 1179 | Ok((*self).is_high()) |
| 1181 | } | 1180 | } |
| @@ -1185,7 +1184,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | |||
| 1185 | } | 1184 | } |
| 1186 | } | 1185 | } |
| 1187 | 1186 | ||
| 1188 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | 1187 | impl<'d> embedded_hal_1::digital::OutputPin for Flex<'d> { |
| 1189 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1188 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1190 | Ok(self.set_high()) | 1189 | Ok(self.set_high()) |
| 1191 | } | 1190 | } |
| @@ -1195,7 +1194,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | |||
| 1195 | } | 1194 | } |
| 1196 | } | 1195 | } |
| 1197 | 1196 | ||
| 1198 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | 1197 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for Flex<'d> { |
| 1199 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1198 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1200 | Ok((*self).is_set_high()) | 1199 | Ok((*self).is_set_high()) |
| 1201 | } | 1200 | } |
| @@ -1205,7 +1204,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | |||
| 1205 | } | 1204 | } |
| 1206 | } | 1205 | } |
| 1207 | 1206 | ||
| 1208 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> { | 1207 | impl<'d> embedded_hal_async::digital::Wait for Flex<'d> { |
| 1209 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1208 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1210 | self.wait_for_high().await; | 1209 | self.wait_for_high().await; |
| 1211 | Ok(()) | 1210 | Ok(()) |
| @@ -1232,7 +1231,7 @@ impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> { | |||
| 1232 | } | 1231 | } |
| 1233 | } | 1232 | } |
| 1234 | 1233 | ||
| 1235 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> { | 1234 | impl<'d> embedded_hal_async::digital::Wait for Input<'d> { |
| 1236 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1235 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1237 | self.wait_for_high().await; | 1236 | self.wait_for_high().await; |
| 1238 | Ok(()) | 1237 | Ok(()) |
| @@ -1259,7 +1258,7 @@ impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> { | |||
| 1259 | } | 1258 | } |
| 1260 | } | 1259 | } |
| 1261 | 1260 | ||
| 1262 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for OutputOpenDrain<'d, T> { | 1261 | impl<'d> embedded_hal_async::digital::Wait for OutputOpenDrain<'d> { |
| 1263 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1262 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1264 | self.wait_for_high().await; | 1263 | self.wait_for_high().await; |
| 1265 | Ok(()) | 1264 | Ok(()) |
