aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/exti.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32/src/exti.rs')
-rw-r--r--embassy-stm32/src/exti.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs
index 376fdccb8..bc4ecd1cc 100644
--- a/embassy-stm32/src/exti.rs
+++ b/embassy-stm32/src/exti.rs
@@ -8,7 +8,7 @@ use core::task::{Context, Poll};
8use embassy_hal_internal::{impl_peripheral, PeripheralType}; 8use embassy_hal_internal::{impl_peripheral, PeripheralType};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin, Pull}; 11use crate::gpio::{AnyPin, Input, Level, Pin as GpioPin, PinNumber, Pull};
12use crate::pac::exti::regs::Lines; 12use crate::pac::exti::regs::Lines;
13use crate::pac::EXTI; 13use crate::pac::EXTI;
14use crate::{interrupt, pac, peripherals, Peri}; 14use crate::{interrupt, pac, peripherals, Peri};
@@ -226,12 +226,12 @@ impl<'d> embedded_hal_async::digital::Wait for ExtiInput<'d> {
226 226
227#[must_use = "futures do nothing unless you `.await` or poll them"] 227#[must_use = "futures do nothing unless you `.await` or poll them"]
228struct ExtiInputFuture<'a> { 228struct ExtiInputFuture<'a> {
229 pin: u8, 229 pin: PinNumber,
230 phantom: PhantomData<&'a mut AnyPin>, 230 phantom: PhantomData<&'a mut AnyPin>,
231} 231}
232 232
233impl<'a> ExtiInputFuture<'a> { 233impl<'a> ExtiInputFuture<'a> {
234 fn new(pin: u8, port: u8, rising: bool, falling: bool) -> Self { 234 fn new(pin: PinNumber, port: PinNumber, rising: bool, falling: bool) -> Self {
235 critical_section::with(|_| { 235 critical_section::with(|_| {
236 let pin = pin as usize; 236 let pin = pin as usize;
237 exticr_regs().exticr(pin / 4).modify(|w| w.set_exti(pin % 4, port)); 237 exticr_regs().exticr(pin / 4).modify(|w| w.set_exti(pin % 4, port));
@@ -334,20 +334,20 @@ trait SealedChannel {}
334#[allow(private_bounds)] 334#[allow(private_bounds)]
335pub trait Channel: PeripheralType + SealedChannel + Sized { 335pub trait Channel: PeripheralType + SealedChannel + Sized {
336 /// Get the EXTI channel number. 336 /// Get the EXTI channel number.
337 fn number(&self) -> u8; 337 fn number(&self) -> PinNumber;
338} 338}
339 339
340/// Type-erased EXTI channel. 340/// Type-erased EXTI channel.
341/// 341///
342/// This represents ownership over any EXTI channel, known at runtime. 342/// This represents ownership over any EXTI channel, known at runtime.
343pub struct AnyChannel { 343pub struct AnyChannel {
344 number: u8, 344 number: PinNumber,
345} 345}
346 346
347impl_peripheral!(AnyChannel); 347impl_peripheral!(AnyChannel);
348impl SealedChannel for AnyChannel {} 348impl SealedChannel for AnyChannel {}
349impl Channel for AnyChannel { 349impl Channel for AnyChannel {
350 fn number(&self) -> u8 { 350 fn number(&self) -> PinNumber {
351 self.number 351 self.number
352 } 352 }
353} 353}
@@ -356,7 +356,7 @@ macro_rules! impl_exti {
356 ($type:ident, $number:expr) => { 356 ($type:ident, $number:expr) => {
357 impl SealedChannel for peripherals::$type {} 357 impl SealedChannel for peripherals::$type {}
358 impl Channel for peripherals::$type { 358 impl Channel for peripherals::$type {
359 fn number(&self) -> u8 { 359 fn number(&self) -> PinNumber {
360 $number 360 $number
361 } 361 }
362 } 362 }
@@ -364,7 +364,7 @@ macro_rules! impl_exti {
364 impl From<peripherals::$type> for AnyChannel { 364 impl From<peripherals::$type> for AnyChannel {
365 fn from(val: peripherals::$type) -> Self { 365 fn from(val: peripherals::$type) -> Self {
366 Self { 366 Self {
367 number: val.number() as u8, 367 number: val.number() as PinNumber,
368 } 368 }
369 } 369 }
370 } 370 }