From 71975c72fceef48213b1ffd19bce8219c6d26de6 Mon Sep 17 00:00:00 2001 From: Kelsey Maes Date: Fri, 27 Jun 2025 14:11:01 -0700 Subject: [PATCH] mspm0: Fix inverted GPIO logic --- embassy-mspm0/src/gpio.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs index 738d51928..9fbe34251 100644 --- a/embassy-mspm0/src/gpio.rs +++ b/embassy-mspm0/src/gpio.rs @@ -223,13 +223,13 @@ impl<'d> Flex<'d> { /// Get whether the pin input level is high. #[inline] pub fn is_high(&self) -> bool { - !self.is_low() + self.pin.block().din31_0().read().dio(self.pin.bit_index()) } /// Get whether the pin input level is low. #[inline] pub fn is_low(&self) -> bool { - self.pin.block().din31_0().read().dio(self.pin.bit_index()) + !self.is_high() } /// Returns current pin level @@ -271,22 +271,22 @@ impl<'d> Flex<'d> { } } - /// Get the current pin input level. + /// Get the current pin output level. #[inline] pub fn get_output_level(&self) -> Level { - self.is_high().into() + self.is_set_high().into() } /// Is the output level high? #[inline] pub fn is_set_high(&self) -> bool { - !self.is_set_low() + self.pin.block().dout31_0().read().dio(self.pin.bit_index()) } /// Is the output level low? #[inline] pub fn is_set_low(&self) -> bool { - (self.pin.block().dout31_0().read().0 & self.pin.bit_index() as u32) == 0 + !self.is_set_high() } /// Wait until the pin is high. If it is already high, return immediately.