diff options
author | 2018-11-03 17:02:41 +0100 | |
---|---|---|
committer | 2018-11-03 17:16:55 +0100 | |
commit | c631049efcadca8b07940c794cce2be58fa48444 (patch) | |
tree | f6bd73e5c396fc06072557ee965cc59e9c8e3e9f /examples/types.rs | |
parent | 653338e7997a0cdc5deaed98b1bb5f60006717ed (diff) | |
download | rtic-c631049efcadca8b07940c794cce2be58fa48444.tar.gz rtic-c631049efcadca8b07940c794cce2be58fa48444.tar.zst rtic-c631049efcadca8b07940c794cce2be58fa48444.zip |
v0.4.0
closes #32
closes #33
Diffstat (limited to 'examples/types.rs')
-rw-r--r-- | examples/types.rs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/examples/types.rs b/examples/types.rs new file mode 100644 index 00000000..66062085 --- /dev/null +++ b/examples/types.rs @@ -0,0 +1,54 @@ +//! examples/types.rs + +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +extern crate panic_semihosting; + +use cortex_m_semihosting::debug; +use rtfm::{app, Instant}; + +#[app(device = lm3s6965)] +const APP: () = { + static mut SHARED: u32 = 0; + + #[init(schedule = [foo], spawn = [foo])] + fn init() { + let _: Instant = start; + let _: rtfm::Peripherals = core; + let _: lm3s6965::Peripherals = device; + let _: init::Schedule = schedule; + let _: init::Spawn = spawn; + + debug::exit(debug::EXIT_SUCCESS); + } + + #[exception(schedule = [foo], spawn = [foo])] + fn SVCall() { + let _: Instant = start; + let _: SVCall::Schedule = schedule; + let _: SVCall::Spawn = spawn; + } + + #[interrupt(resources = [SHARED], schedule = [foo], spawn = [foo])] + fn UART0() { + let _: Instant = start; + let _: resources::SHARED = resources.SHARED; + let _: UART0::Schedule = schedule; + let _: UART0::Spawn = spawn; + } + + #[task(priority = 2, resources = [SHARED], schedule = [foo], spawn = [foo])] + fn foo() { + let _: Instant = scheduled; + let _: foo::Resources = resources; + let _: foo::Schedule = schedule; + let _: foo::Spawn = spawn; + } + + extern "C" { + fn UART1(); + } +}; |