diff options
| author | Gabriel Górski <[email protected]> | 2023-10-04 18:20:25 +0200 |
|---|---|---|
| committer | Gabriel Górski <[email protected]> | 2023-10-04 18:20:25 +0200 |
| commit | c6513f93fe8198cfcb49adc9d8b61e27090578fc (patch) | |
| tree | 2742a587399368de2dc3e91222a488cabd25aac5 /embassy-stm32 | |
| parent | 59f706ee2f93252d1c040cea149dfd744f4d8c16 (diff) | |
stm32/gpio: Implement `eh1::digital::InputPin` for `OutputOpenDrain`
Pins in open-drain mode are outputs and inputs simultaneously.
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/gpio.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index c709d46da..58d17f12e 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs | |||
| @@ -974,6 +974,18 @@ mod eh1 { | |||
| 974 | type Error = Infallible; | 974 | type Error = Infallible; |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | impl<'d, T: Pin> InputPin for OutputOpenDrain<'d, T> { | ||
| 978 | #[inline] | ||
| 979 | fn is_high(&self) -> Result<bool, Self::Error> { | ||
| 980 | Ok(self.is_high()) | ||
| 981 | } | ||
| 982 | |||
| 983 | #[inline] | ||
| 984 | fn is_low(&self) -> Result<bool, Self::Error> { | ||
| 985 | Ok(self.is_low()) | ||
| 986 | } | ||
| 987 | } | ||
| 988 | |||
| 977 | impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T> { | 989 | impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T> { |
| 978 | #[inline] | 990 | #[inline] |
| 979 | fn set_high(&mut self) -> Result<(), Self::Error> { | 991 | fn set_high(&mut self) -> Result<(), Self::Error> { |
