Skip to content

Commit b528ed0

Browse files
authored
Merge pull request embassy-rs#4351 from optlink/main
mspm0: Fix inverted GPIO logic
2 parents 830a01e + 71975c7 commit b528ed0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

embassy-mspm0/src/gpio.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ impl<'d> Flex<'d> {
223223
/// Get whether the pin input level is high.
224224
#[inline]
225225
pub fn is_high(&self) -> bool {
226-
!self.is_low()
226+
self.pin.block().din31_0().read().dio(self.pin.bit_index())
227227
}
228228

229229
/// Get whether the pin input level is low.
230230
#[inline]
231231
pub fn is_low(&self) -> bool {
232-
self.pin.block().din31_0().read().dio(self.pin.bit_index())
232+
!self.is_high()
233233
}
234234

235235
/// Returns current pin level
@@ -271,22 +271,22 @@ impl<'d> Flex<'d> {
271271
}
272272
}
273273

274-
/// Get the current pin input level.
274+
/// Get the current pin output level.
275275
#[inline]
276276
pub fn get_output_level(&self) -> Level {
277-
self.is_high().into()
277+
self.is_set_high().into()
278278
}
279279

280280
/// Is the output level high?
281281
#[inline]
282282
pub fn is_set_high(&self) -> bool {
283-
!self.is_set_low()
283+
self.pin.block().dout31_0().read().dio(self.pin.bit_index())
284284
}
285285

286286
/// Is the output level low?
287287
#[inline]
288288
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()
290290
}
291291

292292
/// Wait until the pin is high. If it is already high, return immediately.

0 commit comments

Comments
 (0)