Use critical_section
This commit is contained in:
parent
212bda0940
commit
ed29d82071
1 changed files with 16 additions and 10 deletions
|
@ -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() {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(true));
|
||||
}
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(true));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn disable() {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(false));
|
||||
}
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn reset() {
|
||||
unsafe {
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(true));
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(false));
|
||||
}
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(true));
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue