diff options
| author | Daniel Bevenius <[email protected]> | 2022-05-11 18:26:25 +0200 |
|---|---|---|
| committer | Daniel Bevenius <[email protected]> | 2022-05-11 18:33:13 +0200 |
| commit | 0bb428dcc01a01f15459acb9ebed4e045448bf5d (patch) | |
| tree | ccc10c39edb6866b965fc509137ba874b7e5b7a9 | |
| parent | 6d4a49bca86415b88f282d084cfa4045c171e63a (diff) | |
squash! Implement Output::is_set_low for embassy-rp
Add check for the bit of the current pin.
| -rw-r--r-- | embassy-rp/src/gpio.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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> { | |||
| 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 | // Reading from SIO: GPIO_OUT gives the last value written. | 130 | // Reading from SIO: GPIO_OUT gives the last value written. |
| 131 | unsafe { self.pin.sio_out().value().read() == 0 } | 131 | let val = 1 << self.pin.pin(); |
| 132 | unsafe { (self.pin.sio_out().value().read() & val) == 0 } | ||
| 132 | } | 133 | } |
| 133 | } | 134 | } |
| 134 | 135 | ||
