mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 12:55:23 +01:00
implement RFC #212
This commit is contained in:
parent
14d63f4961
commit
9195038c87
25 changed files with 369 additions and 311 deletions
|
|
@ -2,56 +2,74 @@
|
|||
|
||||
#[rtfm::app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[cfg(never)]
|
||||
static mut O1: u32 = 0; // init
|
||||
#[cfg(never)]
|
||||
static mut O2: u32 = 0; // idle
|
||||
#[cfg(never)]
|
||||
static mut O3: u32 = 0; // EXTI0
|
||||
#[cfg(never)]
|
||||
static O4: u32 = 0; // idle
|
||||
#[cfg(never)]
|
||||
static O5: u32 = 0; // EXTI1
|
||||
#[cfg(never)]
|
||||
static O6: u32 = 0; // init
|
||||
struct Resources {
|
||||
#[cfg(never)]
|
||||
#[init(0)]
|
||||
o1: u32, // init
|
||||
|
||||
#[cfg(never)]
|
||||
static mut S1: u32 = 0; // idle & EXTI0
|
||||
#[cfg(never)]
|
||||
static mut S2: u32 = 0; // EXTI0 & EXTI1
|
||||
#[cfg(never)]
|
||||
static S3: u32 = 0;
|
||||
#[cfg(never)]
|
||||
#[init(0)]
|
||||
o2: u32, // idle
|
||||
|
||||
#[init(resources = [O1, O4, O5, O6, S3])]
|
||||
fn init(c: init::Context) {
|
||||
c.resources.O1;
|
||||
c.resources.O4;
|
||||
c.resources.O5;
|
||||
c.resources.O6;
|
||||
c.resources.S3;
|
||||
#[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,
|
||||
}
|
||||
|
||||
#[idle(resources = [O2, O4, S1, S3])]
|
||||
#[init(resources = [o1, o4, o5, o6, s3])]
|
||||
fn init(c: init::Context) {
|
||||
c.resources.o1;
|
||||
c.resources.o4;
|
||||
c.resources.o5;
|
||||
c.resources.o6;
|
||||
c.resources.s3;
|
||||
}
|
||||
|
||||
#[idle(resources = [o2, &o4, s1, &s3])]
|
||||
fn idle(c: idle::Context) -> ! {
|
||||
c.resources.O2;
|
||||
c.resources.O4;
|
||||
c.resources.S1;
|
||||
c.resources.S3;
|
||||
c.resources.o2;
|
||||
c.resources.o4;
|
||||
c.resources.s1;
|
||||
c.resources.s3;
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [O3, S1, S2, S3])]
|
||||
#[task(binds = UART0, resources = [o3, s1, s2, &s3])]
|
||||
fn uart0(c: uart0::Context) {
|
||||
c.resources.O3;
|
||||
c.resources.S1;
|
||||
c.resources.S2;
|
||||
c.resources.S3;
|
||||
c.resources.o3;
|
||||
c.resources.s1;
|
||||
c.resources.s2;
|
||||
c.resources.s3;
|
||||
}
|
||||
|
||||
#[task(binds = UART1, resources = [S2, O5])]
|
||||
#[task(binds = UART1, resources = [s2, &o5])]
|
||||
fn uart1(c: uart1::Context) {
|
||||
c.resources.S2;
|
||||
c.resources.O5;
|
||||
c.resources.s2;
|
||||
c.resources.o5;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,119 +1,119 @@
|
|||
error[E0609]: no field `O1` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:27:21
|
||||
error[E0609]: no field `o1` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:45:21
|
||||
|
|
||||
27 | c.resources.O1;
|
||||
45 | c.resources.o1;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O4` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:28:21
|
||||
|
|
||||
28 | c.resources.O4;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O5` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:29:21
|
||||
|
|
||||
29 | c.resources.O5;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O6` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:30:21
|
||||
|
|
||||
30 | c.resources.O6;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S3` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:31:21
|
||||
|
|
||||
31 | c.resources.S3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O2` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:36:21
|
||||
|
|
||||
36 | c.resources.O2;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O4` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:37:21
|
||||
|
|
||||
37 | c.resources.O4;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S1` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:38:21
|
||||
|
|
||||
38 | c.resources.S1;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S3` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:39:21
|
||||
|
|
||||
39 | c.resources.S3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O3` on type `uart0Resources<'_>`
|
||||
error[E0609]: no field `o4` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:46:21
|
||||
|
|
||||
46 | c.resources.O3;
|
||||
46 | c.resources.o4;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S1` on type `uart0Resources<'_>`
|
||||
error[E0609]: no field `o5` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:47:21
|
||||
|
|
||||
47 | c.resources.S1;
|
||||
47 | c.resources.o5;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S2` on type `uart0Resources<'_>`
|
||||
error[E0609]: no field `o6` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:48:21
|
||||
|
|
||||
48 | c.resources.S2;
|
||||
48 | c.resources.o6;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S3` on type `uart0Resources<'_>`
|
||||
error[E0609]: no field `s3` on type `initResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:49:21
|
||||
|
|
||||
49 | c.resources.S3;
|
||||
49 | c.resources.s3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `S2` on type `uart1Resources<'_>`
|
||||
error[E0609]: no field `o2` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:54:21
|
||||
|
|
||||
54 | c.resources.S2;
|
||||
54 | c.resources.o2;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `O5` on type `uart1Resources<'_>`
|
||||
error[E0609]: no field `o4` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:55:21
|
||||
|
|
||||
55 | c.resources.O5;
|
||||
55 | c.resources.o4;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s1` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:56:21
|
||||
|
|
||||
56 | c.resources.s1;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s3` on type `idleResources<'_>`
|
||||
--> $DIR/resources-cfg.rs:57:21
|
||||
|
|
||||
57 | c.resources.s3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `o3` on type `uart0Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:64:21
|
||||
|
|
||||
64 | c.resources.o3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s1` on type `uart0Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:65:21
|
||||
|
|
||||
65 | c.resources.s1;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s2` on type `uart0Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:66:21
|
||||
|
|
||||
66 | c.resources.s2;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s3` on type `uart0Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:67:21
|
||||
|
|
||||
67 | c.resources.s3;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `s2` on type `uart1Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:72:21
|
||||
|
|
||||
72 | c.resources.s2;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
||||
error[E0609]: no field `o5` on type `uart1Resources<'_>`
|
||||
--> $DIR/resources-cfg.rs:73:21
|
||||
|
|
||||
73 | c.resources.o5;
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `__marker__`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue