embedded-trainings-2020/advanced/firmware/src/bin/rtic-hello.rs

37 lines
719 B
Rust
Raw Normal View History

2020-06-09 09:52:27 +00:00
#![no_main]
#![no_std]
2022-01-07 11:34:53 +00:00
2021-04-12 15:09:38 +00:00
// this imports `beginner/apps/lib.rs` to retrieve our global logger + panicking-behavior
use firmware as _;
2020-06-09 09:52:27 +00:00
2022-01-07 16:24:21 +00:00
#[rtic::app(device = dk, peripherals = false)]
2022-01-07 11:34:53 +00:00
mod app {
use cortex_m::asm;
#[local]
struct MyLocalResources {
}
#[shared]
struct MySharedResources {
}
2020-06-09 09:52:27 +00:00
#[init]
2022-01-07 11:34:53 +00:00
fn init(_cx: init::Context) -> (MySharedResources, MyLocalResources, init::Monotonics) {
2020-06-09 09:52:27 +00:00
dk::init().unwrap();
2022-01-07 16:24:21 +00:00
defmt::println!("Hello");
2022-01-07 11:34:53 +00:00
(MySharedResources {}, MyLocalResources {}, init::Monotonics())
2020-06-09 09:52:27 +00:00
}
#[idle]
2022-01-07 11:34:53 +00:00
fn idle(_cx: idle::Context) -> ! {
2022-01-07 16:24:21 +00:00
defmt::println!("world!");
2020-06-09 09:52:27 +00:00
loop {
asm::bkpt();
}
}
2022-01-07 11:34:53 +00:00
}