Skip to content

Commit 8584422

Browse files
committed
Demarcate a bit more
1 parent da095bd commit 8584422

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

book/en/src/by-example/app.md

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ At compile time the task/resource model is analyzed under the Stack Resource Pol
3030

3131
Overall, the generated code infers no additional overhead in comparison to a hand-written implementation, thus in Rust terms RTIC offers a zero-cost abstraction to concurrency.
3232

33+
## Priority
34+
35+
Priorities in RTIC are specified using the `priority = N` (where N is a positive number) argument passed to the `#[task]` attribute. All `#[task]`s can have a priority. If the priority of a task is not specified, it is set to the default value of 1.
36+
37+
Priorities in RTIC follow a higher value = more important scheme. For examples, a task with priority 2 will preempt a task with priority 1.
38+
3339
## An RTIC application example
3440

3541
To give a taste of RTIC, the following example contains commonly used features.

book/en/src/by-example/software_tasks.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Software tasks & spawn
22

3-
The RTIC concept of a software task shares a lot with that of [hardware tasks](./hardware_tasks.md) with the core difference that a software task is not explicitly bound to a specific
4-
interrupt vector, but rather bound to a “dispatcher” interrupt vector running at the intended priority of the software task (see below).
3+
The RTIC concept of a software task shares a lot with that of [hardware tasks](./hardware_tasks.md). The core difference is that a software task is not explicitly bound to a specific interrupt vector, but rather bound to a “dispatcher” interrupt vector running at the intended priority of the software task (see below).
54

65
Similarly to *hardware* tasks, the `#[task]` attribute used on a function declare it as a task. The absence of a `binds = InterruptName` argument to the attribute declares the function as a *software task*.
76

87
The static method `task_name::spawn()` spawns (starts) a software task and given that there are no higher priority tasks running the task will start executing directly.
98

109
The *software* task itself is given as an `async` Rust function, which allows the user to optionally `await` future events. This allows to blend reactive programming (by means of *hardware* tasks) with sequential programming (by means of *software* tasks).
1110

12-
Whereas, *hardware* tasks are assumed to run-to-completion (and return), *software* tasks may be started (`spawned`) once and run forever, with the side condition that any loop (execution path) is broken by at least one `await` (yielding operation).
11+
While *hardware* tasks are assumed to run-to-completion (and return), *software* tasks may be started (`spawned`) once and run forever, on the condition that any loop (execution path) is broken by at least one `await` (yielding operation).
1312

14-
All *software* tasks at the same priority level shares an interrupt handler acting as an async executor dispatching the software tasks.
13+
## Dispatchers
1514

16-
This list of dispatchers, `dispatchers = [FreeInterrupt1, FreeInterrupt2, ...]` is an argument to the `#[app]` attribute, where you define the set of free and usable interrupts.
15+
All *software* tasks at the same priority level share an interrupt handler acting as an async executor dispatching the software tasks. This list of dispatchers, `dispatchers = [FreeInterrupt1, FreeInterrupt2, ...]` is an argument to the `#[app]` attribute, where you define the set of free and usable interrupts.
1716

1817
Each interrupt vector acting as dispatcher gets assigned to one priority level meaning that the list of dispatchers need to cover all priority levels used by software tasks.
1918

0 commit comments

Comments
 (0)