squash! Implement Output::is_set_low for embassy-rp

Add check for the bit of the current pin.
This commit is contained in:
Daniel Bevenius 2022-05-11 18:26:25 +02:00
parent 6d4a49bca8
commit 0bb428dcc0

View File

@ -128,7 +128,8 @@ impl<'d, T: Pin> Output<'d, T> {
/// Is the output pin set as low? /// Is the output pin set as low?
pub fn is_set_low(&self) -> bool { pub fn is_set_low(&self) -> bool {
// Reading from SIO: GPIO_OUT gives the last value written. // 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 }
} }
} }