aboutsummaryrefslogtreecommitdiff
path: root/tests/cfail/lock.rs
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2017-07-23 20:51:58 -0500
committerJorge Aparicio <jorge@japaric.io>2017-07-23 20:51:58 -0500
commit6ea9cda6635e7536523f3c6d3d217f7d474ae4a2 (patch)
treec5617f6b60531891231ba2b5b029f957562a085f /tests/cfail/lock.rs
parent05feb7b018817f88123900c9196e830d51608a5f (diff)
update cfail tests
Diffstat (limited to 'tests/cfail/lock.rs')
-rw-r--r--tests/cfail/lock.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/cfail/lock.rs b/tests/cfail/lock.rs
index 736027e..77310dd 100644
--- a/tests/cfail/lock.rs
+++ b/tests/cfail/lock.rs
@@ -1,19 +1,20 @@
#![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};
+use rtfm::{app, Resource, Threshold};
app! {
device: stm32f103xx,
resources: {
- STATE: bool = false;
- MAX: u8 = 0;
+ static STATE: bool = false;
+ static MAX: u8 = 0;
},
tasks: {
@@ -45,7 +46,7 @@ fn idle() -> ! {
task!(EXTI0, exti0);
-fn exti0(mut t: &mut Threshold, r: EXTI0::Resources) {
+fn exti0(mut t: &mut Threshold, mut r: EXTI0::Resources) {
// OK need to lock to access the resource
if r.STATE.claim(&mut t, |state, _| **state) {}
@@ -57,7 +58,7 @@ task!(EXTI1, exti1);
fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
// ERROR no need to lock. Has direct access because priority == ceiling
- if r.STATE.claim(&mut t, |state, _| **state) {
+ if (**r.STATE).claim(&mut t, |state, _| **state) {
//~^ error no method named `claim` found for type
}
@@ -65,3 +66,7 @@ fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
// OK
}
}
+
+task!(EXTI2, exti2);
+
+fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {}