rtic/heterogeneous/examples/x-init.rs

27 lines
506 B
Rust
Raw Permalink Normal View History

//! [compile-pass] Split initialization of late resources
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
use panic_halt as _;
2019-06-18 10:31:31 +02:00
#[rtfm::app(cores = 2, device = heterogeneous)]
const APP: () = {
2019-07-10 22:42:44 +02:00
struct Resources {
x: u32,
y: u32,
}
2019-07-10 22:42:44 +02:00
#[init(core = 0, late = [x])]
fn a(_: a::Context) -> a::LateResources {
2019-07-10 22:42:44 +02:00
a::LateResources { x: 0 }
}
#[init(core = 1)]
fn b(_: b::Context) -> b::LateResources {
2019-07-10 22:42:44 +02:00
b::LateResources { y: 0 }
}
};