add helper to translate return values from io setup to udma clock channels

this allows us to tease out the clock setting code from the pin
setting code. probably will need to add more helpers for other
peripherals as we continue through with this exercise.
This commit is contained in:
bunnie 2024-10-01 23:13:08 +08:00
parent 45d9487c70
commit 81637f119b

View file

@ -52,6 +52,18 @@ pub enum PeriphId {
impl Into<u32> for PeriphId {
fn into(self) -> u32 { self as u32 }
}
impl From<SpimChannel> for PeriphId {
fn from(value: SpimChannel) -> Self {
match value {
SpimChannel::Channel0 => PeriphId::Spim0,
SpimChannel::Channel1 => PeriphId::Spim1,
SpimChannel::Channel2 => PeriphId::Spim2,
SpimChannel::Channel3 => PeriphId::Spim3,
}
}
}
#[repr(u32)]
#[derive(Copy, Clone)]
pub enum PeriphEventId {