mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
55 lines
1.3 KiB
Rust
55 lines
1.3 KiB
Rust
|
//! 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();
|
||
|
}
|
||
|
};
|