diff options
author | 2021-07-09 11:00:11 +0000 | |
---|---|---|
committer | 2021-07-09 11:00:11 +0000 | |
commit | e1a4d001f8e724596cd9de3e90698ce7de473b3f (patch) | |
tree | f7aac5eae4cc2e19cc06bfd6fa8dab843dcfb276 /examples/destructure.rs | |
parent | 13dc3992e616d817e38c167c4b47db816855f18b (diff) | |
parent | f3d9fd9b638a25b497e1ca02e7ce5de86c9fc1c9 (diff) | |
download | rtic-e1a4d001f8e724596cd9de3e90698ce7de473b3f.tar.gz rtic-e1a4d001f8e724596cd9de3e90698ce7de473b3f.tar.zst rtic-e1a4d001f8e724596cd9de3e90698ce7de473b3f.zip |
Merge #494
494: Resoures take 2 r=korken89 a=korken89
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'examples/destructure.rs')
-rw-r--r-- | examples/destructure.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/destructure.rs b/examples/destructure.rs index d085e4bf..984c9b8a 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -12,39 +12,39 @@ mod app { use cortex_m_semihosting::hprintln; use lm3s6965::Interrupt; - #[resources] - struct Resources { + #[shared] + struct Shared { // Some resources to work with - #[init(0)] a: u32, - #[init(0)] b: u32, - #[init(0)] c: u32, } + #[local] + struct Local {} + #[init] - fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - (init::LateResources {}, init::Monotonics()) + (Shared { a: 0, b: 0, c: 0 }, Local {}, init::Monotonics()) } // Direct destructure - #[task(binds = UART0, resources = [&a, &b, &c])] + #[task(binds = UART0, shared = [&a, &b, &c])] fn uart0(cx: uart0::Context) { - let a = cx.resources.a; - let b = cx.resources.b; - let c = cx.resources.c; + let a = cx.shared.a; + let b = cx.shared.b; + let c = cx.shared.c; hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap(); } // De-structure-ing syntax - #[task(binds = UART1, resources = [&a, &b, &c])] + #[task(binds = UART1, shared = [&a, &b, &c])] fn uart1(cx: uart1::Context) { - let uart1::Resources { a, b, c } = cx.resources; + let uart1::SharedResources { a, b, c } = cx.shared; hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap(); } |