mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 12:42:52 +01:00
17 lines
615 B
Markdown
17 lines
615 B
Markdown
|
# Software tasks & spawn
|
||
|
|
||
|
To declare tasks in the framework the `#[task]` attribute is used on a function.
|
||
|
By default these tasks are referred to as software tasks as they do not have a direct coupling to
|
||
|
an interrupt handler. Software tasks can be spawned (started) using the `task_name::spawn()` static
|
||
|
method which will directly run the task given that there are no higher priority tasks running.
|
||
|
This is exemplified in the following:
|
||
|
|
||
|
``` rust
|
||
|
{{#include ../../../../examples/spawn.rs}}
|
||
|
```
|
||
|
|
||
|
``` console
|
||
|
$ cargo run --target thumbv7m-none-eabi --example spawn
|
||
|
{{#include ../../../../ci/expected/spawn.run}}
|
||
|
```
|