aboutsummaryrefslogtreecommitdiff
path: root/examples/lock.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2019-04-21 20:10:40 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2019-05-01 20:49:25 +0200
commit1b4b006bab7ee05e403a4fc48ae751d037f95b1a (patch)
tree62d7e7ebf3f8fc6fff10cf92cb1623a025163006 /examples/lock.rs
parenta452700628e352e6ac01da9e16223a47752ca860 (diff)
downloadrtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.tar.gz
rtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.tar.zst
rtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.zip
update examples
Diffstat (limited to 'examples/lock.rs')
-rw-r--r--examples/lock.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/lock.rs b/examples/lock.rs
index 4ca862e3..814c7364 100644
--- a/examples/lock.rs
+++ b/examples/lock.rs
@@ -9,24 +9,23 @@ extern crate panic_semihosting;
use cortex_m_semihosting::{debug, hprintln};
use lm3s6965::Interrupt;
-use rtfm::app;
-#[app(device = lm3s6965)]
+#[rtfm::app(device = lm3s6965)]
const APP: () = {
static mut SHARED: u32 = 0;
#[init]
- fn init() {
+ fn init(_: init::Context) {
rtfm::pend(Interrupt::GPIOA);
}
// when omitted priority is assumed to be `1`
#[interrupt(resources = [SHARED])]
- fn GPIOA() {
+ fn GPIOA(mut c: GPIOA::Context) {
hprintln!("A").unwrap();
// the lower priority task requires a critical section to access the data
- resources.SHARED.lock(|shared| {
+ c.resources.SHARED.lock(|shared| {
// data can only be modified within this critical section (closure)
*shared += 1;
@@ -47,15 +46,15 @@ const APP: () = {
}
#[interrupt(priority = 2, resources = [SHARED])]
- fn GPIOB() {
+ fn GPIOB(mut c: GPIOB::Context) {
// the higher priority task does *not* need a critical section
- *resources.SHARED += 1;
+ *c.resources.SHARED += 1;
- hprintln!("D - SHARED = {}", *resources.SHARED).unwrap();
+ hprintln!("D - SHARED = {}", *c.resources.SHARED).unwrap();
}
#[interrupt(priority = 3)]
- fn GPIOC() {
+ fn GPIOC(_: GPIOC::Context) {
hprintln!("C").unwrap();
}
};