aboutsummaryrefslogtreecommitdiff
path: root/examples/shared-with-init.rs
diff options
context:
space:
mode:
authorGravatar Daniel Carosone <Daniel.Carosone@gmail.com> 2020-10-07 09:22:38 +1100
committerGravatar Daniel Carosone <Daniel.Carosone@gmail.com> 2020-10-07 09:22:38 +1100
commitf386cb63cb6d3cd6642debfb4dc1bde97b325550 (patch)
tree30b21968997f809dbbba59117db93254607fa22d /examples/shared-with-init.rs
parent3d6a0ea64fb2661ee1150a84425f50c18c2de9ad (diff)
parentb1e1abae29591e50ebf345a2bd249a73e564cea9 (diff)
downloadrtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.tar.gz
rtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.tar.zst
rtic-f386cb63cb6d3cd6642debfb4dc1bde97b325550.zip
Merge branch 'master'
of https://github.com/rtic-rs/cortex-m-rtic
Diffstat (limited to 'examples/shared-with-init.rs')
-rw-r--r--examples/shared-with-init.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs
index bd55f7ef..85c72761 100644
--- a/examples/shared-with-init.rs
+++ b/examples/shared-with-init.rs
@@ -13,19 +13,24 @@ use rtic::app;
pub struct MustBeSend;
#[app(device = lm3s6965)]
-const APP: () = {
+mod app {
+ use super::MustBeSend;
+
+ #[resources]
struct Resources {
#[init(None)]
shared: Option<MustBeSend>,
}
#[init(resources = [shared])]
- fn init(c: init::Context) {
+ fn init(c: init::Context) -> init::LateResources {
// this `message` will be sent to task `UART0`
let message = MustBeSend;
*c.resources.shared = Some(message);
rtic::pend(Interrupt::UART0);
+
+ init::LateResources {}
}
#[task(binds = UART0, resources = [shared])]
@@ -37,4 +42,4 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS);
}
}
-};
+}