diff options
Diffstat (limited to 'examples/not-sync.rs')
-rw-r--r-- | examples/not-sync.rs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/examples/not-sync.rs b/examples/not-sync.rs index d94e0a04..75412e63 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -5,37 +5,47 @@ #![no_main] #![no_std] -extern crate panic_halt; - use core::marker::PhantomData; use cortex_m_semihosting::debug; -use rtfm::app; +use panic_halt as _; pub struct NotSync { _0: PhantomData<*const ()>, } -#[app(device = lm3s6965)] -const APP: () = { - static SHARED: NotSync = NotSync { _0: PhantomData }; +#[rtic::app(device = lm3s6965)] +mod app { + use super::NotSync; + use core::marker::PhantomData; + + #[resources] + struct Resources { + #[init(NotSync { _0: PhantomData })] + shared: NotSync, + } #[init] - fn init() { + fn init(_: init::Context) -> init::LateResources { debug::exit(debug::EXIT_SUCCESS); + + init::LateResources {} } - #[task(resources = [SHARED])] - fn foo() { - let _: &NotSync = resources.SHARED; + #[task(resources = [&shared])] + fn foo(c: foo::Context) { + let _: &NotSync = c.resources.shared; } - #[task(resources = [SHARED])] - fn bar() { - let _: &NotSync = resources.SHARED; + #[task(resources = [&shared])] + fn bar(c: bar::Context) { + let _: &NotSync = c.resources.shared; } + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. extern "C" { - fn UART0(); + fn SSI0(); } -}; +} |