aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-05-11 16:58:18 +0000
committerGitHub <[email protected]>2022-05-11 16:58:18 +0000
commit604051777419591cf66f5d06196cf16d3e399752 (patch)
treeccc10c39edb6866b965fc509137ba874b7e5b7a9
parent69e0f9f0fea8731fa23b4b62707ca2641f5f301a (diff)
parent0bb428dcc01a01f15459acb9ebed4e045448bf5d (diff)
Merge #765
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 <[email protected]>
-rw-r--r--embassy-rp/src/gpio.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index 598759036..28dfce476 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -127,8 +127,9 @@ impl<'d, T: Pin> Output<'d, T> {
127 127
128 /// Is the output pin set as low? 128 /// Is the output pin set as low?
129 pub fn is_set_low(&self) -> bool { 129 pub fn is_set_low(&self) -> bool {
130 // todo 130 // Reading from SIO: GPIO_OUT gives the last value written.
131 true 131 let val = 1 << self.pin.pin();
132 unsafe { (self.pin.sio_out().value().read() & val) == 0 }
132 } 133 }
133} 134}
134 135