Add get_level() to ExtiInput

This commit is contained in:
Sebastian Goll 2023-09-19 23:23:14 +02:00
parent c573959a95
commit 2405aff11f

View File

@ -6,7 +6,7 @@ use core::task::{Context, Poll};
use embassy_hal_internal::impl_peripheral; use embassy_hal_internal::impl_peripheral;
use embassy_sync::waitqueue::AtomicWaker; 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::regs::Lines;
use crate::pac::EXTI; use crate::pac::EXTI;
use crate::{interrupt, pac, peripherals, Peripheral}; use crate::{interrupt, pac, peripherals, Peripheral};
@ -101,6 +101,10 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> {
self.pin.is_low() self.pin.is_low()
} }
pub fn get_level(&self) -> Level {
self.pin.get_level()
}
pub async fn wait_for_high<'a>(&'a mut self) { 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); let fut = ExtiInputFuture::new(self.pin.pin.pin.pin(), self.pin.pin.pin.port(), true, false);
if self.is_high() { if self.is_high() {