From 6d4a49bca86415b88f282d084cfa4045c171e63a Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 11 May 2022 16:23:31 +0200 Subject: [PATCH] Implement Output::is_set_low for embassy-rp This commit implements a suggestion for the method is_set_low which is currently a 'todo', by reading last value written to GPIO_OUT. --- embassy-rp/src/gpio.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 598759036..9cdba8bf3 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -127,8 +127,8 @@ 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. + unsafe { self.pin.sio_out().value().read() == 0 } } }