aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4/src/example_common.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-06-08 16:46:12 +0200
committerGitHub <[email protected]>2021-06-08 16:46:12 +0200
commitaf0f8082f079bb80d8b478331ff505f5462a9120 (patch)
tree6de9b663d1d5be935a950b9436670ea75c935687 /examples/stm32l4/src/example_common.rs
parente6bd02d40eb2d2bdde1da463a6e79eebb63987b8 (diff)
parenta407558e3f0df9dd9e8f4899608a7ab5187a0af8 (diff)
Merge pull request #233 from bobmcwhirter/l4-examples
L4 examples
Diffstat (limited to 'examples/stm32l4/src/example_common.rs')
-rw-r--r--examples/stm32l4/src/example_common.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/stm32l4/src/example_common.rs b/examples/stm32l4/src/example_common.rs
new file mode 100644
index 000000000..54d633837
--- /dev/null
+++ b/examples/stm32l4/src/example_common.rs
@@ -0,0 +1,17 @@
1#![macro_use]
2
3use defmt_rtt as _; // global logger
4use panic_probe as _;
5
6pub use defmt::*;
7
8use core::sync::atomic::{AtomicUsize, Ordering};
9
10defmt::timestamp! {"{=u64}", {
11 static COUNT: AtomicUsize = AtomicUsize::new(0);
12 // NOTE(no-CAS) `timestamps` runs with interrupts disabled
13 let n = COUNT.load(Ordering::Relaxed);
14 COUNT.store(n + 1, Ordering::Relaxed);
15 n as u64
16 }
17}