Skip to content

Commit

Permalink
riot-rs-embassy: move starting of tasks to front
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Feb 19, 2024
1 parent 6cb3d66 commit 14520b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/riot-rs-embassy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) {
while clock.events_hfclkstarted.read().bits() != 1 {}
}

let spawner = Spawner::for_current_executor().await;

for task in EMBASSY_TASKS {
task(&spawner, &mut peripherals);
}

#[cfg(feature = "usb")]
let mut usb_builder = {
let usb_config = usb_config();
Expand Down Expand Up @@ -247,8 +253,6 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) {
)
};

let spawner = Spawner::for_current_executor().await;

#[cfg(feature = "usb")]
{
let usb = usb_builder.build();
Expand Down Expand Up @@ -309,10 +313,6 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) {
wifi::join(control).await;
};

for task in EMBASSY_TASKS {
task(&spawner, &mut peripherals);
}

// mark used
let _ = peripherals;

Expand Down

0 comments on commit 14520b7

Please sign in to comment.