Update example code
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
// value of the FREQUENCY register (nRF52840 device; RADIO peripheral)
|
// value of the FREQUENCY register (nRF52840 device; RADIO peripheral)
|
||||||
let frequency: u32 = 276;
|
let frequency: u32 = 276;
|
||||||
defmt::debug!("FREQUENCY: {0:0..7}, MAP: {0:8..9}", frequency);
|
defmt::debug!("FREQUENCY: {0=0..7}, MAP: {0=8..9}", frequency);
|
||||||
|
|
||||||
{{crate_name}}::exit()
|
{{crate_name}}::exit()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ fn main() -> ! {
|
|||||||
let s = S1 { x: 42, y: S2 { z: 43 } };
|
let s = S1 { x: 42, y: S2 { z: 43 } };
|
||||||
defmt::info!("s={:?}", s);
|
defmt::info!("s={:?}", s);
|
||||||
let x = 42;
|
let x = 42;
|
||||||
defmt::info!("x={:u8}", x);
|
defmt::info!("x={=u8}", x);
|
||||||
|
|
||||||
{{crate_name}}::exit()
|
{{crate_name}}::exit()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ack(m: u32, n: u32) -> u32 {
|
fn ack(m: u32, n: u32) -> u32 {
|
||||||
defmt::info!("ack(m={:u32}, n={:u32})", m, n);
|
defmt::info!("ack(m={=u32}, n={=u32})", m, n);
|
||||||
let mut big = [2; 512];
|
let mut big = [2; 512];
|
||||||
if m == 0 {
|
if m == 0 {
|
||||||
n + 1
|
n + 1
|
||||||
|
|||||||
+1
-7
@@ -15,14 +15,8 @@ fn panic() -> ! {
|
|||||||
cortex_m::asm::udf()
|
cortex_m::asm::udf()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[defmt::timestamp]
|
|
||||||
fn timestamp() -> u64 {
|
|
||||||
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||||
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
|
defmt::timestamp!("{=usize}", COUNT.fetch_add(1, Ordering::Relaxed));
|
||||||
let n = COUNT.load(Ordering::Relaxed);
|
|
||||||
COUNT.store(n + 1, Ordering::Relaxed);
|
|
||||||
n as u64
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Terminates the application and makes `probe-run` exit with exit-code = 0
|
/// Terminates the application and makes `probe-run` exit with exit-code = 0
|
||||||
pub fn exit() -> ! {
|
pub fn exit() -> ! {
|
||||||
|
|||||||
Reference in New Issue
Block a user