rtic/ui/single/resources-cfg.rs

76 lines
1.4 KiB
Rust
Raw Permalink Normal View History

#![no_main]
#[rtfm::app(device = lm3s6965)]
const APP: () = {
2019-07-10 22:42:44 +02:00
struct Resources {
#[cfg(never)]
#[init(0)]
o1: u32, // init
#[cfg(never)]
#[init(0)]
o2: u32, // idle
#[cfg(never)]
#[init(0)]
o3: u32, // EXTI0
#[cfg(never)]
#[init(0)]
o4: u32, // idle
#[cfg(never)]
#[init(0)]
o5: u32, // EXTI1
#[cfg(never)]
#[init(0)]
o6: u32, // init
#[cfg(never)]
#[init(0)]
s1: u32, // idle & EXTI0
#[cfg(never)]
#[init(0)]
s2: u32, // EXTI0 & EXTI1
#[cfg(never)]
#[init(0)]
s3: u32,
}
#[init(resources = [o1, o4, o5, o6, s3])]
2019-04-21 20:20:15 +02:00
fn init(c: init::Context) {
2019-07-10 22:42:44 +02:00
c.resources.o1;
c.resources.o4;
c.resources.o5;
c.resources.o6;
c.resources.s3;
}
2019-07-10 22:42:44 +02:00
#[idle(resources = [o2, &o4, s1, &s3])]
2019-04-21 20:20:15 +02:00
fn idle(c: idle::Context) -> ! {
2019-07-10 22:42:44 +02:00
c.resources.o2;
c.resources.o4;
c.resources.s1;
c.resources.s3;
loop {}
}
2019-07-10 22:42:44 +02:00
#[task(binds = UART0, resources = [o3, s1, s2, &s3])]
2019-06-20 06:19:59 +02:00
fn uart0(c: uart0::Context) {
2019-07-10 22:42:44 +02:00
c.resources.o3;
c.resources.s1;
c.resources.s2;
c.resources.s3;
}
2019-07-10 22:42:44 +02:00
#[task(binds = UART1, resources = [s2, &o5])]
2019-06-20 06:19:59 +02:00
fn uart1(c: uart1::Context) {
2019-07-10 22:42:44 +02:00
c.resources.s2;
c.resources.o5;
}
};