All examples use #[resources] attribute

This commit is contained in:
Henrik Tjäder 2020-06-04 15:24:21 +00:00
parent ec936c3b51
commit 96df0a33b1
15 changed files with 15 additions and 1 deletions

View file

@ -12,6 +12,7 @@ use panic_semihosting as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile #[cfg(debug_assertions)] // <- `true` when using the `dev` profile
#[init(0)] #[init(0)]

View file

@ -11,6 +11,7 @@ use panic_semihosting as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
// Some resources to work with // Some resources to work with
#[init(0)] #[init(0)]

View file

@ -12,6 +12,7 @@ use rtic::{Exclusive, Mutex};
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[init(0)] #[init(0)]
shared: u32, shared: u32,

View file

@ -21,6 +21,7 @@ mod app {
spsc::{Consumer, Producer}, spsc::{Consumer, Producer},
}; };
// Late resources // Late resources
#[resources]
struct Resources { struct Resources {
p: Producer<'static, u32, U4>, p: Producer<'static, u32, U4>,
c: Consumer<'static, u32, U4>, c: Consumer<'static, u32, U4>,

View file

@ -11,6 +11,7 @@ use panic_semihosting as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[init(0)] #[init(0)]
shared: u32, shared: u32,

View file

@ -19,6 +19,7 @@ pub struct NotSend {
mod app { mod app {
use super::NotSend; use super::NotSend;
#[resources]
struct Resources { struct Resources {
#[init(None)] #[init(None)]
shared: Option<NotSend>, shared: Option<NotSend>,

View file

@ -19,6 +19,7 @@ mod app {
use super::NotSync; use super::NotSync;
use core::marker::PhantomData; use core::marker::PhantomData;
#[resources]
struct Resources { struct Resources {
#[init(NotSync { _0: PhantomData })] #[init(NotSync { _0: PhantomData })]
shared: NotSync, shared: NotSync,

View file

@ -11,6 +11,7 @@ use panic_semihosting as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
key: u32, key: u32,
} }

View file

@ -11,6 +11,7 @@ use panic_semihosting as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
// A resource // A resource
#[init(0)] #[init(0)]

View file

@ -16,6 +16,7 @@ pub struct MustBeSend;
mod app { mod app {
use super::MustBeSend; use super::MustBeSend;
#[resources]
struct Resources { struct Resources {
#[init(None)] #[init(None)]
shared: Option<MustBeSend>, shared: Option<MustBeSend>,

View file

@ -7,6 +7,7 @@ use panic_halt as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
// A resource // A resource
#[init(0)] #[init(0)]
@ -16,7 +17,6 @@ mod app {
x: u32, x: u32,
dummy: (), // dummy such that we have at least one late resource dummy: (), // dummy such that we have at least one late resource
} }
#[init] #[init]
fn init(_: init::Context) -> init::LateResources { fn init(_: init::Context) -> init::LateResources {
init::LateResources { init::LateResources {

View file

@ -7,6 +7,7 @@ use panic_halt as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] #[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[cfg(never)] #[cfg(never)]
#[init(0)] #[init(0)]

View file

@ -15,6 +15,7 @@ pub struct NotSend {
mod app { mod app {
use super::NotSend; use super::NotSend;
#[resources]
struct Resources { struct Resources {
x: NotSend, x: NotSend,
#[init(None)] #[init(None)]

View file

@ -9,6 +9,7 @@ use panic_halt as _;
#[rtic::app(device = lm3s6965)] #[rtic::app(device = lm3s6965)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[init(0)] #[init(0)]
o1: u32, // init o1: u32, // init

View file

@ -11,6 +11,7 @@ use rtic::cyccnt;
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)] #[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
mod app { mod app {
#[resources]
struct Resources { struct Resources {
#[init(0)] #[init(0)]
shared: u32, shared: u32,