diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/schedule.rs | 6 | ||||
-rw-r--r-- | examples/spawn.rs | 4 | ||||
-rw-r--r-- | examples/spawn2.rs | 10 |
3 files changed, 12 insertions, 8 deletions
diff --git a/examples/schedule.rs b/examples/schedule.rs index 7e6adc1a..fa67a566 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -13,7 +13,7 @@ use rtic::cyccnt::{Instant, U32Ext as _}; // NOTE: does NOT work on QEMU! #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] mod app { - #[init(schedule = [foo, bar])] + #[init()] fn init(mut cx: init::Context) -> init::LateResources { // Initialize (enable) the monotonic timer (CYCCNT) cx.core.DCB.enable_trace(); @@ -28,10 +28,10 @@ mod app { hprintln!("init @ {:?}", now).unwrap(); // Schedule `foo` to run 8e6 cycles (clock cycles) in the future - cx.schedule.foo(now + 8_000_000.cycles()).unwrap(); + foo::schedule(now + 8_000_000.cycles()).unwrap(); // Schedule `bar` to run 4e6 cycles in the future - cx.schedule.bar(now + 4_000_000.cycles()).unwrap(); + bar::schedule(now + 4_000_000.cycles()).unwrap(); init::LateResources {} } diff --git a/examples/spawn.rs b/examples/spawn.rs index 62635632..23fa1788 100644 --- a/examples/spawn.rs +++ b/examples/spawn.rs @@ -11,8 +11,10 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { #[init(spawn = [foo])] - fn init(_c: init::Context) { + fn init(_c: init::Context) -> init::LateResources { foo::spawn(1, 2).unwrap(); + + init::LateResources {} } #[task()] diff --git a/examples/spawn2.rs b/examples/spawn2.rs index 07ed53a4..2998d16c 100644 --- a/examples/spawn2.rs +++ b/examples/spawn2.rs @@ -10,12 +10,14 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { - #[init(spawn = [foo, foo2])] - fn init(_c: init::Context) { + #[init] + fn init(_c: init::Context) -> init::LateResources { foo::spawn(1, 2).unwrap(); + + init::LateResources {} } - #[task()] + #[task] fn foo(_c: foo::Context, x: i32, y: u32) { hprintln!("foo {}, {}", x, y).unwrap(); if x == 2 { @@ -24,7 +26,7 @@ mod app { foo2::spawn(2).unwrap(); } - #[task()] + #[task] fn foo2(_c: foo2::Context, x: i32) { hprintln!("foo2 {}", x).unwrap(); foo::spawn(x, 0).unwrap(); |