mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 22:05:37 +01:00
goodby static mut, welcome back to UnsafeCell
This commit is contained in:
parent
3c86d713a6
commit
db1574bf6b
5 changed files with 108 additions and 12 deletions
25
examples/minimal_early_resource.rs
Normal file
25
examples/minimal_early_resource.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//! examples/idle.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
resource_x: u32,
|
||||
}
|
||||
|
||||
#[idle(resources = [resource_x])]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
examples/minimal_late_resource.rs
Normal file
29
examples/minimal_late_resource.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//! examples/minimal_late_resource.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
resource_x: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources { resource_x: 0 }, init::Monotonics {})
|
||||
}
|
||||
|
||||
#[idle(resources = [resource_x])]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue