diff options
| author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-03 16:31:11 +0000 |
|---|---|---|
| committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-03 16:31:11 +0000 |
| commit | 777765e522949ebf84d05d4db075132172d81494 (patch) | |
| tree | 41bc00739da8f832eb5ba68ef99ec8b9d06111a4 /examples/types.rs | |
| parent | 653338e7997a0cdc5deaed98b1bb5f60006717ed (diff) | |
| parent | 3a867e70c3b1afc4943ec597e4f188432fba5a8b (diff) | |
Merge #97
97: v0.4.0 r=japaric a=japaric
closes #32
closes #33
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
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 0000000..6606208 --- /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(); + } +}; |
