Attribute Macro spawner
#[spawner]
Expand description
Registers a non-async function for autostart.
The function is provided with:
- a
Spawner
as first parameter, - a peripheral struct, as optional second parameter.
The peripheral struct must be defined with the ariel_os::hal::define_peripherals!
macro.
See task
to use a long-lived async function instead.
§Parameters
autostart
: (mandatory) run the task at startup.peripherals
: (optional) provide the function with a peripheral struct as the second parameter.
§Examples
ⓘ
use ariel_os::asynch::Spawner;
#[ariel_os::spawner(autostart, peripherals)]
fn spawner(spawner: Spawner, peripherals: /* your peripheral type */) {}
See Ariel OS examples for more.
§Panics
This macro panics when the ariel-os
crate cannot be found as a dependency of the crate where
this macro is used.