aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/late.rs5
-rw-r--r--examples/singleton.rs6
-rw-r--r--examples/static.rs4
3 files changed, 8 insertions, 7 deletions
diff --git a/examples/late.rs b/examples/late.rs
index be656408..622008a7 100644
--- a/examples/late.rs
+++ b/examples/late.rs
@@ -22,7 +22,7 @@ const APP: () = {
static mut C: Consumer<'static, u32, U4> = ();
#[init]
- fn init() {
+ fn init() -> 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;
@@ -31,8 +31,7 @@ const APP: () = {
let (p, c) = Q.as_mut().unwrap().split();
// Initialization of late resources
- P = p;
- C = c;
+ init::LateResources { P: p, C: c }
}
#[idle(resources = [C])]
diff --git a/examples/singleton.rs b/examples/singleton.rs
index 79815e88..9e48e541 100644
--- a/examples/singleton.rs
+++ b/examples/singleton.rs
@@ -20,10 +20,12 @@ const APP: () = {
static mut P: Pool<M> = ();
#[init(resources = [M])]
- fn init() {
+ fn init() -> init::LateResources {
rtfm::pend(Interrupt::I2C0);
- P = Pool::new(resources.M);
+ init::LateResources {
+ P: Pool::new(resources.M),
+ }
}
#[interrupt(
diff --git a/examples/static.rs b/examples/static.rs
index d40fdb1a..0309b681 100644
--- a/examples/static.rs
+++ b/examples/static.rs
@@ -16,11 +16,11 @@ const APP: () = {
static KEY: u32 = ();
#[init]
- fn init() {
+ fn init() -> init::LateResources {
rtfm::pend(Interrupt::UART0);
rtfm::pend(Interrupt::UART1);
- KEY = 0xdeadbeef;
+ init::LateResources { KEY: 0xdeadbeef }
}
#[interrupt(resources = [KEY])]