aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-05-01 18:16:29 +0200
committerDario Nieuwenhuis <[email protected]>2023-05-01 23:20:51 +0200
commit1806422763be4e9e47201f741a03e5968fc8dedb (patch)
tree55322d96ef2101fe10942339d02397227b051105 /tests
parent00cde67abe23aa299f94fb6e1aa6cb2c3de69788 (diff)
stm32/test: add real defmt timestamp
Diffstat (limited to 'tests')
-rw-r--r--tests/stm32/Cargo.toml3
-rw-r--r--tests/stm32/src/example_common.rs11
2 files changed, 2 insertions, 12 deletions
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index eca470358..5cd949661 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -22,8 +22,9 @@ not-gpdma = []
22[dependencies] 22[dependencies]
23embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } 23embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
24embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 24embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
25embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768"] } 25embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] }
26embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] } 26embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] }
27embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
27 28
28defmt = "0.3.0" 29defmt = "0.3.0"
29defmt-rtt = "0.4" 30defmt-rtt = "0.4"
diff --git a/tests/stm32/src/example_common.rs b/tests/stm32/src/example_common.rs
index c47ed75c4..a4f8668c7 100644
--- a/tests/stm32/src/example_common.rs
+++ b/tests/stm32/src/example_common.rs
@@ -1,22 +1,11 @@
1#![macro_use] 1#![macro_use]
2 2
3use core::sync::atomic::{AtomicUsize, Ordering};
4
5pub use defmt::*; 3pub use defmt::*;
6#[allow(unused)] 4#[allow(unused)]
7use embassy_stm32::time::Hertz; 5use embassy_stm32::time::Hertz;
8use embassy_stm32::Config; 6use embassy_stm32::Config;
9use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
10 8
11defmt::timestamp! {"{=u64}", {
12 static COUNT: AtomicUsize = AtomicUsize::new(0);
13 // NOTE(no-CAS) `timestamps` runs with interrupts disabled
14 let n = COUNT.load(Ordering::Relaxed);
15 COUNT.store(n + 1, Ordering::Relaxed);
16 n as u64
17 }
18}
19
20pub fn config() -> Config { 9pub fn config() -> Config {
21 #[allow(unused_mut)] 10 #[allow(unused_mut)]
22 let mut config = Config::default(); 11 let mut config = Config::default();