aboutsummaryrefslogtreecommitdiff
path: root/examples/late.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/late.rs
parenta452700628e352e6ac01da9e16223a47752ca860 (diff)
downloadrtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.tar.gz
rtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.tar.zst
rtic-1b4b006bab7ee05e403a4fc48ae751d037f95b1a.zip
update examples
Diffstat (limited to 'examples/late.rs')
-rw-r--r--examples/late.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/late.rs b/examples/late.rs
index 622008a7..0074fb32 100644
--- a/examples/late.rs
+++ b/examples/late.rs
@@ -13,16 +13,15 @@ use heapless::{
spsc::{Consumer, Producer, Queue},
};
use lm3s6965::Interrupt;
-use rtfm::app;
-#[app(device = lm3s6965)]
+#[rtfm::app(device = lm3s6965)]
const APP: () = {
// Late resources
static mut P: Producer<'static, u32, U4> = ();
static mut C: Consumer<'static, u32, U4> = ();
#[init]
- fn init() -> init::LateResources {
+ fn init(_: init::Context) -> init::LateResources {
// NOTE: we use `Option` here to work around the lack of
// a stable `const` constructor
static mut Q: Option<Queue<u32, U4>> = None;
@@ -35,9 +34,9 @@ const APP: () = {
}
#[idle(resources = [C])]
- fn idle() -> ! {
+ fn idle(c: idle::Context) -> ! {
loop {
- if let Some(byte) = resources.C.dequeue() {
+ if let Some(byte) = c.resources.C.dequeue() {
hprintln!("received message: {}", byte).unwrap();
debug::exit(debug::EXIT_SUCCESS);
@@ -48,7 +47,7 @@ const APP: () = {
}
#[interrupt(resources = [P])]
- fn UART0() {
- resources.P.enqueue(42).unwrap();
+ fn UART0(c: UART0::Context) {
+ c.resources.P.enqueue(42).unwrap();
}
};