mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-10 16:25:37 +00:00
update rtic extenstion
This commit is contained in:
parent
700947c83b
commit
fd03998fb7
1 changed files with 17 additions and 6 deletions
|
@ -14,11 +14,22 @@ RTIC makes a clearer distinction between the application's initialization phase,
|
||||||
|
|
||||||
You can use `rustfmt` on `target/rtic-expansion.rs` to make the generated code easier to read. Among other things, the file should contain the following lines. Note that interrupts are disabled during the execution of the `init` function:
|
You can use `rustfmt` on `target/rtic-expansion.rs` to make the generated code easier to read. Among other things, the file should contain the following lines. Note that interrupts are disabled during the execution of the `init` function:
|
||||||
|
|
||||||
``` rust
|
```rust
|
||||||
fn main() -> ! {
|
unsafe extern "C" fn main() -> ! {
|
||||||
rtic::export::interrupt::disable();
|
rtic::export::interrupt::disable();
|
||||||
let late = init(init::Context::new(/* .. */));
|
let mut core: rtic::export::Peripherals = rtic::export::Peripherals::steal().into();
|
||||||
rtic::export::interrupt::enable();
|
#[inline(never)]
|
||||||
idle(idle::Context::new(/* .. */))
|
fn __rtic_init_resources<F>(f: F)
|
||||||
|
where
|
||||||
|
F: FnOnce(),
|
||||||
|
{
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
__rtic_init_resources(|| {
|
||||||
|
let (shared_resources, local_resources, mut monotonics) =
|
||||||
|
init(init::Context::new(core.into()));
|
||||||
|
rtic::export::interrupt::enable();
|
||||||
|
});
|
||||||
|
idle(idle::Context::new(&rtic::export::Priority::new(0)))
|
||||||
}
|
}
|
||||||
```
|
```
|
Loading…
Reference in a new issue