diff options
| author | Mariusz Ryndzionek <[email protected]> | 2021-09-26 17:08:22 +0200 |
|---|---|---|
| committer | Mariusz Ryndzionek <[email protected]> | 2021-09-28 18:31:04 +0200 |
| commit | bce909ec1eea95f93a6887aae5aa0b37d953ec85 (patch) | |
| tree | d22557144ceab9172e8b1d4784fab870d48b9816 /examples/stm32f1/src/example_common.rs | |
| parent | 1650983e463e5f237d68957b0de1537f807cbc63 (diff) | |
Initial STM32F1 family support with two examples for STM32F103C8 (Blue Pill)
Diffstat (limited to 'examples/stm32f1/src/example_common.rs')
| -rw-r--r-- | examples/stm32f1/src/example_common.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/stm32f1/src/example_common.rs b/examples/stm32f1/src/example_common.rs new file mode 100644 index 000000000..54d633837 --- /dev/null +++ b/examples/stm32f1/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 | } | ||
