rtic/examples/double_schedule.rs

36 lines
703 B
Rust
Raw Permalink Normal View History

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