From 18c38bfbb939e4a65717c9ddbbbce45af72fc42a Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Sat, 23 Dec 2023 18:39:20 +0200 Subject: [PATCH] fix: gpio mutability of Pin Signed-off-by: Lachezar Lechev --- esp-hal-common/src/gpio.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/esp-hal-common/src/gpio.rs b/esp-hal-common/src/gpio.rs index dcaf8dc086a..8cb7e36c3d7 100644 --- a/esp-hal-common/src/gpio.rs +++ b/esp-hal-common/src/gpio.rs @@ -569,10 +569,10 @@ impl embedded_hal_1::digital::InputPin for GpioPin Result { + fn is_high(&mut self) -> Result { Ok(::Bank::read_input() & (1 << (GPIONUM % 32)) != 0) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(!self.is_high()?) } } @@ -583,10 +583,10 @@ where Self: GpioProperties, ::PinType: IsOutputPin, { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { Ok(::Bank::read_input() & (1 << (GPIONUM % 32)) != 0) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { Ok(!self.is_high()?) } } @@ -918,10 +918,10 @@ where Self: GpioProperties, ::PinType: IsOutputPin, { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { Ok(::Bank::read_output() & (1 << (GPIONUM % 32)) != 0) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { Ok(!self.is_set_high()?) } } @@ -1376,12 +1376,12 @@ impl embedded_hal_1::digital::ErrorType for AnyPin> { #[cfg(feature = "eh1")] impl embedded_hal_1::digital::InputPin for AnyPin> { - fn is_high(&self) -> Result { + fn is_high(&mut self) -> Result { let inner = &self.inner; handle_gpio_input!(inner, target, { target.is_high() }) } - fn is_low(&self) -> Result { + fn is_low(&mut self) -> Result { let inner = &self.inner; handle_gpio_input!(inner, target, { target.is_low() }) } @@ -1442,12 +1442,12 @@ impl embedded_hal_1::digital::OutputPin for AnyPin> { #[cfg(feature = "eh1")] impl embedded_hal_1::digital::StatefulOutputPin for AnyPin> { - fn is_set_high(&self) -> Result { + fn is_set_high(&mut self) -> Result { let inner = &self.inner; handle_gpio_output!(inner, target, { target.is_set_high() }) } - fn is_set_low(&self) -> Result { + fn is_set_low(&mut self) -> Result { let inner = &self.inner; handle_gpio_output!(inner, target, { target.is_set_low() }) }