diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-02-02 05:14:52 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-02-02 05:20:41 +0100 |
| commit | aeaa34d7a163b327643c08e299e1b40bb497c01c (patch) | |
| tree | 6054344c8a7d990b910416a1002aded9ad4d10eb /embassy-stm32f4-examples/src | |
| parent | d098952077b8fdc8426754151bb8064214a046fa (diff) | |
Executor API V2.
- It's no longer possible to call run() reentrantly from within a task (soundness issue)
- it's now possible to spawn Send tasks across threads (SendSpawner, #37)
Diffstat (limited to 'embassy-stm32f4-examples/src')
| -rw-r--r-- | embassy-stm32f4-examples/src/bin/exti.rs | 11 | ||||
| -rw-r--r-- | embassy-stm32f4-examples/src/bin/serial.rs | 11 |
2 files changed, 8 insertions, 14 deletions
diff --git a/embassy-stm32f4-examples/src/bin/exti.rs b/embassy-stm32f4-examples/src/bin/exti.rs index 879d0fa2a..ec4490b16 100644 --- a/embassy-stm32f4-examples/src/bin/exti.rs +++ b/embassy-stm32f4-examples/src/bin/exti.rs | |||
| @@ -49,11 +49,8 @@ fn main() -> ! { | |||
| 49 | let dp = stm32::Peripherals::take().unwrap(); | 49 | let dp = stm32::Peripherals::take().unwrap(); |
| 50 | let cp = cortex_m::peripheral::Peripherals::take().unwrap(); | 50 | let cp = cortex_m::peripheral::Peripherals::take().unwrap(); |
| 51 | 51 | ||
| 52 | let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev)); | 52 | let executor = EXECUTOR.put(Executor::new()); |
| 53 | executor.spawn(run(dp, cp)).unwrap(); | 53 | executor.run(|spawner| { |
| 54 | 54 | unwrap!(spawner.spawn(run(dp, cp))); | |
| 55 | loop { | 55 | }); |
| 56 | executor.run(); | ||
| 57 | //cortex_m::asm::wfe(); // wfe causes RTT to stop working on stm32 | ||
| 58 | } | ||
| 59 | } | 56 | } |
diff --git a/embassy-stm32f4-examples/src/bin/serial.rs b/embassy-stm32f4-examples/src/bin/serial.rs index 93c32b3f4..7338d4fe0 100644 --- a/embassy-stm32f4-examples/src/bin/serial.rs +++ b/embassy-stm32f4-examples/src/bin/serial.rs | |||
| @@ -59,11 +59,8 @@ fn main() -> ! { | |||
| 59 | let dp = stm32::Peripherals::take().unwrap(); | 59 | let dp = stm32::Peripherals::take().unwrap(); |
| 60 | let cp = cortex_m::peripheral::Peripherals::take().unwrap(); | 60 | let cp = cortex_m::peripheral::Peripherals::take().unwrap(); |
| 61 | 61 | ||
| 62 | let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev)); | 62 | let executor = EXECUTOR.put(Executor::new()); |
| 63 | executor.spawn(run(dp, cp)).unwrap(); | 63 | executor.run(|spawner| { |
| 64 | 64 | unwrap!(spawner.spawn(run(dp, cp))); | |
| 65 | loop { | 65 | }); |
| 66 | executor.run(); | ||
| 67 | //cortex_m::asm::wfe(); // wfe causes RTT to stop working on stm32 | ||
| 68 | } | ||
| 69 | } | 66 | } |
