diff options
author | 2019-07-10 22:42:44 +0200 | |
---|---|---|
committer | 2019-07-10 22:42:44 +0200 | |
commit | 9195038c87703fc94b6e99f6de593886d51c2b19 (patch) | |
tree | 56855952357fe5bb689504ed8a6348dc3c1f3718 /examples/cfg.rs | |
parent | 14d63f496118f4243f28ddf3218523aa36a80322 (diff) | |
download | rtic-9195038c87703fc94b6e99f6de593886d51c2b19.tar.gz rtic-9195038c87703fc94b6e99f6de593886d51c2b19.tar.zst rtic-9195038c87703fc94b6e99f6de593886d51c2b19.zip |
implement RFC #212
Diffstat (limited to 'examples/cfg.rs')
-rw-r--r-- | examples/cfg.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/cfg.rs b/examples/cfg.rs index b1f65cfd..fb812cb0 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -11,25 +11,28 @@ use panic_semihosting as _; #[rtfm::app(device = lm3s6965)] const APP: () = { - #[cfg(debug_assertions)] // <- `true` when using the `dev` profile - static mut COUNT: u32 = 0; + struct Resources { + #[cfg(debug_assertions)] // <- `true` when using the `dev` profile + #[init(0)] + count: u32, + } #[init] fn init(_: init::Context) { // .. } - #[task(priority = 3, resources = [COUNT], spawn = [log])] + #[task(priority = 3, resources = [count], spawn = [log])] fn foo(_c: foo::Context) { #[cfg(debug_assertions)] { - *_c.resources.COUNT += 1; + *_c.resources.count += 1; - _c.spawn.log(*_c.resources.COUNT).ok(); + _c.spawn.log(*_c.resources.count).ok(); } // this wouldn't compile in `release` mode - // *resources.COUNT += 1; + // *resources.count += 1; // .. } |