diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-04-02 04:35:06 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-02 04:35:06 +0200 |
| commit | 82803bffdab0842bf6c3e4bce21131d437b06669 (patch) | |
| tree | 588c65c93b31b897f53d389f7876dc2703eb0fa8 /examples/stm32f0/src | |
| parent | a9e63167e1ec230ca3d28da771378f5f4936a840 (diff) | |
Use embassy/defmt-timestamp-uptime in all examples.
Diffstat (limited to 'examples/stm32f0/src')
| -rw-r--r-- | examples/stm32f0/src/bin/hello.rs | 5 | ||||
| -rw-r--r-- | examples/stm32f0/src/example_common.rs | 17 |
2 files changed, 2 insertions, 20 deletions
diff --git a/examples/stm32f0/src/bin/hello.rs b/examples/stm32f0/src/bin/hello.rs index 9f745f9ae..975e94f34 100644 --- a/examples/stm32f0/src/bin/hello.rs +++ b/examples/stm32f0/src/bin/hello.rs | |||
| @@ -3,13 +3,12 @@ | |||
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | |||
| 7 | use embassy::executor::Spawner; | 6 | use embassy::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 7 | use embassy::time::{Duration, Timer}; |
| 9 | use embassy_stm32::Peripherals; | 8 | use embassy_stm32::Peripherals; |
| 10 | 9 | ||
| 11 | #[path = "../example_common.rs"] | 10 | use defmt_rtt as _; // global logger |
| 12 | mod example_common; | 11 | use panic_probe as _; |
| 13 | 12 | ||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 14 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
diff --git a/examples/stm32f0/src/example_common.rs b/examples/stm32f0/src/example_common.rs deleted file mode 100644 index 54d633837..000000000 --- a/examples/stm32f0/src/example_common.rs +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 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 | } | ||
