mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
Test fixes
This commit is contained in:
parent
d02f9a0241
commit
555f36857e
50 changed files with 121 additions and 199 deletions
|
@ -18,10 +18,6 @@ version = "0.6.0-alpha.0"
|
|||
[lib]
|
||||
name = "rtic"
|
||||
|
||||
[[example]]
|
||||
name = "baseline"
|
||||
required-features = ["__v7"]
|
||||
|
||||
[[example]]
|
||||
name = "periodic"
|
||||
required-features = ["__v7"]
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
//! examples/baseline.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
// NOTE: does NOT properly work on QEMU
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> init::LateResources {
|
||||
// omitted: initialization of `CYCCNT`
|
||||
|
||||
hprintln!("init(baseline = {:?})", cx.start).unwrap();
|
||||
|
||||
// `foo` inherits the baseline of `init`: `Instant(0)`
|
||||
foo::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn foo(cx: foo::Context) {
|
||||
static mut ONCE: bool = true;
|
||||
|
||||
hprintln!("foo(baseline = {:?})", cx.scheduled).unwrap();
|
||||
|
||||
if *ONCE {
|
||||
*ONCE = false;
|
||||
|
||||
rtic::pend(Interrupt::UART0);
|
||||
} else {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
fn uart0(cx: uart0::Context) {
|
||||
hprintln!("UART0(baseline = {:?})", cx.start).unwrap();
|
||||
|
||||
// `foo` inherits the baseline of `UART0`: its `start` time
|
||||
foo::spawn().unwrap();
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let big_struct = unsafe {
|
||||
static mut BIG_STRUCT: MaybeUninit<BigStruct> = MaybeUninit::uninit();
|
||||
|
||||
|
@ -40,9 +40,12 @@ mod app {
|
|||
&mut *BIG_STRUCT.as_mut_ptr()
|
||||
};
|
||||
|
||||
(
|
||||
init::LateResources {
|
||||
// assign the reference so we can use the resource
|
||||
big_struct,
|
||||
}
|
||||
},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@ mod app {
|
|||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -13,10 +13,10 @@ mod app {
|
|||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
|
|
|
@ -24,11 +24,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
foo::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -21,11 +21,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
foo::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -24,11 +24,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// Direct destructure
|
||||
|
|
|
@ -7,20 +7,13 @@
|
|||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use rtic::cyccnt::U32Ext;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
nothing: (),
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
task1::spawn().ok();
|
||||
|
||||
init::LateResources { nothing: () }
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -20,12 +20,12 @@ mod app {
|
|||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -22,10 +22,10 @@ mod app {
|
|||
use crate::foo;
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> init::LateResources {
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
|
|
|
@ -21,11 +21,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
|
|
|
@ -13,14 +13,14 @@ mod app {
|
|||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
// Pends the UART0 interrupt but its handler won't run until *after*
|
||||
// `init` returns because interrupts are disabled
|
||||
rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -12,7 +12,7 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> init::LateResources {
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut X: u32 = 0;
|
||||
|
||||
// Cortex-M peripherals
|
||||
|
@ -32,6 +32,6 @@ mod app {
|
|||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,13 +25,13 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut Q: Queue<u32, U4> = Queue(i::Queue::new());
|
||||
|
||||
let (p, c) = Q.split();
|
||||
|
||||
// Initialization of late resources
|
||||
init::LateResources { p, c }
|
||||
(init::LateResources { p, c }, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle(resources = [c])]
|
||||
|
|
|
@ -19,10 +19,10 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// when omitted priority is assumed to be `1`
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn(/* no message */).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -25,10 +25,10 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// when omitted priority is assumed to be `1`
|
||||
|
|
|
@ -25,10 +25,10 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(resources = [&shared])]
|
||||
|
|
|
@ -18,11 +18,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
init::LateResources { key: 0xdeadbeef }
|
||||
(init::LateResources { key: 0xdeadbeef }, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [&key])]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
use panic_semihosting as _;
|
||||
|
||||
// NOTE: does NOT work on QEMU!
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use cortex_m_semihosting::hprintln;
|
||||
use rtic::cyccnt::{Instant, U32Ext};
|
||||
|
@ -16,12 +16,12 @@ mod app {
|
|||
const PERIOD: u32 = 8_000_000;
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> init::LateResources {
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
// omitted: initialization of `CYCCNT`
|
||||
|
||||
foo::schedule(cx.start + PERIOD.cycles()).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -10,10 +10,10 @@ mod app {
|
|||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
assert!(cortex_m::Peripherals::take().is_none());
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ mod app {
|
|||
use super::P;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut MEMORY: [u8; 512] = [0; 512];
|
||||
|
||||
// Increase the capacity of the memory pool by ~4
|
||||
|
@ -33,7 +33,7 @@ mod app {
|
|||
|
||||
rtic::pend(Interrupt::I2C0);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = I2C0, priority = 2)]
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use lm3s6965::Interrupt;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = GPIOA, priority = 1)]
|
||||
|
|
|
@ -19,10 +19,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
|
|
|
@ -27,11 +27,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
|
|
|
@ -20,11 +20,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
use panic_halt as _;
|
||||
|
||||
// NOTE: does NOT work on QEMU!
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use cortex_m::peripheral::DWT;
|
||||
use cortex_m_semihosting::hprintln;
|
||||
use rtic::cyccnt::{Instant, U32Ext as _};
|
||||
|
||||
#[init()]
|
||||
fn init(mut cx: init::Context) -> init::LateResources {
|
||||
fn init(mut cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
// Initialize (enable) the monotonic timer (CYCCNT)
|
||||
cx.core.DCB.enable_trace();
|
||||
// required on Cortex-M7 devices that software lock the DWT (e.g. STM32F7)
|
||||
|
@ -34,7 +34,7 @@ mod app {
|
|||
// Schedule `bar` to run 4e6 cycles in the future
|
||||
bar::schedule(now + 4_000_000.cycles()).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> init::LateResources {
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task()]
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> init::LateResources {
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -26,13 +26,13 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut Q: Queue<u32, U4> = Queue(i::Queue::new());
|
||||
|
||||
let (p, c) = Q.split();
|
||||
|
||||
// Initialization of late resources
|
||||
init::LateResources { p, c }
|
||||
(init::LateResources { p, c }, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle(resources = [c])]
|
||||
|
|
|
@ -10,8 +10,8 @@ use panic_halt as _;
|
|||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// Cortex-M exception
|
||||
|
|
|
@ -18,13 +18,16 @@ mod app {
|
|||
dummy: (), // dummy such that we have at least one late resource
|
||||
}
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(
|
||||
init::LateResources {
|
||||
// The feature needs to be applied everywhere x is defined or used
|
||||
#[cfg(feature = "feature_x")]
|
||||
x: 0,
|
||||
dummy: (), // dummy such that we have at least one late resource
|
||||
}
|
||||
},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
use panic_halt as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0, QEI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
|
||||
mod app {
|
||||
#[resources]
|
||||
struct Resources {
|
||||
|
@ -15,11 +15,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -10,10 +10,10 @@ mod app {
|
|||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(lm3s6965::Interrupt::UART0);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
|
|
|
@ -10,8 +10,8 @@ mod app {
|
|||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -10,9 +10,9 @@ mod app {
|
|||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,13 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(
|
||||
init::LateResources {
|
||||
x: NotSend { _0: PhantomData },
|
||||
}
|
||||
},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[idle(resources = [x, y])]
|
||||
|
|
|
@ -32,8 +32,8 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle(resources = [o2, &o4, s1, &s3])]
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
use panic_halt as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
#[init]
|
||||
fn init(c: init::Context) -> init::LateResources {
|
||||
let _c: rtic::Peripherals = c.core;
|
||||
fn init(c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _c: cortex_m::Peripherals = c.core;
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
|
||||
use panic_halt as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use rtic::cyccnt::{Instant, U32Ext as _};
|
||||
|
||||
#[init]
|
||||
fn init(c: init::Context) -> init::LateResources {
|
||||
fn init(c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _: Result<(), ()> = foo::schedule(c.start + 10.cycles());
|
||||
let _: Result<(), u32> = bar::schedule(c.start + 20.cycles(), 0);
|
||||
let _: Result<(), (u32, u32)> = baz::schedule(c.start + 30.cycles(), 0, 1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -10,12 +10,12 @@ use panic_halt as _;
|
|||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _: Result<(), ()> = foo::spawn();
|
||||
let _: Result<(), u32> = bar::spawn(0);
|
||||
let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
@ -10,10 +10,10 @@ mod app {
|
|||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
taskmain::spawn().ok();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -18,8 +18,8 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
init::LateResources { l: 42 }
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources { l: 42 }, init::Monotonics())
|
||||
}
|
||||
|
||||
// l is task_local
|
||||
|
|
|
@ -38,10 +38,10 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
init::LateResources { e2: 2, l2: 2 }
|
||||
(init::LateResources { e2: 2, l2: 2 }, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -12,10 +12,10 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> init::LateResources {
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
main::spawn().unwrap();
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
//! examples/test_new_monotonic.rs
|
||||
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _; // panic handler
|
||||
use rtic::app;
|
||||
|
||||
#[app(device = lm3s6965, dispatchers = [UART])]
|
||||
mod app {
|
||||
#[monotonic(binds = SysTick)]
|
||||
type MyMono1 = hal::Mono1;
|
||||
|
||||
#[monotonic(binds = SomeISR2, default = true)]
|
||||
type MyMono2 = hal::Mono2;
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {}
|
||||
|
||||
#[task]
|
||||
fn task1(_: task1::Context) {}
|
||||
|
||||
#[task]
|
||||
fn task2(_: task2::Context) {}
|
||||
}
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
|
||||
#[rtic::app(device = lm3s6965, peripherals = true, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
use rtic::cyccnt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
|
@ -19,14 +18,14 @@ mod app {
|
|||
}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> init::LateResources {
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _: cyccnt::Instant = cx.start;
|
||||
let _: rtic::Peripherals = cx.core;
|
||||
let _: lm3s6965::Peripherals = cx.device;
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
init::LateResources {}
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
Loading…
Reference in a new issue