aboutsummaryrefslogtreecommitdiff
path: root/examples/custom-type.rs
blob: 826e9dd132dca30db52a7bd7e852cefb2e0e7af6 (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
40
41
42
43
44
45
46
47
48
49
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_std]

extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx;

use rtfm::{app, Threshold};

pub struct Foo;

app! {
    device: stm32f103xx,

    resources: {
        static CO_OWNED: Foo = Foo;
        static ON: Foo = Foo;
        static OWNED: Foo = Foo;
        static SHARED: Foo = Foo;
    },

    idle: {
        resources: [OWNED, SHARED],
    },

    tasks: {
        SYS_TICK: {
            path: sys_tick,
            resources: [CO_OWNED, ON, SHARED],
        },

        TIM2: {
            enabled: false,
            path: tim2,
            priority: 1,
            resources: [CO_OWNED],
        },
    },
}

fn init(_p: ::init::Peripherals, _r: ::init::Resources) {}

fn idle(_t: &mut Threshold, _r: ::idle::Resources) -> ! {
    loop {}
}

fn sys_tick(_t: &mut Threshold, _r: SYS_TICK::Resources) {}

fn tim2(_t: &mut Threshold, _r: TIM2::Resources) {}