diff options
author | 2019-07-10 22:42:44 +0200 | |
---|---|---|
committer | 2019-07-10 22:42:44 +0200 | |
commit | 9195038c87703fc94b6e99f6de593886d51c2b19 (patch) | |
tree | 56855952357fe5bb689504ed8a6348dc3c1f3718 /examples/late.rs | |
parent | 14d63f496118f4243f28ddf3218523aa36a80322 (diff) | |
download | rtic-9195038c87703fc94b6e99f6de593886d51c2b19.tar.gz rtic-9195038c87703fc94b6e99f6de593886d51c2b19.tar.zst rtic-9195038c87703fc94b6e99f6de593886d51c2b19.zip |
implement RFC #212
Diffstat (limited to 'examples/late.rs')
-rw-r--r-- | examples/late.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/late.rs b/examples/late.rs index 19807ff7..536d71aa 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -16,9 +16,9 @@ use panic_semihosting as _; #[rtfm::app(device = lm3s6965)] const APP: () = { // Late resources - extern "C" { - static mut P: Producer<'static, u32, U4>; - static mut C: Consumer<'static, u32, U4>; + struct Resources { + p: Producer<'static, u32, U4>, + c: Consumer<'static, u32, U4>, } #[init] @@ -31,13 +31,13 @@ const APP: () = { let (p, c) = Q.as_mut().unwrap().split(); // Initialization of late resources - init::LateResources { P: p, C: c } + init::LateResources { p, c } } - #[idle(resources = [C])] + #[idle(resources = [c])] fn idle(c: idle::Context) -> ! { loop { - if let Some(byte) = c.resources.C.dequeue() { + if let Some(byte) = c.resources.c.dequeue() { hprintln!("received message: {}", byte).unwrap(); debug::exit(debug::EXIT_SUCCESS); @@ -47,8 +47,8 @@ const APP: () = { } } - #[task(binds = UART0, resources = [P])] + #[task(binds = UART0, resources = [p])] fn uart0(c: uart0::Context) { - c.resources.P.enqueue(42).unwrap(); + c.resources.p.enqueue(42).unwrap(); } }; |