From 8df2ec11b0ee3209678dcc1b1a5baa479fa1dfe5 Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Wed, 22 Apr 2020 10:58:14 +0000 Subject: Examples using mod instead of const --- examples/shared-with-init.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/shared-with-init.rs') diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs index bd55f7ef..03391bdd 100644 --- a/examples/shared-with-init.rs +++ b/examples/shared-with-init.rs @@ -13,7 +13,7 @@ use rtic::app; pub struct MustBeSend; #[app(device = lm3s6965)] -const APP: () = { +mod APP { struct Resources { #[init(None)] shared: Option, @@ -37,4 +37,4 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); } } -}; +} -- cgit v1.2.3 From 5cfd9b92384a6e2d352e35de9da1b7a2b53cc2ea Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Tue, 19 May 2020 18:00:13 +0000 Subject: Modules using lower-case in examples --- examples/baseline.rs | 2 +- examples/binds.rs | 2 +- examples/capacity.rs | 2 +- examples/cfg.rs | 2 +- examples/destructure.rs | 2 +- examples/generics.rs | 2 +- examples/hardware.rs | 2 +- examples/idle.rs | 2 +- examples/init.rs | 2 +- examples/late.rs | 2 +- examples/lock.rs | 2 +- examples/message.rs | 2 +- examples/not-send.rs | 2 +- examples/not-sync.rs | 2 +- examples/only-shared-access.rs | 2 +- examples/periodic.rs | 3 ++- examples/peripherals-taken.rs | 2 +- examples/pool.rs | 5 ++++- examples/preempt.rs | 2 +- examples/ramfunc.rs | 2 +- examples/resource.rs | 2 +- examples/schedule.rs | 2 +- examples/shared-with-init.rs | 2 +- examples/smallest.rs | 2 +- examples/t-binds.rs | 2 +- examples/t-cfg-resources.rs | 3 +-- examples/t-cfg.rs | 2 +- examples/t-htask-main.rs | 2 +- examples/t-idle-main.rs | 2 +- examples/t-init-main.rs | 2 +- examples/t-late-not-send.rs | 2 +- examples/t-resource.rs | 2 +- examples/t-schedule.rs | 2 +- examples/t-spawn.rs | 2 +- examples/t-stask-main.rs | 2 +- examples/task.rs | 2 +- examples/types.rs | 2 +- ui/single/exception-invalid.rs | 2 +- ui/single/exception-systick-used.rs | 2 +- ui/single/extern-interrupt-not-enough.rs | 2 +- ui/single/extern-interrupt-used.rs | 2 +- ui/single/locals-cfg.rs | 2 +- ui/single/resources-cfg.rs | 2 +- ui/single/task-priority-too-high.rs | 2 +- 44 files changed, 48 insertions(+), 45 deletions(-) (limited to 'examples/shared-with-init.rs') diff --git a/examples/baseline.rs b/examples/baseline.rs index 2d75dfaa..e517bf08 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)] -mod APP { +mod app { #[init(spawn = [foo])] fn init(cx: init::Context) { // omitted: initialization of `CYCCNT` diff --git a/examples/binds.rs b/examples/binds.rs index 920124cf..9c73433b 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)] -mod APP { +mod app { #[init] fn init(_: init::Context) { rtic::pend(Interrupt::UART0); diff --git a/examples/capacity.rs b/examples/capacity.rs index 26c61a25..7ccb086a 100644 --- a/examples/capacity.rs +++ b/examples/capacity.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) { rtic::pend(Interrupt::UART0); diff --git a/examples/cfg.rs b/examples/cfg.rs index 626181de..16e6e077 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -11,7 +11,7 @@ use cortex_m_semihosting::hprintln; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[cfg(debug_assertions)] // <- `true` when using the `dev` profile #[init(0)] diff --git a/examples/destructure.rs b/examples/destructure.rs index da0a4c1d..131c07fb 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { // Some resources to work with #[init(0)] diff --git a/examples/generics.rs b/examples/generics.rs index b67ed9ca..20e9ed7f 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -11,7 +11,7 @@ use panic_semihosting as _; use rtic::{Exclusive, Mutex}; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(0)] shared: u32, diff --git a/examples/hardware.rs b/examples/hardware.rs index 7926650c..831b029c 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) { // Pends the UART0 interrupt but its handler won't run until *after* diff --git a/examples/idle.rs b/examples/idle.rs index dbf7f983..0db05459 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)] -mod APP { +mod app { #[init] fn init(_: init::Context) { hprintln!("init").unwrap(); diff --git a/examples/init.rs b/examples/init.rs index c651136e..aaf71f97 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)] -mod APP { +mod app { #[init] fn init(cx: init::Context) { static mut X: u32 = 0; diff --git a/examples/late.rs b/examples/late.rs index 8675c6ac..f656efba 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -15,7 +15,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { // Late resources struct Resources { p: Producer<'static, u32, U4>, diff --git a/examples/lock.rs b/examples/lock.rs index 4b16679e..61aed213 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(0)] shared: u32, diff --git a/examples/message.rs b/examples/message.rs index 3e9633bd..3f14a5a4 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)] -mod APP { +mod app { #[init(spawn = [foo])] fn init(c: init::Context) { c.spawn.foo(/* no message */).unwrap(); diff --git a/examples/not-send.rs b/examples/not-send.rs index bcc049c3..a2965941 100644 --- a/examples/not-send.rs +++ b/examples/not-send.rs @@ -16,7 +16,7 @@ pub struct NotSend { } #[app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(None)] shared: Option, diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 0354ef10..74156211 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -15,7 +15,7 @@ pub struct NotSync { } #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(NotSync { _0: PhantomData })] shared: NotSync, diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index fbc7bfd4..221cc307 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { key: u32, } diff --git a/examples/periodic.rs b/examples/periodic.rs index cd887ca5..2d4c73b5 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)] -mod APP { +mod app { + #[init(schedule = [foo])] fn init(cx: init::Context) { // omitted: initialization of `CYCCNT` diff --git a/examples/peripherals-taken.rs b/examples/peripherals-taken.rs index a1bd6868..b9267df6 100644 --- a/examples/peripherals-taken.rs +++ b/examples/peripherals-taken.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn main(_: main::Context) { assert!(cortex_m::Peripherals::take().is_none()); diff --git a/examples/pool.rs b/examples/pool.rs index eb65ed82..c87be778 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -18,7 +18,10 @@ use rtic::app; pool!(P: [u8; 128]); #[app(device = lm3s6965)] -mod APP { +mod app { + use crate::Box; + use crate::P; + #[init] fn init(_: init::Context) { static mut MEMORY: [u8; 512] = [0; 512]; diff --git a/examples/preempt.rs b/examples/preempt.rs index a20b36cc..02193011 100644 --- a/examples/preempt.rs +++ b/examples/preempt.rs @@ -9,7 +9,7 @@ use panic_semihosting as _; use rtic::app; #[app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) { rtic::pend(Interrupt::GPIOA); diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs index cfe22e39..789d7871 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)] -mod APP { +mod app { #[init(spawn = [bar])] fn init(c: init::Context) { c.spawn.bar().unwrap(); diff --git a/examples/resource.rs b/examples/resource.rs index a0954d60..4887b5ef 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -10,7 +10,7 @@ use lm3s6965::Interrupt; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { // A resource #[init(0)] diff --git a/examples/schedule.rs b/examples/schedule.rs index f2e7ed88..d5547b67 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)] -mod APP { +mod app { #[init(schedule = [foo, bar])] fn init(mut cx: init::Context) { // Initialize (enable) the monotonic timer (CYCCNT) diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs index 03391bdd..dcc31d3c 100644 --- a/examples/shared-with-init.rs +++ b/examples/shared-with-init.rs @@ -13,7 +13,7 @@ use rtic::app; pub struct MustBeSend; #[app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(None)] shared: Option, diff --git a/examples/smallest.rs b/examples/smallest.rs index d6f3b66c..b8cbf87e 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)] -mod APP {} +mod app {} diff --git a/examples/t-binds.rs b/examples/t-binds.rs index 8634c759..7d7bd7d2 100644 --- a/examples/t-binds.rs +++ b/examples/t-binds.rs @@ -8,7 +8,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) {} diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs index 892d2114..cf1c6849 100644 --- a/examples/t-cfg-resources.rs +++ b/examples/t-cfg-resources.rs @@ -6,12 +6,11 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { // A resource #[init(0)] shared: u32, - // A conditionally compiled resource behind feature_x #[cfg(feature = "feature_x")] x: u32, diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index da9a4910..7caabe2c 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -6,7 +6,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] -mod APP { +mod app { struct Resources { #[cfg(never)] #[init(0)] diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs index 6143bbd7..1954d56d 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)] -mod APP { +mod app { #[init] fn init(_: init::Context) { rtic::pend(lm3s6965::Interrupt::UART0) diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs index 89f93d0a..8400f314 100644 --- a/examples/t-idle-main.rs +++ b/examples/t-idle-main.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) {} diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs index 040c72fa..b4f126ba 100644 --- a/examples/t-init-main.rs +++ b/examples/t-init-main.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn main(_: main::Context) { debug::exit(debug::EXIT_SUCCESS); diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index 77990182..4f6d1af7 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -12,7 +12,7 @@ pub struct NotSend { } #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { x: NotSend, #[init(None)] diff --git a/examples/t-resource.rs b/examples/t-resource.rs index 0864a8ab..e18a1cd7 100644 --- a/examples/t-resource.rs +++ b/examples/t-resource.rs @@ -8,7 +8,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[init(0)] o1: u32, // init diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs index 67536133..ef2eb080 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)] -mod APP { +mod app { #[init(schedule = [foo, bar, baz])] fn init(c: init::Context) { let _: Result<(), ()> = c.schedule.foo(c.start + 10.cycles()); diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs index 7a64e1cc..72143c5b 100644 --- a/examples/t-spawn.rs +++ b/examples/t-spawn.rs @@ -8,7 +8,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init(spawn = [foo, bar, baz])] fn init(c: init::Context) { let _: Result<(), ()> = c.spawn.foo(); diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs index edea4309..373b505c 100644 --- a/examples/t-stask-main.rs +++ b/examples/t-stask-main.rs @@ -7,7 +7,7 @@ use cortex_m_semihosting::debug; use panic_semihosting as _; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init(spawn = [main])] fn init(cx: init::Context) { cx.spawn.main().ok(); diff --git a/examples/task.rs b/examples/task.rs index e515c936..f510df74 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)] -mod APP { +mod app { #[init(spawn = [foo])] fn init(c: init::Context) { c.spawn.foo().unwrap(); diff --git a/examples/types.rs b/examples/types.rs index eafc9b1d..8c612b21 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -10,7 +10,7 @@ use panic_semihosting as _; use rtic::cyccnt; #[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)] -mod APP { +mod app { struct Resources { #[init(0)] shared: u32, diff --git a/ui/single/exception-invalid.rs b/ui/single/exception-invalid.rs index 9b6b0016..04d9bc75 100644 --- a/ui/single/exception-invalid.rs +++ b/ui/single/exception-invalid.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[task(binds = NonMaskableInt)] fn nmi(_: nmi::Context) {} } diff --git a/ui/single/exception-systick-used.rs b/ui/single/exception-systick-used.rs index 02fd1c6b..1c30b700 100644 --- a/ui/single/exception-systick-used.rs +++ b/ui/single/exception-systick-used.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[task(binds = SysTick)] fn sys_tick(_: sys_tick::Context) {} diff --git a/ui/single/extern-interrupt-not-enough.rs b/ui/single/extern-interrupt-not-enough.rs index 18850d8a..f2624036 100644 --- a/ui/single/extern-interrupt-not-enough.rs +++ b/ui/single/extern-interrupt-not-enough.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[task] fn a(_: a::Context) {} } diff --git a/ui/single/extern-interrupt-used.rs b/ui/single/extern-interrupt-used.rs index dd798431..89c23784 100644 --- a/ui/single/extern-interrupt-used.rs +++ b/ui/single/extern-interrupt-used.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[task(binds = UART0)] fn a(_: a::Context) {} diff --git a/ui/single/locals-cfg.rs b/ui/single/locals-cfg.rs index 5053cf38..7ec46acb 100644 --- a/ui/single/locals-cfg.rs +++ b/ui/single/locals-cfg.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) { #[cfg(never)] diff --git a/ui/single/resources-cfg.rs b/ui/single/resources-cfg.rs index fd03f585..e41ce421 100644 --- a/ui/single/resources-cfg.rs +++ b/ui/single/resources-cfg.rs @@ -1,7 +1,7 @@ #![no_main] #[rtic::app(device = lm3s6965)] -mod APP { +mod app { struct Resources { #[cfg(never)] #[init(0)] diff --git a/ui/single/task-priority-too-high.rs b/ui/single/task-priority-too-high.rs index ed7dd869..c01d685b 100644 --- a/ui/single/task-priority-too-high.rs +++ b/ui/single/task-priority-too-high.rs @@ -3,7 +3,7 @@ use rtic::app; #[rtic::app(device = lm3s6965)] -mod APP { +mod app { #[init] fn init(_: init::Context) {} -- cgit v1.2.3 From dcc31fb8843d228165b28af1c10d92266847ce90 Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Tue, 26 May 2020 10:48:24 +0000 Subject: Examples need to import the resources --- examples/late.rs | 4 ++++ examples/not-send.rs | 2 ++ examples/not-sync.rs | 3 +++ examples/shared-with-init.rs | 2 ++ examples/t-late-not-send.rs | 2 ++ 5 files changed, 13 insertions(+) (limited to 'examples/shared-with-init.rs') diff --git a/examples/late.rs b/examples/late.rs index f656efba..2b99e3dc 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -16,6 +16,10 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + use heapless::{ + consts::*, + spsc::{Consumer, Producer}, + }; // Late resources struct Resources { p: Producer<'static, u32, U4>, diff --git a/examples/not-send.rs b/examples/not-send.rs index a2965941..c0582d76 100644 --- a/examples/not-send.rs +++ b/examples/not-send.rs @@ -17,6 +17,8 @@ pub struct NotSend { #[app(device = lm3s6965)] mod app { + use super::NotSend; + struct Resources { #[init(None)] shared: Option, diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 74156211..28c76183 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -16,6 +16,9 @@ pub struct NotSync { #[rtic::app(device = lm3s6965)] mod app { + use super::NotSync; + use core::marker::PhantomData; + struct Resources { #[init(NotSync { _0: PhantomData })] shared: NotSync, diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs index dcc31d3c..9c4499ee 100644 --- a/examples/shared-with-init.rs +++ b/examples/shared-with-init.rs @@ -14,6 +14,8 @@ pub struct MustBeSend; #[app(device = lm3s6965)] mod app { + use super::MustBeSend; + struct Resources { #[init(None)] shared: Option, diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index 4f6d1af7..587ee73c 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -13,6 +13,8 @@ pub struct NotSend { #[rtic::app(device = lm3s6965)] mod app { + use super::NotSend; + struct Resources { x: NotSend, #[init(None)] -- cgit v1.2.3 From 96df0a33b1096e807bdd15713b10c2f3fa39395c Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Thu, 4 Jun 2020 15:24:21 +0000 Subject: All examples use #[resources] attribute --- examples/cfg.rs | 1 + examples/destructure.rs | 1 + examples/generics.rs | 1 + examples/late.rs | 1 + examples/lock.rs | 1 + examples/not-send.rs | 1 + examples/not-sync.rs | 1 + examples/only-shared-access.rs | 1 + examples/resource.rs | 1 + examples/shared-with-init.rs | 1 + examples/t-cfg-resources.rs | 2 +- examples/t-cfg.rs | 1 + examples/t-late-not-send.rs | 1 + examples/t-resource.rs | 1 + examples/types.rs | 1 + 15 files changed, 15 insertions(+), 1 deletion(-) (limited to 'examples/shared-with-init.rs') diff --git a/examples/cfg.rs b/examples/cfg.rs index 16e6e077..f4848302 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -12,6 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { #[cfg(debug_assertions)] // <- `true` when using the `dev` profile #[init(0)] diff --git a/examples/destructure.rs b/examples/destructure.rs index 131c07fb..45d73195 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -11,6 +11,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { // Some resources to work with #[init(0)] diff --git a/examples/generics.rs b/examples/generics.rs index 20e9ed7f..c65e6518 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -12,6 +12,7 @@ use rtic::{Exclusive, Mutex}; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { #[init(0)] shared: u32, diff --git a/examples/late.rs b/examples/late.rs index 2b99e3dc..761c68f5 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -21,6 +21,7 @@ mod app { spsc::{Consumer, Producer}, }; // Late resources + #[resources] struct Resources { p: Producer<'static, u32, U4>, c: Consumer<'static, u32, U4>, diff --git a/examples/lock.rs b/examples/lock.rs index 61aed213..6ce61dc6 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -11,6 +11,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { #[init(0)] shared: u32, diff --git a/examples/not-send.rs b/examples/not-send.rs index c0582d76..45f7e4e7 100644 --- a/examples/not-send.rs +++ b/examples/not-send.rs @@ -19,6 +19,7 @@ pub struct NotSend { mod app { use super::NotSend; + #[resources] struct Resources { #[init(None)] shared: Option, diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 28c76183..75816424 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -19,6 +19,7 @@ mod app { use super::NotSync; use core::marker::PhantomData; + #[resources] struct Resources { #[init(NotSync { _0: PhantomData })] shared: NotSync, diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index 221cc307..91d0b7ad 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -11,6 +11,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { key: u32, } diff --git a/examples/resource.rs b/examples/resource.rs index 4887b5ef..4cd0f4ca 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -11,6 +11,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { // A resource #[init(0)] diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs index 9c4499ee..9f7e26aa 100644 --- a/examples/shared-with-init.rs +++ b/examples/shared-with-init.rs @@ -16,6 +16,7 @@ pub struct MustBeSend; mod app { use super::MustBeSend; + #[resources] struct Resources { #[init(None)] shared: Option, diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs index 190b32c2..61eb4c7b 100644 --- a/examples/t-cfg-resources.rs +++ b/examples/t-cfg-resources.rs @@ -7,6 +7,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { // A resource #[init(0)] @@ -16,7 +17,6 @@ mod app { x: u32, dummy: (), // dummy such that we have at least one late resource } - #[init] fn init(_: init::Context) -> init::LateResources { init::LateResources { diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index 7caabe2c..3deb107c 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -7,6 +7,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] mod app { + #[resources] struct Resources { #[cfg(never)] #[init(0)] diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index 587ee73c..345d9aef 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -15,6 +15,7 @@ pub struct NotSend { mod app { use super::NotSend; + #[resources] struct Resources { x: NotSend, #[init(None)] diff --git a/examples/t-resource.rs b/examples/t-resource.rs index e18a1cd7..94b527fa 100644 --- a/examples/t-resource.rs +++ b/examples/t-resource.rs @@ -9,6 +9,7 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] mod app { + #[resources] struct Resources { #[init(0)] o1: u32, // init diff --git a/examples/types.rs b/examples/types.rs index 8c612b21..cd7e8a2f 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -11,6 +11,7 @@ use rtic::cyccnt; #[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)] mod app { + #[resources] struct Resources { #[init(0)] shared: u32, -- cgit v1.2.3