aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f3/src/example_common.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-16 07:30:03 +0000
committerGitHub <[email protected]>2021-12-16 07:30:03 +0000
commitd5a3064c2c20b4a9515e5322bb9a74724ebcf7c9 (patch)
treeec1c6b4bcbb00458fdf38b1658535903d6e80eec /examples/stm32f3/src/example_common.rs
parent2d6111ed439a45a9001ab92ce0b2101836711317 (diff)
parent1b3367e9a2732aebdd9db18caf2a3034fc26a21a (diff)
Merge #540
540: Initial support for STM32F3 r=Dirbaio a=VasanthakumarV The [companion PR](https://github.com/embassy-rs/stm32-data/pull/109) in `stm32-data` should be merged before this PR. The examples were tested on an STM32F303VC MCU. Co-authored-by: VasanthakumarV <[email protected]> Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'examples/stm32f3/src/example_common.rs')
-rw-r--r--examples/stm32f3/src/example_common.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/stm32f3/src/example_common.rs b/examples/stm32f3/src/example_common.rs
new file mode 100644
index 000000000..e14517033
--- /dev/null
+++ b/examples/stm32f3/src/example_common.rs
@@ -0,0 +1,19 @@
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! {
11 "{=u64}",
12 {
13 static COUNT: AtomicUsize = AtomicUsize::new(0);
14 // NOTE(no-CAS) `timestamps` runs with interrupts disabled
15 let n = COUNT.load(Ordering::Relaxed);
16 COUNT.store(n + 1, Ordering::Relaxed);
17 n as u64
18 }
19}