aboutsummaryrefslogtreecommitdiff
path: root/examples/double_schedule.rs
blob: d242c57e4baefdbaddf6214444307fb4ab4d7ca7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! 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)]
mod app {

    #[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();
    }

    extern "C" {
        fn SSI0();
    }
}