diff options
author | 2021-09-22 13:22:45 +0200 | |
---|---|---|
committer | 2021-09-23 16:11:04 +0200 | |
commit | b71df58f2fb4ed85d4c8cf806d5837ce63c73f31 (patch) | |
tree | de4cbe4b43d399d4dcf2021c33225ccd00627434 /examples/only-shared-access.rs | |
parent | c8621d78b9b1c0c67dff31404ade873a9d7b426e (diff) | |
download | rtic-b71df58f2fb4ed85d4c8cf806d5837ce63c73f31.tar.gz rtic-b71df58f2fb4ed85d4c8cf806d5837ce63c73f31.tar.zst rtic-b71df58f2fb4ed85d4c8cf806d5837ce63c73f31.zip |
The great docs update
Diffstat (limited to 'examples/only-shared-access.rs')
-rw-r--r-- | examples/only-shared-access.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index e3f1dbd3..8b0a77ef 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -1,4 +1,4 @@ -//! examples/static.rs +//! examples/only-shared-access.rs #![deny(unsafe_code)] #![deny(warnings)] @@ -7,10 +7,9 @@ use panic_semihosting as _; -#[rtic::app(device = lm3s6965)] +#[rtic::app(device = lm3s6965, dispatchers = [UART0, UART1])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use lm3s6965::Interrupt; #[shared] struct Shared { @@ -22,22 +21,22 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - rtic::pend(Interrupt::UART0); - rtic::pend(Interrupt::UART1); + foo::spawn().unwrap(); + bar::spawn().unwrap(); (Shared { key: 0xdeadbeef }, Local {}, init::Monotonics()) } - #[task(binds = UART0, shared = [&key])] - fn uart0(cx: uart0::Context) { + #[task(shared = [&key])] + fn foo(cx: foo::Context) { let key: &u32 = cx.shared.key; - hprintln!("UART0(key = {:#x})", key).unwrap(); + hprintln!("foo(key = {:#x})", key).unwrap(); - debug::exit(debug::EXIT_SUCCESS); + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } - #[task(binds = UART1, priority = 2, shared = [&key])] - fn uart1(cx: uart1::Context) { - hprintln!("UART1(key = {:#x})", cx.shared.key).unwrap(); + #[task(priority = 2, shared = [&key])] + fn bar(cx: bar::Context) { + hprintln!("bar(key = {:#x})", cx.shared.key).unwrap(); } } |