forked from knurling-rs/app-template
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathminimal.rs
65 lines (54 loc) · 1.64 KB
/
minimal.rs
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#![no_main]
#![no_std]
#![feature(type_alias_impl_trait)]
use test_app as _; // global logger + panicking-behavior + memory layout
// TODO(7) Configure the `rtic::app` macro
#[rtic::app(
// TODO: Replace `some_hal::pac` with the path to the PAC
device = some_hal::pac,
// TODO: Replace the `FreeInterrupt1, ...` with free interrupt vectors if software tasks are used
// You can usually find the names of the interrupt vectors in the some_hal::pac::interrupt enum.
dispatchers = [FreeInterrupt1, ...]
)]
mod app {
// Shared resources go here
#[shared]
struct Shared {
// TODO: Add resources
}
// Local resources go here
#[local]
struct Local {
// TODO: Add resources
}
#[init]
fn init(cx: init::Context) -> (Shared, Local) {
defmt::info!("init");
// TODO setup monotonic if used
// let sysclk = { /* clock setup + returning sysclk as an u32 */ };
// let token = rtic_monotonics::create_systick_token!();
// rtic_monotonics::systick::Systick::new(cx.core.SYST, sysclk, token);
task1::spawn().ok();
(
Shared {
// Initialization of shared resources go here
},
Local {
// Initialization of local resources go here
},
)
}
// Optional idle, can be removed if not needed.
#[idle]
fn idle(_: idle::Context) -> ! {
defmt::info!("idle");
loop {
continue;
}
}
// TODO: Add tasks
#[task(priority = 1)]
async fn task1(_cx: task1::Context) {
defmt::info!("Hello from task1!");
}
}