2020-09-24 20:56:49 +02:00
|
|
|
//! examples/double_schedule.rs
|
|
|
|
|
|
|
|
#![deny(unsafe_code)]
|
|
|
|
#![deny(warnings)]
|
|
|
|
#![no_main]
|
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
use panic_semihosting as _;
|
|
|
|
use rtic::cyccnt::U32Ext;
|
|
|
|
|
|
|
|
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
|
2020-09-25 15:24:53 +02:00
|
|
|
mod app {
|
|
|
|
|
2020-09-29 13:56:11 +02:00
|
|
|
#[resources]
|
2020-09-24 20:56:49 +02:00
|
|
|
struct Resources {
|
|
|
|
nothing: (),
|
|
|
|
}
|
|
|
|
|
2020-10-11 19:41:57 +02:00
|
|
|
#[init]
|
|
|
|
fn init(_: init::Context) -> init::LateResources {
|
|
|
|
task1::spawn().ok();
|
2020-09-24 20:56:49 +02:00
|
|
|
|
|
|
|
init::LateResources { nothing: () }
|
|
|
|
}
|
|
|
|
|
2020-10-11 19:41:57 +02:00
|
|
|
#[task]
|
2020-09-24 20:56:49 +02:00
|
|
|
fn task1(_cx: task1::Context) {
|
2020-10-11 19:41:57 +02:00
|
|
|
task2::schedule(_cx.scheduled + 100.cycles()).ok();
|
2020-09-24 20:56:49 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 19:41:57 +02:00
|
|
|
#[task]
|
2020-09-24 20:56:49 +02:00
|
|
|
fn task2(_cx: task2::Context) {
|
2020-10-11 19:41:57 +02:00
|
|
|
task1::schedule(_cx.scheduled + 100.cycles()).ok();
|
2020-09-24 20:56:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
fn SSI0();
|
|
|
|
}
|
2020-09-25 15:24:53 +02:00
|
|
|
}
|