added explicit converters
This commit is contained in:
parent
38635d2767
commit
2b2c7c8d6c
@ -59,6 +59,7 @@
|
|||||||
use super::{
|
use super::{
|
||||||
pin::{FilterType, InterruptEdge, InterruptLevel, Pin, PinId, PinMode, PinState},
|
pin::{FilterType, InterruptEdge, InterruptLevel, Pin, PinId, PinMode, PinState},
|
||||||
reg::RegisterInterface,
|
reg::RegisterInterface,
|
||||||
|
InputDynPinAsync,
|
||||||
};
|
};
|
||||||
use crate::{clock::FilterClkSel, enable_interrupt, pac, FunSel, IrqCfg};
|
use crate::{clock::FilterClkSel, enable_interrupt, pac, FunSel, IrqCfg};
|
||||||
|
|
||||||
@ -529,6 +530,15 @@ impl DynPin {
|
|||||||
}
|
}
|
||||||
Err(InvalidPinTypeError)
|
Err(InvalidPinTypeError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convert the pin into an async pin. The pin can be converted back by calling
|
||||||
|
/// [InputDynPinAsync::release]
|
||||||
|
pub fn into_async_input(
|
||||||
|
self,
|
||||||
|
irq: crate::pac::Interrupt,
|
||||||
|
) -> Result<InputDynPinAsync, InvalidPinTypeError> {
|
||||||
|
InputDynPinAsync::new(self, irq)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
//! and [`StatefulOutputPin`].
|
//! and [`StatefulOutputPin`].
|
||||||
use super::dynpin::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
use super::dynpin::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
||||||
use super::reg::RegisterInterface;
|
use super::reg::RegisterInterface;
|
||||||
use super::DynPin;
|
use super::{DynPin, InputPinAsync};
|
||||||
use crate::{
|
use crate::{
|
||||||
pac::{Irqsel, Porta, Portb, Sysconfig},
|
pac::{Irqsel, Porta, Portb, Sysconfig},
|
||||||
typelevel::Sealed,
|
typelevel::Sealed,
|
||||||
@ -575,6 +575,12 @@ impl<P: AnyPin> AsMut<P> for SpecificPin<P> {
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
impl<I: PinId, C: InputConfig> Pin<I, Input<C>> {
|
impl<I: PinId, C: InputConfig> Pin<I, Input<C>> {
|
||||||
|
/// Convert the pin into an async pin. The pin can be converted back by calling
|
||||||
|
/// [InputPinAsync::release]
|
||||||
|
pub fn into_async_input(self, irq: crate::pac::Interrupt) -> InputPinAsync<I, C> {
|
||||||
|
InputPinAsync::new(self, irq)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn interrupt_edge(
|
pub fn interrupt_edge(
|
||||||
&mut self,
|
&mut self,
|
||||||
edge_type: InterruptEdge,
|
edge_type: InterruptEdge,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user