diff options
| author | Sebastian Goll <[email protected]> | 2023-09-19 23:23:14 +0200 |
|---|---|---|
| committer | Sebastian Goll <[email protected]> | 2023-09-20 00:03:39 +0200 |
| commit | 2405aff11f466d1c3fc07bca70c07d11fc96c3be (patch) | |
| tree | 48b08c7fe2833966a922c01d8960eae3709cd6e2 /embassy-stm32/src/exti.rs | |
| parent | c573959a956802eb177d04fa5b7802397af19f93 (diff) | |
Add get_level() to ExtiInput
Diffstat (limited to 'embassy-stm32/src/exti.rs')
| -rw-r--r-- | embassy-stm32/src/exti.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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}; | |||
| 6 | use embassy_hal_internal::impl_peripheral; | 6 | use embassy_hal_internal::impl_peripheral; |
| 7 | use embassy_sync::waitqueue::AtomicWaker; | 7 | use embassy_sync::waitqueue::AtomicWaker; |
| 8 | 8 | ||
| 9 | use crate::gpio::{AnyPin, Input, Pin as GpioPin}; | 9 | use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin}; |
| 10 | use crate::pac::exti::regs::Lines; | 10 | use crate::pac::exti::regs::Lines; |
| 11 | use crate::pac::EXTI; | 11 | use crate::pac::EXTI; |
| 12 | use crate::{interrupt, pac, peripherals, Peripheral}; | 12 | use crate::{interrupt, pac, peripherals, Peripheral}; |
| @@ -101,6 +101,10 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> { | |||
| 101 | self.pin.is_low() | 101 | self.pin.is_low() |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | pub fn get_level(&self) -> Level { | ||
| 105 | self.pin.get_level() | ||
| 106 | } | ||
| 107 | |||
| 104 | pub async fn wait_for_high<'a>(&'a mut self) { | 108 | pub async fn wait_for_high<'a>(&'a mut self) { |
| 105 | let fut = ExtiInputFuture::new(self.pin.pin.pin.pin(), self.pin.pin.pin.port(), true, false); | 109 | let fut = ExtiInputFuture::new(self.pin.pin.pin.pin(), self.pin.pin.pin.port(), true, false); |
| 106 | if self.is_high() { | 110 | if self.is_high() { |
