aboutsummaryrefslogtreecommitdiff
path: root/tests/stm32/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stm32/src')
-rw-r--r--tests/stm32/src/bin/stop.rs33
1 files changed, 23 insertions, 10 deletions
diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs
index f60ab271a..48d59b794 100644
--- a/tests/stm32/src/bin/stop.rs
+++ b/tests/stm32/src/bin/stop.rs
@@ -19,14 +19,32 @@ use static_cell::make_static;
19 19
20#[entry] 20#[entry]
21fn main() -> ! { 21fn main() -> ! {
22 let executor = Executor::take(); 22 Executor::take().run(|spawner| {
23 executor.run(|spawner| {
24 unwrap!(spawner.spawn(async_main(spawner))); 23 unwrap!(spawner.spawn(async_main(spawner)));
25 }); 24 });
26} 25}
27 26
28#[embassy_executor::task] 27#[embassy_executor::task]
29async fn async_main(_spawner: Spawner) { 28async fn task_1() {
29 for _ in 0..9 {
30 info!("task 1: waiting for 500ms...");
31 Timer::after(Duration::from_millis(500)).await;
32 }
33}
34
35#[embassy_executor::task]
36async fn task_2() {
37 for _ in 0..5 {
38 info!("task 2: waiting for 1000ms...");
39 Timer::after(Duration::from_millis(1000)).await;
40 }
41
42 info!("Test OK");
43 cortex_m::asm::bkpt();
44}
45
46#[embassy_executor::task]
47async fn async_main(spawner: Spawner) {
30 let mut config = config(); 48 let mut config = config();
31 49
32 config.rcc.lse = Some(Hertz(32_768)); 50 config.rcc.lse = Some(Hertz(32_768));
@@ -48,11 +66,6 @@ async fn async_main(_spawner: Spawner) {
48 66
49 stop_with_rtc(rtc); 67 stop_with_rtc(rtc);
50 68
51 info!("Waiting..."); 69 spawner.spawn(task_1()).unwrap();
52 Timer::after(Duration::from_secs(2)).await; 70 spawner.spawn(task_2()).unwrap();
53 info!("Waiting...");
54 Timer::after(Duration::from_secs(3)).await;
55
56 info!("Test OK");
57 cortex_m::asm::bkpt();
58} 71}