diff options
| author | Ulf Lilleengen <[email protected]> | 2021-06-08 13:10:40 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-06-08 17:20:29 +0200 |
| commit | ed29d820719a18afd708e2a54585425ab70db82e (patch) | |
| tree | e6bcac82e41e57d5265a2fa59530fe60c20c834c | |
| parent | 212bda09406923b22cf5b5ed70cd8dbf7f9a7f3f (diff) | |
Use critical_section
| -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 | ||
