Remove PeripheralRef::into_inner()

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 14:27:45 +02:00
parent a158295782
commit f02ba35482
11 changed files with 156 additions and 105 deletions

View File

@ -92,11 +92,11 @@ pub trait Channel: sealed::Channel + Peripheral<P = Self> + Sized {
fn number(&self) -> usize;
}
pub trait ConfigurableChannel: Channel {
pub trait ConfigurableChannel: Channel + Into<AnyConfigurableChannel> {
fn degrade(self) -> AnyConfigurableChannel;
}
pub trait StaticChannel: Channel {
pub trait StaticChannel: Channel + Into<AnyStaticChannel> {
fn degrade(self) -> AnyStaticChannel;
}
@ -167,6 +167,12 @@ macro_rules! impl_ppi_channel {
}
}
}
impl From<peripherals::$type> for crate::ppi::AnyStaticChannel {
fn from(val: peripherals::$type) -> Self {
crate::ppi::StaticChannel::degrade(val)
}
}
};
($type:ident, $number:expr => configurable) => {
impl_ppi_channel!($type, $number);
@ -178,6 +184,12 @@ macro_rules! impl_ppi_channel {
}
}
}
impl From<peripherals::$type> for crate::ppi::AnyConfigurableChannel {
fn from(val: peripherals::$type) -> Self {
crate::ppi::ConfigurableChannel::degrade(val)
}
}
};
}