diff options
Diffstat (limited to 'examples/message.rs')
-rw-r--r-- | examples/message.rs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/examples/message.rs b/examples/message.rs index b5d68a60..f9736728 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -5,47 +5,50 @@ #![no_main] #![no_std] -extern crate panic_semihosting; - use cortex_m_semihosting::{debug, hprintln}; -use rtfm::app; +use panic_semihosting as _; -#[app(device = lm3s6965)] -const APP: () = { +#[rtic::app(device = lm3s6965)] +mod app { #[init(spawn = [foo])] - fn init() { - spawn.foo(/* no message */).unwrap(); + fn init(c: init::Context) -> init::LateResources { + c.spawn.foo(/* no message */).unwrap(); + + init::LateResources {} } #[task(spawn = [bar])] - fn foo() { + fn foo(c: foo::Context) { static mut COUNT: u32 = 0; hprintln!("foo").unwrap(); - spawn.bar(*COUNT).unwrap(); + c.spawn.bar(*COUNT).unwrap(); *COUNT += 1; } #[task(spawn = [baz])] - fn bar(x: u32) { + fn bar(c: bar::Context, x: u32) { hprintln!("bar({})", x).unwrap(); - spawn.baz(x + 1, x + 2).unwrap(); + c.spawn.baz(x + 1, x + 2).unwrap(); } #[task(spawn = [foo])] - fn baz(x: u32, y: u32) { + fn baz(c: baz::Context, x: u32, y: u32) { hprintln!("baz({}, {})", x, y).unwrap(); if x + y > 4 { debug::exit(debug::EXIT_SUCCESS); } - spawn.foo().unwrap(); + c.spawn.foo().unwrap(); } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } -}; +} |