rtic/ui/single/resources-cfg.rs

80 lines
1.5 KiB
Rust
Raw Permalink Normal View History

#![no_main]
use panic_halt as _;
2020-06-11 19:18:29 +02:00
#[rtic::app(device = lm3s6965)]
2020-05-19 20:00:13 +02:00
mod app {
2020-06-04 17:33:35 +02:00
#[resources]
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])]
2020-10-01 20:14:07 +02:00
fn init(c: init::Context) -> init::LateResources {
2019-07-10 22:42:44 +02:00
c.resources.o1;
c.resources.o4;
c.resources.o5;
c.resources.o6;
c.resources.s3;
2020-10-01 20:14:07 +02:00
init::LateResources {}
}
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;
}
}