diff options
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index 6ad90eb82..3c5b53b05 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -62,20 +62,26 @@ crate::pac::peripheral_rcc!( | |||
| 62 | ($inst:ident, $enable:ident, $reset:ident, $perien:ident, $perirst:ident) => { | 62 | ($inst:ident, $enable:ident, $reset:ident, $perien:ident, $perirst:ident) => { |
| 63 | impl sealed::RccPeripheral for peripherals::$inst { | 63 | impl sealed::RccPeripheral for peripherals::$inst { |
| 64 | fn enable() { | 64 | fn enable() { |
| 65 | unsafe { | 65 | critical_section::with(|_| { |
| 66 | crate::pac::RCC.$enable().modify(|w| w.$perien(true)); | 66 | unsafe { |
| 67 | } | 67 | crate::pac::RCC.$enable().modify(|w| w.$perien(true)); |
| 68 | } | ||
| 69 | }) | ||
| 68 | } | 70 | } |
| 69 | fn disable() { | 71 | fn disable() { |
| 70 | unsafe { | 72 | critical_section::with(|_| { |
| 71 | crate::pac::RCC.$enable().modify(|w| w.$perien(false)); | 73 | unsafe { |
| 72 | } | 74 | crate::pac::RCC.$enable().modify(|w| w.$perien(false)); |
| 75 | } | ||
| 76 | }) | ||
| 73 | } | 77 | } |
| 74 | fn reset() { | 78 | fn reset() { |
| 75 | unsafe { | 79 | critical_section::with(|_| { |
| 76 | crate::pac::RCC.$reset().modify(|w| w.$perirst(true)); | 80 | unsafe { |
| 77 | crate::pac::RCC.$reset().modify(|w| w.$perirst(false)); | 81 | crate::pac::RCC.$reset().modify(|w| w.$perirst(true)); |
| 78 | } | 82 | crate::pac::RCC.$reset().modify(|w| w.$perirst(false)); |
| 83 | } | ||
| 84 | }) | ||
| 79 | } | 85 | } |
| 80 | } | 86 | } |
| 81 | 87 | ||
