From c631049efcadca8b07940c794cce2be58fa48444 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 3 Nov 2018 17:02:41 +0100 Subject: v0.4.0 closes #32 closes #33 --- examples/types.rs | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 examples/types.rs (limited to 'examples/types.rs') 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(); + } +}; -- cgit v1.2.3