Use critical_section
@@ -62,20 +62,26 @@ crate::pac::peripheral_rcc!(
($inst:ident, $enable:ident, $reset:ident, $perien:ident, $perirst:ident) => {
impl sealed::RccPeripheral for peripherals::$inst {
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() {
+ critical_section::with(|_| {
unsafe {
crate::pac::RCC.$reset().modify(|w| w.$perirst(true));
crate::pac::RCC.$reset().modify(|w| w.$perirst(false));
}
+ })
}
}
