diff options
author | 2021-07-07 22:50:59 +0200 | |
---|---|---|
committer | 2021-07-07 23:07:09 +0200 | |
commit | 98d2af9d73da56910c8bb6cb662fbc4d609a704a (patch) | |
tree | 46914250a980b9164b2d20cbeb08e126a86cf7ea /examples/idle.rs | |
parent | 633012190baa0801efc7e3ab2f699778c5038d54 (diff) | |
download | rtic-98d2af9d73da56910c8bb6cb662fbc4d609a704a.tar.gz rtic-98d2af9d73da56910c8bb6cb662fbc4d609a704a.tar.zst rtic-98d2af9d73da56910c8bb6cb662fbc4d609a704a.zip |
Fixing tests
Diffstat (limited to 'examples/idle.rs')
-rw-r--r-- | examples/idle.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/examples/idle.rs b/examples/idle.rs index db03dc70..34c861b9 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -11,19 +11,23 @@ use panic_semihosting as _; mod app { use cortex_m_semihosting::{debug, hprintln}; + #[shared] + struct Shared {} + + #[local] + struct Local {} + #[init] - fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { hprintln!("init").unwrap(); - (init::LateResources {}, init::Monotonics()) + (Shared {}, Local {}, init::Monotonics()) } - #[idle] - fn idle(_: idle::Context) -> ! { - static mut X: u32 = 0; - - // Safe access to local `static mut` variable - let _x: &'static mut u32 = X; + #[idle(local = [x: u32 = 0])] + fn idle(cx: idle::Context) -> ! { + // Locals in idle have lifetime 'static + let _x: &'static mut u32 = cx.local.x; hprintln!("idle").unwrap(); |