Get timestamp with interrupt disabled

This makes `app-template` support more platforms (i.e. `thumbv6`).
This commit is contained in:
Urhengulas
2021-02-22 23:26:47 +01:00
parent d1c9fa9920
commit 34b68a19f1
+6 -1
View File
@@ -16,7 +16,12 @@ fn panic() -> ! {
} }
static COUNT: AtomicUsize = AtomicUsize::new(0); static COUNT: AtomicUsize = AtomicUsize::new(0);
defmt::timestamp!("{=usize}", COUNT.fetch_add(1, Ordering::Relaxed)); defmt::timestamp!("{=usize}", {
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n
});
/// 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() -> ! {