stm32: Allow for RccPeripheral without reset field
This fix build on F0, since it doesn't have DMARST. This change makes RccPeripheral::reset a no-op on peripherals where a reset field couldn't be found
This commit is contained in:
@ -177,7 +177,7 @@ pub(crate) unsafe fn init() {
|
||||
}
|
||||
pac::peripherals! {
|
||||
(bdma, $peri:ident) => {
|
||||
crate::peripherals::$peri::enable();
|
||||
<crate::peripherals::$peri as RccPeripheral>::enable();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +121,35 @@ crate::pac::peripheral_rcc!(
|
||||
}
|
||||
}
|
||||
|
||||
impl RccPeripheral for peripherals::$inst {}
|
||||
};
|
||||
($inst:ident, $clk:ident, $enable:ident, $perien:ident) => {
|
||||
impl sealed::RccPeripheral for peripherals::$inst {
|
||||
fn frequency() -> crate::time::Hertz {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
let freqs = get_freqs();
|
||||
freqs.$clk
|
||||
}
|
||||
})
|
||||
}
|
||||
fn enable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(true));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn disable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn reset() {}
|
||||
}
|
||||
|
||||
impl RccPeripheral for peripherals::$inst {}
|
||||
};
|
||||
);
|
||||
|
Reference in New Issue
Block a user