diff options
| author | Emil Fresk <emil.fresk@gmail.com> | 2020-10-05 18:25:15 +0200 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2020-10-05 18:25:15 +0200 |
| commit | eec0908024d9b4127ed496b4781adc08000cc2c2 (patch) | |
| tree | f128b3d91ea4ac0f171ab334d4517552a6803d01 /examples | |
| parent | 9d2598dc071882a94b813ab1d9ddf49092546257 (diff) | |
| parent | f493f21359ccb3ab4643d9470f3581532f47593a (diff) | |
Merge branch 'master' into always_late_resources
Diffstat (limited to 'examples')
39 files changed, 188 insertions, 88 deletions
diff --git a/examples/baseline.rs b/examples/baseline.rs index 5a6dbd4..3ab40db 100644 --- a/examples/baseline.rs +++ b/examples/baseline.rs @@ -11,7 +11,7 @@ use panic_semihosting as _; // NOTE: does NOT properly work on QEMU #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { #[init(spawn = [foo])] fn init(cx: init::Context) -> init::LateResources { // omitted: initialization of `CYCCNT` @@ -53,4 +53,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/binds.rs b/examples/binds.rs index f3ce51e..42010ae 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -11,7 +11,7 @@ use panic_semihosting as _; // `examples/interrupt.rs` rewritten to use `binds` #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { rtic::pend(Interrupt::UART0); @@ -47,4 +47,4 @@ const APP: () = { ) .unwrap(); } -}; +} diff --git a/examples/capacity.rs b/examples/capacity.rs index cac0029..ba8b15b 100644 --- a/examples/capacity.rs +++ b/examples/capacity.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { rtic::pend(Interrupt::UART0); @@ -46,4 +46,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/cfg.rs b/examples/cfg.rs index 4f46724..d49f54c 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -11,7 +11,8 @@ use cortex_m_semihosting::hprintln; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { #[cfg(debug_assertions)] // <- `true` when using the `dev` profile #[init(0)] @@ -68,4 +69,4 @@ const APP: () = { fn SSI0(); fn QEI0(); } -}; +} diff --git a/examples/destructure.rs b/examples/destructure.rs index ad1d859..e7c5323 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -10,7 +10,8 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { // Some resources to work with #[init(0)] @@ -46,4 +47,4 @@ const APP: () = { hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap(); } -}; +} diff --git a/examples/double_schedule.rs b/examples/double_schedule.rs index 6b3aec8..b1b78b8 100644 --- a/examples/double_schedule.rs +++ b/examples/double_schedule.rs @@ -9,7 +9,9 @@ use panic_semihosting as _; use rtic::cyccnt::U32Ext; #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { + + #[resources] struct Resources { nothing: (), } @@ -34,4 +36,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/generics.rs b/examples/generics.rs index 65c5db0..3107dd1 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -11,7 +11,8 @@ use panic_semihosting as _; use rtic::{Exclusive, Mutex}; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { #[init(0)] shared: u32, @@ -51,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>) { diff --git a/examples/hardware.rs b/examples/hardware.rs index 30de77a..f6a2d37 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { // Pends the UART0 interrupt but its handler won't run until *after* @@ -51,4 +51,4 @@ const APP: () = { ) .unwrap(); } -}; +} diff --git a/examples/idle.rs b/examples/idle.rs index b029fca..58c3c87 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln}; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { hprintln!("init").unwrap(); @@ -32,4 +32,4 @@ const APP: () = { cortex_m::asm::nop(); } } -}; +} diff --git a/examples/init.rs b/examples/init.rs index d5cebba..6ac284a 100644 --- a/examples/init.rs +++ b/examples/init.rs @@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln}; use panic_semihosting as _; #[rtic::app(device = lm3s6965, peripherals = true)] -const APP: () = { +mod app { #[init] fn init(cx: init::Context) -> init::LateResources { static mut X: u32 = 0; @@ -23,10 +23,14 @@ const APP: () = { // Safe access to local `static mut` variable let _x: &'static mut u32 = X; + // Access to the critical section token, + // to indicate that this is a critical seciton + let _cs_token: bare_metal::CriticalSection = cx.cs; + hprintln!("init").unwrap(); debug::exit(debug::EXIT_SUCCESS); init::LateResources {} } -}; +} diff --git a/examples/late.rs b/examples/late.rs index 60b9be0..761c68f 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -15,8 +15,13 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + use heapless::{ + consts::*, + spsc::{Consumer, Producer}, + }; // Late resources + #[resources] struct Resources { p: Producer<'static, u32, U4>, c: Consumer<'static, u32, U4>, @@ -49,4 +54,4 @@ const APP: () = { fn uart0(c: uart0::Context) { c.resources.p.enqueue(42).unwrap(); } -}; +} diff --git a/examples/lock.rs b/examples/lock.rs index ff947c5..669b1ae 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -10,7 +10,8 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { #[init(0)] shared: u32, @@ -61,4 +62,4 @@ const APP: () = { fn gpioc(_: gpioc::Context) { hprintln!("C").unwrap(); } -}; +} diff --git a/examples/message.rs b/examples/message.rs index a1352c0..f973672 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln}; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init(spawn = [foo])] fn init(c: init::Context) -> init::LateResources { c.spawn.foo(/* no message */).unwrap(); @@ -51,4 +51,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/not-send.rs b/examples/not-send.rs index 999abfa..18071fc 100644 --- a/examples/not-send.rs +++ b/examples/not-send.rs @@ -16,7 +16,10 @@ pub struct NotSend { } #[app(device = lm3s6965)] -const APP: () = { +mod app { + use super::NotSend; + + #[resources] struct Resources { #[init(None)] shared: Option<NotSend>, @@ -62,4 +65,4 @@ const APP: () = { fn SSI0(); fn QEI0(); } -}; +} diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 5a67489..75412e6 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -15,7 +15,11 @@ pub struct NotSync { } #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + use super::NotSync; + use core::marker::PhantomData; + + #[resources] struct Resources { #[init(NotSync { _0: PhantomData })] shared: NotSync, @@ -44,4 +48,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index c022b03..91d0b7a 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -10,7 +10,8 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { key: u32, } @@ -35,4 +36,4 @@ const APP: () = { fn uart1(cx: uart1::Context) { hprintln!("UART1(key = {:#x})", cx.resources.key).unwrap(); } -}; +} diff --git a/examples/periodic.rs b/examples/periodic.rs index da56d46..d3aedd3 100644 --- a/examples/periodic.rs +++ b/examples/periodic.rs @@ -13,7 +13,8 @@ const PERIOD: u32 = 8_000_000; // NOTE: does NOT work on QEMU! #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { + #[init(schedule = [foo])] fn init(cx: init::Context) -> init::LateResources { // omitted: initialization of `CYCCNT` @@ -37,4 +38,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/peripherals-taken.rs b/examples/peripherals-taken.rs index 42ad8c0..09f9242 100644 --- a/examples/peripherals-taken.rs +++ b/examples/peripherals-taken.rs @@ -7,12 +7,12 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] - fn main(_: main::Context) -> main::LateResources { + fn init(_: init::Context) -> init::LateResources { assert!(cortex_m::Peripherals::take().is_none()); debug::exit(debug::EXIT_SUCCESS); - main::LateResources {} + init::LateResources {} } -}; +} diff --git a/examples/pool.rs b/examples/pool.rs index 9fccdf8..cdbabca 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -18,7 +18,12 @@ use rtic::app; pool!(P: [u8; 128]); #[app(device = lm3s6965)] -const APP: () = { +mod app { + use crate::Box; + + // Import the memory pool into scope + use super::P; + #[init] fn init(_: init::Context) -> init::LateResources { static mut MEMORY: [u8; 512] = [0; 512]; @@ -68,4 +73,4 @@ const APP: () = { fn SSI0(); fn QEI0(); } -}; +} diff --git a/examples/preempt.rs b/examples/preempt.rs index 7103b17..f6fc4b0 100644 --- a/examples/preempt.rs +++ b/examples/preempt.rs @@ -9,7 +9,7 @@ use panic_semihosting as _; use rtic::app; #[app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { rtic::pend(Interrupt::GPIOA); @@ -36,4 +36,4 @@ const APP: () = { rtic::pend(Interrupt::GPIOB); hprintln!(" GPIOC - end").unwrap(); } -}; +} diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs index 214b7e6..5ff167a 100644 --- a/examples/ramfunc.rs +++ b/examples/ramfunc.rs @@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln}; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init(spawn = [bar])] fn init(c: init::Context) -> init::LateResources { c.spawn.bar().unwrap(); @@ -40,4 +40,4 @@ const APP: () = { #[link_section = ".data.UART1"] fn UART1(); } -}; +} diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs new file mode 100644 index 0000000..a5bd0dd --- /dev/null +++ b/examples/resource-user-struct.rs @@ -0,0 +1,63 @@ +//! examples/resource.rs + +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +use cortex_m_semihosting::{debug, hprintln}; +use lm3s6965::Interrupt; +use panic_semihosting as _; + +#[rtic::app(device = lm3s6965)] +mod app { + #[resources] + struct Resources { + // A resource + #[init(0)] + shared: u32, + } + + // Should not collide with the struct above + #[allow(dead_code)] + struct Resources2 { + // A resource + shared: u32, + } + + #[init] + fn init(_: init::Context) -> init::LateResources { + rtic::pend(Interrupt::UART0); + rtic::pend(Interrupt::UART1); + + init::LateResources {} + } + + // `shared` cannot be accessed from this context + #[idle] + fn idle(_cx: idle::Context) -> ! { + debug::exit(debug::EXIT_SUCCESS); + + // error: no `resources` field in `idle::Context` + // _cx.resources.shared += 1; + + loop {} + } + + // `shared` can be accessed from this context + #[task(binds = UART0, resources = [shared])] + fn uart0(cx: uart0::Context) { + let shared: &mut u32 = cx.resources.shared; + *shared += 1; + + hprintln!("UART0: shared = {}", shared).unwrap(); + } + + // `shared` can be accessed from this context + #[task(binds = UART1, resources = [shared])] + fn uart1(cx: uart1::Context) { + *cx.resources.shared += 1; + + hprintln!("UART1: shared = {}", cx.resources.shared).unwrap(); + } +} diff --git a/examples/resource.rs b/examples/resource.rs index 06aa975..273af26 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -10,7 +10,8 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { // A resource #[init(0)] @@ -54,4 +55,4 @@ const APP: () = { hprintln!("UART1: shared = {}", cx.resources.shared).unwrap(); } -}; +} diff --git a/examples/schedule.rs b/examples/schedule.rs index b76d9e7..7e6adc1 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -12,7 +12,7 @@ use rtic::cyccnt::{Instant, U32Ext as _}; // NOTE: does NOT work on QEMU! #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { #[init(schedule = [foo, bar])] fn init(mut cx: init::Context) -> init::LateResources { // Initialize (enable) the monotonic timer (CYCCNT) @@ -52,4 +52,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs index fa900a2..85c7276 100644 --- a/examples/shared-with-init.rs +++ b/examples/shared-with-init.rs @@ -13,7 +13,10 @@ use rtic::app; pub struct MustBeSend; #[app(device = lm3s6965)] -const APP: () = { +mod app { + use super::MustBeSend; + + #[resources] struct Resources { #[init(None)] shared: Option<MustBeSend>, @@ -39,4 +42,4 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } } -}; +} diff --git a/examples/smallest.rs b/examples/smallest.rs index ec3fa97..b8cbf87 100644 --- a/examples/smallest.rs +++ b/examples/smallest.rs @@ -7,4 +7,4 @@ use panic_semihosting as _; // panic handler use rtic::app; #[app(device = lm3s6965)] -const APP: () = {}; +mod app {} diff --git a/examples/t-binds.rs b/examples/t-binds.rs index edf0fc6..3ca4c66 100644 --- a/examples/t-binds.rs +++ b/examples/t-binds.rs @@ -8,7 +8,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { init::LateResources {} @@ -25,7 +25,7 @@ const APP: () = { fn bar(c: bar::Context) { bar_trampoline(c) } -}; +} #[allow(dead_code)] fn foo_trampoline(_: foo::Context) {} diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs index 4f7fd63..61eb4c7 100644 --- a/examples/t-cfg-resources.rs +++ b/examples/t-cfg-resources.rs @@ -6,19 +6,17 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { // A resource #[init(0)] shared: u32, - // A conditionally compiled resource behind feature_x #[cfg(feature = "feature_x")] x: u32, - - dummy: (), + dummy: (), // dummy such that we have at least one late resource } - #[init] fn init(_: init::Context) -> init::LateResources { init::LateResources { @@ -35,4 +33,4 @@ const APP: () = { cortex_m::asm::nop(); } } -}; +} diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index 254cb8e..3da20d4 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -6,7 +6,8 @@ use panic_halt as _; #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { + #[resources] struct Resources { #[cfg(never)] #[init(0)] @@ -54,4 +55,4 @@ const APP: () = { fn SSI0(); fn QEI0(); } -}; +} diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs index 885019a..1e38e31 100644 --- a/examples/t-htask-main.rs +++ b/examples/t-htask-main.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { rtic::pend(lm3s6965::Interrupt::UART0); @@ -16,7 +16,7 @@ const APP: () = { } #[task(binds = UART0)] - fn main(_: main::Context) { + fn taskmain(_: taskmain::Context) { debug::exit(debug::EXIT_SUCCESS); } -}; +} diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs index 3e06cac..9078628 100644 --- a/examples/t-idle-main.rs +++ b/examples/t-idle-main.rs @@ -7,17 +7,17 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] fn init(_: init::Context) -> init::LateResources { init::LateResources {} } #[idle] - fn main(_: main::Context) -> ! { + fn taskmain(_: taskmain::Context) -> ! { debug::exit(debug::EXIT_SUCCESS); loop { cortex_m::asm::nop(); } } -}; +} diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs index f6c1d9c..7c23cc8 100644 --- a/examples/t-init-main.rs +++ b/examples/t-init-main.rs @@ -7,11 +7,11 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init] - fn main(_: main::Context) -> main::LateResources { + fn init(_: init::Context) -> init::LateResources { debug::exit(debug::EXIT_SUCCESS); - main::LateResources {} + init::LateResources {} } -}; +} diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index d2a9b63..345d9ae 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -12,7 +12,10 @@ pub struct NotSend { } #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + use super::NotSend; + + #[resources] struct Resources { x: NotSend, #[init(None)] @@ -35,4 +38,4 @@ const APP: () = { cortex_m::asm::nop(); } } -}; +} diff --git a/examples/t-resource.rs b/examples/t-resource.rs index 78e518c..91950d3 100644 --- a/examples/t-resource.rs +++ b/examples/t-resource.rs @@ -8,7 +8,8 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { + #[resources] struct Resources { #[init(0)] o1: u32, // init @@ -88,4 +89,4 @@ const APP: () = { // no `Mutex` proxy when co-owned by cooperative (same priority) tasks let _: &mut u32 = c.resources.s2; } -}; +} diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs index 8af01ab..d5a6d3f 100644 --- a/examples/t-schedule.rs +++ b/examples/t-schedule.rs @@ -9,7 +9,7 @@ use panic_halt as _; use rtic::cyccnt::{Instant, U32Ext as _}; #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -const APP: () = { +mod app { #[init(schedule = [foo, bar, baz])] fn init(c: init::Context) -> init::LateResources { let _: Result<(), ()> = c.schedule.foo(c.start + 10.cycles()); @@ -63,4 +63,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs index af2a79e..efb748b 100644 --- a/examples/t-spawn.rs +++ b/examples/t-spawn.rs @@ -8,7 +8,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init(spawn = [foo, bar, baz])] fn init(c: init::Context) -> init::LateResources { let _: Result<(), ()> = c.spawn.foo(); @@ -62,4 +62,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs index aefd482..74335c1 100644 --- a/examples/t-stask-main.rs +++ b/examples/t-stask-main.rs @@ -7,16 +7,16 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { - #[init(spawn = [main])] +mod app { + #[init(spawn = [taskmain])] fn init(cx: init::Context) -> init::LateResources { - cx.spawn.main().ok(); + cx.spawn.taskmain().ok(); init::LateResources {} } #[task] - fn main(_: main::Context) { + fn taskmain(_: taskmain::Context) { debug::exit(debug::EXIT_SUCCESS); } @@ -26,4 +26,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} diff --git a/examples/task.rs b/examples/task.rs index e148b35..80a9c43 100644 --- a/examples/task.rs +++ b/examples/task.rs @@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln}; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -const APP: () = { +mod app { #[init(spawn = [foo])] fn init(c: init::Context) -> init::LateResources { c.spawn.foo().unwrap(); @@ -54,4 +54,4 @@ const APP: () = { fn SSI0(); fn QEI0(); } -}; +} diff --git a/examples/types.rs b/examples/types.rs index 46d08b8..251d004 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -10,7 +10,8 @@ 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, @@ -62,4 +63,4 @@ const APP: () = { extern "C" { fn SSI0(); } -}; +} |
