From c6513f93fe8198cfcb49adc9d8b61e27090578fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20G=C3=B3rski?= Date: Wed, 4 Oct 2023 18:20:25 +0200 Subject: [PATCH] stm32/gpio: Implement `eh1::digital::InputPin` for `OutputOpenDrain` Pins in open-drain mode are outputs and inputs simultaneously. --- embassy-stm32/src/gpio.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 { type Error = Infallible; } + impl<'d, T: Pin> InputPin for OutputOpenDrain<'d, T> { + #[inline] + fn is_high(&self) -> Result { + Ok(self.is_high()) + } + + #[inline] + fn is_low(&self) -> Result { + Ok(self.is_low()) + } + } + impl<'d, T: Pin> OutputPin for OutputOpenDrain<'d, T> { #[inline] fn set_high(&mut self) -> Result<(), Self::Error> {