mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-25 03:19:34 +01:00
All examples use #[resources] attribute
This commit is contained in:
parent
ec936c3b51
commit
96df0a33b1
15 changed files with 15 additions and 1 deletions
|
@ -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)]
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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>,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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>,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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>,
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue