aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/gpio.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index 71390306f..930de2068 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -411,6 +411,16 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
411 pub fn toggle(&mut self) { 411 pub fn toggle(&mut self) {
412 self.pin.toggle_set_as_output() 412 self.pin.toggle_set_as_output()
413 } 413 }
414
415 #[inline]
416 pub fn is_high(&self) -> bool {
417 self.pin.is_high()
418 }
419
420 #[inline]
421 pub fn is_low(&self) -> bool {
422 self.pin.is_low()
423 }
414} 424}
415 425
416/// GPIO flexible pin. 426/// GPIO flexible pin.
@@ -791,6 +801,18 @@ mod eh02 {
791 } 801 }
792 } 802 }
793 803
804 impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for OutputOpenDrain<'d, T> {
805 type Error = Infallible;
806
807 fn is_high(&self) -> Result<bool, Self::Error> {
808 Ok(self.is_high())
809 }
810
811 fn is_low(&self) -> Result<bool, Self::Error> {
812 Ok(self.is_low())
813 }
814 }
815
794 impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, T> { 816 impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, T> {
795 type Error = Infallible; 817 type Error = Infallible;
796 818
@@ -946,6 +968,16 @@ mod eh1 {
946 } 968 }
947 } 969 }
948 970
971 impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> {
972 fn is_high(&self) -> Result<bool, Self::Error> {
973 Ok(self.is_high())
974 }
975
976 fn is_low(&self) -> Result<bool, Self::Error> {
977 Ok(self.is_low())
978 }
979 }
980
949 impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { 981 impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> {
950 type Error = Infallible; 982 type Error = Infallible;
951 } 983 }