aboutsummaryrefslogtreecommitdiff
path: root/examples/generics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/generics.rs')
-rw-r--r--examples/generics.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/generics.rs b/examples/generics.rs
index 40ab81ac..3107dd11 100644
--- a/examples/generics.rs
+++ b/examples/generics.rs
@@ -11,16 +11,19 @@ use panic_semihosting as _;
use rtic::{Exclusive, Mutex};
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod app {
+ #[resources]
struct Resources {
#[init(0)]
shared: u32,
}
#[init]
- fn init(_: init::Context) {
+ fn init(_: init::Context) -> init::LateResources {
rtic::pend(Interrupt::UART0);
rtic::pend(Interrupt::UART1);
+
+ init::LateResources {}
}
#[task(binds = UART0, resources = [shared])]
@@ -49,7 +52,7 @@ const APP: () = {
// second argument has type `Exclusive<u32>`
advance(STATE, Exclusive(c.resources.shared));
}
-};
+}
// the second parameter is generic: it can be any type that implements the `Mutex` trait
fn advance(state: &mut u32, mut shared: impl Mutex<T = u32>) {