diff options
| author | Dániel Buga <[email protected]> | 2024-11-19 15:59:31 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-11-19 16:25:17 +0100 |
| commit | 8ebe059ecb311ee949f92dde33f2cb8d972b0f7b (patch) | |
| tree | 4906d12e2a2f141dded4defd84650b165e2da51d /embassy-stm32 | |
| parent | ff02ee1a221122ede6e30a94156c42e22b400578 (diff) | |
Add initialize
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/low_power.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs index a779b8a09..d74221864 100644 --- a/embassy-stm32/src/low_power.rs +++ b/embassy-stm32/src/low_power.rs | |||
| @@ -155,7 +155,9 @@ impl Executor { | |||
| 155 | time_driver: get_driver(), | 155 | time_driver: get_driver(), |
| 156 | }); | 156 | }); |
| 157 | 157 | ||
| 158 | EXECUTOR.as_mut().unwrap() | 158 | let executor = EXECUTOR.as_mut().unwrap(); |
| 159 | |||
| 160 | executor | ||
| 159 | }) | 161 | }) |
| 160 | } | 162 | } |
| 161 | 163 | ||
| @@ -241,11 +243,15 @@ impl Executor { | |||
| 241 | /// | 243 | /// |
| 242 | /// This function never returns. | 244 | /// This function never returns. |
| 243 | pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { | 245 | pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { |
| 244 | init(unsafe { EXECUTOR.as_mut().unwrap() }.inner.spawner()); | 246 | let executor = unsafe { EXECUTOR.as_mut().unwrap() }; |
| 247 | unsafe { | ||
| 248 | executor.inner.initialize(); | ||
| 249 | } | ||
| 250 | init(executor.inner.spawner()); | ||
| 245 | 251 | ||
| 246 | loop { | 252 | loop { |
| 247 | unsafe { | 253 | unsafe { |
| 248 | EXECUTOR.as_mut().unwrap().inner.poll(); | 254 | executor.inner.poll(); |
| 249 | self.configure_pwr(); | 255 | self.configure_pwr(); |
| 250 | asm!("wfe"); | 256 | asm!("wfe"); |
| 251 | }; | 257 | }; |
