From 2405aff11f466d1c3fc07bca70c07d11fc96c3be Mon Sep 17 00:00:00 2001 From: Sebastian Goll Date: Tue, 19 Sep 2023 23:23:14 +0200 Subject: [PATCH] Add get_level() to ExtiInput --- embassy-stm32/src/exti.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index bd4bab1f8..efa51fb24 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -6,7 +6,7 @@ use core::task::{Context, Poll}; use embassy_hal_internal::impl_peripheral; use embassy_sync::waitqueue::AtomicWaker; -use crate::gpio::{AnyPin, Input, Pin as GpioPin}; +use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin}; use crate::pac::exti::regs::Lines; use crate::pac::EXTI; use crate::{interrupt, pac, peripherals, Peripheral}; @@ -101,6 +101,10 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> { self.pin.is_low() } + pub fn get_level(&self) -> Level { + self.pin.get_level() + } + pub async fn wait_for_high<'a>(&'a mut self) { let fut = ExtiInputFuture::new(self.pin.pin.pin.pin(), self.pin.pin.pin.port(), true, false); if self.is_high() {