mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 12:42:52 +01:00
25 lines
474 B
Rust
25 lines
474 B
Rust
|
#![no_main]
|
||
|
|
||
|
#[rtic::app(device = lm3s6965, dispatchers = [GPIOA])]
|
||
|
mod app {
|
||
|
#[shared]
|
||
|
struct Shared {
|
||
|
a: u32,
|
||
|
}
|
||
|
|
||
|
#[local]
|
||
|
struct Local {}
|
||
|
|
||
|
#[init]
|
||
|
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||
|
(Shared { a: 0 }, Local {}, init::Monotonics())
|
||
|
}
|
||
|
|
||
|
#[task(shared = [a])]
|
||
|
fn foo(mut c: foo::Context) {
|
||
|
c.shared.lock(|_| {
|
||
|
c.shared.a.lock(|_| {}); // borrow error
|
||
|
});
|
||
|
}
|
||
|
}
|