code to enable uarte0

This commit is contained in:
Mirabellensaft 2023-03-10 13:49:09 +01:00
parent 70ce745930
commit e55713fe16
2 changed files with 39 additions and 0 deletions

View file

@ -9,6 +9,7 @@ version = "0.0.0"
cortex-m = {version = "0.7.6", features = ["critical-section-single-core"]}
cortex-m-rt = "0.7.2"
dk_bsc = { path = "../dk_bsc" }
dk_pac = { path = "../dk_pac" }
heapless = "0.7.16"
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
defmt = "0.3.2"

View file

@ -0,0 +1,38 @@
#![no_main]
#![no_std]
use cortex_m::asm;
use cortex_m_rt::entry;
use dk_pac;
// this imports `down-the-stack/apps/lib.rs` to retrieve our global logger + panicking-behavior
use apps as _;
use defmt;
use defmt_rtt as _; // global logger
#[entry]
fn main() -> ! {
// to enable more verbose logs, go to your `Cargo.toml` and set defmt logging levels
// to `defmt-trace` by changing the `default = []` entry in `[features]`
unsafe {
let periph = dk_pac::Peripherals::steal();
let uarte = periph.UARTE0;
uarte.enable.write(|w| w.enable().enabled());
if uarte.enable.read().bits() != 0 {
defmt::println!("Uarte0 is enabled");
} else {
defmt::println!("Uarte0 is disabled");
}
}
// this program does not `exit`; use Ctrl+C to terminate it
loop {
asm::nop();
}
}