embassy_executor_macros

Attribute Macro main_spin

Source
#[main_spin]
Expand description

Creates a new executor instance and declares an architecture agnostic application entry point spawning the corresponding function body as an async task.

The following restrictions apply:

  • The function must accept exactly 1 parameter, an embassy_executor::Spawner handle that it can use to spawn additional tasks.
  • The function must be declared async.
  • The function must not use generics.
  • Only a single main task may be declared.

A user-defined entry macro must provided via the entry argument

ยงExamples

Spawning a task:

#[embassy_executor::main(entry = "qingke_rt::entry")]
async fn main(_s: embassy_executor::Spawner) {
    // Function body
}