aboutsummaryrefslogtreecommitdiff
path: root/mc/examples/x-schedule.rs
blob: 76e70acf57fa6c2e281c904a4879c7a559468acd (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
#![no_main]
#![no_std]

use panic_halt as _;

#[rtfm::app(cores = 2, device = mc, monotonic = mc::MT)]
const APP: () = {
    #[init(core = 0, spawn = [ping])]
    fn init(c: init::Context) {
        c.spawn.ping().ok();
    }

    #[task(core = 0, schedule = [ping])]
    fn pong(c: pong::Context) {
        c.schedule.ping(c.scheduled + 1_000_000).ok();
    }

    #[task(core = 1, schedule = [pong])]
    fn ping(c: ping::Context) {
        c.schedule.pong(c.scheduled + 1_000_000).ok();
    }

    extern "C" {
        #[core = 0]
        fn I0();

        #[core = 0]
        fn I1();

        #[core = 1]
        fn I0();

        #[core = 1]
        fn I1();
    }
};