aboutsummaryrefslogtreecommitdiff
path: root/examples/task.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/task.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/task.rs b/examples/task.rs
index 4f168bb8..5bb32acb 100644
--- a/examples/task.rs
+++ b/examples/task.rs
@@ -8,38 +8,37 @@
extern crate panic_semihosting;
use cortex_m_semihosting::{debug, hprintln};
-use rtfm::app;
-#[app(device = lm3s6965)]
+#[rtfm::app(device = lm3s6965)]
const APP: () = {
#[init(spawn = [foo])]
- fn init() {
- spawn.foo().unwrap();
+ fn init(c: init::Context) {
+ c.spawn.foo().unwrap();
}
#[task(spawn = [bar, baz])]
- fn foo() {
+ fn foo(c: foo::Context) {
hprintln!("foo").unwrap();
// spawns `bar` onto the task scheduler
// `foo` and `bar` have the same priority so `bar` will not run until
// after `foo` terminates
- spawn.bar().unwrap();
+ c.spawn.bar().unwrap();
// spawns `baz` onto the task scheduler
// `baz` has higher priority than `foo` so it immediately preempts `foo`
- spawn.baz().unwrap();
+ c.spawn.baz().unwrap();
}
#[task]
- fn bar() {
+ fn bar(_: bar::Context) {
hprintln!("bar").unwrap();
debug::exit(debug::EXIT_SUCCESS);
}
#[task(priority = 2)]
- fn baz() {
+ fn baz(_: baz::Context) {
hprintln!("baz").unwrap();
}