diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-12-06 21:42:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-06 21:42:47 +0000 |
| commit | 7058f29cf049d2ba14c0f8d99ad964dc1ded918c (patch) | |
| tree | 57a3647217dce831e713e4709835ec2388050682 /tests/stm32/src/example_common.rs | |
| parent | 8b4a247af2b54bd4deb8416b6181791e381c5aa3 (diff) | |
| parent | dd32358d6bb24895c833bc4c34fd96e7632e43a9 (diff) | |
Merge #451
451: stm32f4 GPIO HIL test r=Dirbaio a=Dirbaio
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'tests/stm32/src/example_common.rs')
| -rw-r--r-- | tests/stm32/src/example_common.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/stm32/src/example_common.rs b/tests/stm32/src/example_common.rs new file mode 100644 index 000000000..54d633837 --- /dev/null +++ b/tests/stm32/src/example_common.rs | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #![macro_use] | ||
| 2 | |||
| 3 | use defmt_rtt as _; // global logger | ||
| 4 | use panic_probe as _; | ||
| 5 | |||
| 6 | pub use defmt::*; | ||
| 7 | |||
| 8 | use core::sync::atomic::{AtomicUsize, Ordering}; | ||
| 9 | |||
| 10 | defmt::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 | } | ||
