aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/en/src/by-example/app.md8
-rw-r--r--ci/expected/preempt.run10
-rw-r--r--examples/preempt.rs28
3 files changed, 23 insertions, 23 deletions
diff --git a/book/en/src/by-example/app.md b/book/en/src/by-example/app.md
index aafc0b52..02c49b15 100644
--- a/book/en/src/by-example/app.md
+++ b/book/en/src/by-example/app.md
@@ -138,10 +138,10 @@ The following example showcases the priority based scheduling of tasks.
$ cargo run --example interrupt
{{#include ../../../../ci/expected/preempt.run}}```
-Note that the task `uart1` does *not* preempt task `uart2` because its priority
-is the *same* as `uart2`'s. However, once `uart2` terminates the execution of
-task `uart1` is prioritized over `uart0`'s due to its higher priority. `uart0`
-is resumed only after `uart1` terminates.
+Note that the task `gpiob` does *not* preempt task `gpioc` because its priority
+is the *same* as `gpioc`'s. However, once `gpioc` terminates the execution of
+task `gpiob` is prioritized over `gpioa`'s due to its higher priority. `gpioa`
+is resumed only after `gpiob` terminates.
One more note about priorities: choosing a priority higher than what the device
supports (that is `1 << NVIC_PRIO_BITS`) will result in a compile error. Due to
diff --git a/ci/expected/preempt.run b/ci/expected/preempt.run
index 732353a7..87777410 100644
--- a/ci/expected/preempt.run
+++ b/ci/expected/preempt.run
@@ -1,5 +1,5 @@
-UART0 - start
- UART2 - start
- UART2 - end
- UART1
-UART0 - end
+GPIOA - start
+ GPIOC - start
+ GPIOC - end
+ GPIOB
+GPIOA - end
diff --git a/examples/preempt.rs b/examples/preempt.rs
index 9f1b2a5c..d7a7e644 100644
--- a/examples/preempt.rs
+++ b/examples/preempt.rs
@@ -12,26 +12,26 @@ use rtfm::app;
const APP: () = {
#[init]
fn init(_: init::Context) {
- rtfm::pend(Interrupt::UART0);
+ rtfm::pend(Interrupt::GPIOA);
}
- #[task(binds = UART0, priority = 1)]
- fn uart0(_: uart0::Context) {
- hprintln!("UART0 - start").unwrap();
- rtfm::pend(Interrupt::UART2);
- hprintln!("UART0 - end").unwrap();
+ #[task(binds = GPIOA, priority = 1)]
+ fn gpioa(_: gpioa::Context) {
+ hprintln!("GPIOA - start").unwrap();
+ rtfm::pend(Interrupt::GPIOC);
+ hprintln!("GPIOA - end").unwrap();
debug::exit(debug::EXIT_SUCCESS);
}
- #[task(binds = UART1, priority = 2)]
- fn uart1(_: uart1::Context) {
- hprintln!(" UART1").unwrap();
+ #[task(binds = GPIOB, priority = 2)]
+ fn gpiob(_: gpiob::Context) {
+ hprintln!(" GPIOB").unwrap();
}
- #[task(binds = UART2, priority = 2)]
- fn uart2(_: uart2::Context) {
- hprintln!(" UART2 - start").unwrap();
- rtfm::pend(Interrupt::UART1);
- hprintln!(" UART2 - end").unwrap();
+ #[task(binds = GPIOC, priority = 2)]
+ fn gpioc(_: gpioc::Context) {
+ hprintln!(" GPIOC - start").unwrap();
+ rtfm::pend(Interrupt::GPIOB);
+ hprintln!(" GPIOC - end").unwrap();
}
};