diff options
Diffstat (limited to 'examples/resource.rs')
-rw-r--r-- | examples/resource.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/resource.rs b/examples/resource.rs index ded97f8e..273af26a 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -10,7 +10,8 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { // A resource #[init(0)] @@ -18,9 +19,11 @@ const APP: () = { } #[init] - fn init(_: init::Context) { + fn init(_: init::Context) -> init::LateResources { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); + + init::LateResources {} } // `shared` cannot be accessed from this context @@ -31,7 +34,9 @@ const APP: () = { // error: no `resources` field in `idle::Context` // _cx.resources.shared += 1; - loop {} + loop { + cortex_m::asm::nop(); + } } // `shared` can be accessed from this context @@ -50,4 +55,4 @@ const APP: () = { hprintln!("UART1: shared = {}", cx.resources.shared).unwrap(); } -}; +} |