aboutsummaryrefslogtreecommitdiff
path: root/examples/lock.rs
diff options
context:
space:
mode:
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();
}
};