nrf/ppi: add AnyConfigurableChannel
This commit is contained in:
parent
31b817ed27
commit
00e5f30352
@ -123,7 +123,13 @@ pub trait Channel: sealed::Channel + Sized {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub trait ConfigurableChannel: Channel + sealed::ConfigurableChannel {}
|
pub trait ConfigurableChannel: Channel + sealed::ConfigurableChannel {
|
||||||
|
fn degrade_configurable(self) -> AnyConfigurableChannel {
|
||||||
|
AnyConfigurableChannel {
|
||||||
|
number: self.number() as u8,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait Group: sealed::Group + Sized {
|
pub trait Group: sealed::Group + Sized {
|
||||||
fn number(&self) -> usize;
|
fn number(&self) -> usize;
|
||||||
@ -148,6 +154,19 @@ impl Channel for AnyChannel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct AnyConfigurableChannel {
|
||||||
|
number: u8,
|
||||||
|
}
|
||||||
|
impl_unborrow!(AnyConfigurableChannel);
|
||||||
|
impl sealed::Channel for AnyConfigurableChannel {}
|
||||||
|
impl sealed::ConfigurableChannel for AnyConfigurableChannel {}
|
||||||
|
impl ConfigurableChannel for AnyConfigurableChannel {}
|
||||||
|
impl Channel for AnyConfigurableChannel {
|
||||||
|
fn number(&self) -> usize {
|
||||||
|
self.number as usize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! impl_channel {
|
macro_rules! impl_channel {
|
||||||
($type:ident, $number:expr, configurable) => {
|
($type:ident, $number:expr, configurable) => {
|
||||||
impl_channel!($type, $number);
|
impl_channel!($type, $number);
|
||||||
|
Loading…
Reference in New Issue
Block a user