blob: 90a9560c2ba8cfbb617bb13cfa3631d4e1a232ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#![deny(warnings)]
#![feature(const_fn)]
#![feature(proc_macro)]
#![no_std]
#[macro_use(task)]
extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx;
use rtfm::{app, Threshold};
app! {
device: stm32f103xx,
tasks: {
EXTI0: {
enabled: true,
priority: 1,
},
}
}
fn init(_p: init::Peripherals) {}
fn idle() -> ! {
loop {}
}
task!(EXTI0, exti0, Old {
static TOKEN: Option<Threshold> = None;
});
fn exti0(nt: &mut Threshold, old: &mut Old, _r: EXTI0::Resources) {
if let Some(ot) = old.TOKEN.take() {
let _: (Threshold, Threshold) = (*nt, ot);
//~^ error cannot move out of borrowed content
return
}
// ERROR can't store a threshold token in a local variable, otherwise you
// would end up with two threshold tokens in a task (see `if let` above)
*old.TOKEN = Some(*nt);
//~^ error cannot move out of borrowed content
}
|