diff options
| author | Kelsey Maes <[email protected]> | 2025-06-27 14:11:01 -0700 |
|---|---|---|
| committer | Kelsey Maes <[email protected]> | 2025-06-27 14:11:01 -0700 |
| commit | 71975c72fceef48213b1ffd19bce8219c6d26de6 (patch) | |
| tree | b9d7780e90885bf70ea350e1208c4e83f33e42c4 | |
| parent | 830a01e2f5615a03eb3ac23204926b1fc7f25af1 (diff) | |
mspm0: Fix inverted GPIO logic
| -rw-r--r-- | embassy-mspm0/src/gpio.rs | 12 |
1 files 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> { | |||
| 223 | /// Get whether the pin input level is high. | 223 | /// Get whether the pin input level is high. |
| 224 | #[inline] | 224 | #[inline] |
| 225 | pub fn is_high(&self) -> bool { | 225 | pub fn is_high(&self) -> bool { |
| 226 | !self.is_low() | 226 | self.pin.block().din31_0().read().dio(self.pin.bit_index()) |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /// Get whether the pin input level is low. | 229 | /// Get whether the pin input level is low. |
| 230 | #[inline] | 230 | #[inline] |
| 231 | pub fn is_low(&self) -> bool { | 231 | pub fn is_low(&self) -> bool { |
| 232 | self.pin.block().din31_0().read().dio(self.pin.bit_index()) | 232 | !self.is_high() |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | /// Returns current pin level | 235 | /// Returns current pin level |
| @@ -271,22 +271,22 @@ impl<'d> Flex<'d> { | |||
| 271 | } | 271 | } |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /// Get the current pin input level. | 274 | /// Get the current pin output level. |
| 275 | #[inline] | 275 | #[inline] |
| 276 | pub fn get_output_level(&self) -> Level { | 276 | pub fn get_output_level(&self) -> Level { |
| 277 | self.is_high().into() | 277 | self.is_set_high().into() |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | /// Is the output level high? | 280 | /// Is the output level high? |
| 281 | #[inline] | 281 | #[inline] |
| 282 | pub fn is_set_high(&self) -> bool { | 282 | pub fn is_set_high(&self) -> bool { |
| 283 | !self.is_set_low() | 283 | self.pin.block().dout31_0().read().dio(self.pin.bit_index()) |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | /// Is the output level low? | 286 | /// Is the output level low? |
| 287 | #[inline] | 287 | #[inline] |
| 288 | pub fn is_set_low(&self) -> bool { | 288 | pub fn is_set_low(&self) -> bool { |
| 289 | (self.pin.block().dout31_0().read().0 & self.pin.bit_index() as u32) == 0 | 289 | !self.is_set_high() |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | /// Wait until the pin is high. If it is already high, return immediately. | 292 | /// Wait until the pin is high. If it is already high, return immediately. |
