From 0bb428dcc01a01f15459acb9ebed4e045448bf5d Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 11 May 2022 18:26:25 +0200 Subject: [PATCH] squash! Implement Output::is_set_low for embassy-rp Add check for the bit of the current pin. --- embassy-rp/src/gpio.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 9cdba8bf3..28dfce476 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -128,7 +128,8 @@ impl<'d, T: Pin> Output<'d, T> { /// Is the output pin set as low? pub fn is_set_low(&self) -> bool { // Reading from SIO: GPIO_OUT gives the last value written. - unsafe { self.pin.sio_out().value().read() == 0 } + let val = 1 << self.pin.pin(); + unsafe { (self.pin.sio_out().value().read() & val) == 0 } } }