From 1b4b006bab7ee05e403a4fc48ae751d037f95b1a Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 21 Apr 2019 20:10:40 +0200 Subject: update examples --- examples/task.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'examples/task.rs') diff --git a/examples/task.rs b/examples/task.rs index 4f168bb..5bb32ac 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(); } -- cgit v1.2.3