aboutsummaryrefslogtreecommitdiff
path: root/examples/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/types.rs')
-rw-r--r--examples/types.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/types.rs b/examples/types.rs
index e14ab0c..251d004 100644
--- a/examples/types.rs
+++ b/examples/types.rs
@@ -10,14 +10,15 @@ use panic_semihosting as _;
use rtic::cyccnt;
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod app {
+ #[resources]
struct Resources {
#[init(0)]
shared: u32,
}
#[init(schedule = [foo], spawn = [foo])]
- fn init(cx: init::Context) {
+ fn init(cx: init::Context) -> init::LateResources {
let _: cyccnt::Instant = cx.start;
let _: rtic::Peripherals = cx.core;
let _: lm3s6965::Peripherals = cx.device;
@@ -25,6 +26,8 @@ const APP: () = {
let _: init::Spawn = cx.spawn;
debug::exit(debug::EXIT_SUCCESS);
+
+ init::LateResources {}
}
#[idle(schedule = [foo], spawn = [foo])]
@@ -32,7 +35,9 @@ const APP: () = {
let _: idle::Schedule = cx.schedule;
let _: idle::Spawn = cx.spawn;
- loop {}
+ loop {
+ cortex_m::asm::nop();
+ }
}
#[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])]
@@ -58,4 +63,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}