765: Implement Output::is_set_low for embassy-rp r=Dirbaio a=danbev

This commit implements a suggestion for the method `is_set_low` which is
currently a `todo`, by reading last value written to `GPIO_OUT`.

Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
bors[bot] 2022-05-11 16:58:18 +00:00 committed by GitHub
commit 6040517774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,8 +127,9 @@ impl<'d, T: Pin> Output<'d, T> {
/// Is the output pin set as low?
pub fn is_set_low(&self) -> bool {
// todo
true
// Reading from SIO: GPIO_OUT gives the last value written.
let val = 1 << self.pin.pin();
unsafe { (self.pin.sio_out().value().read() & val) == 0 }
}
}