aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f0
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-04-02 04:35:06 +0200
committerDario Nieuwenhuis <[email protected]>2022-04-02 04:35:06 +0200
commit82803bffdab0842bf6c3e4bce21131d437b06669 (patch)
tree588c65c93b31b897f53d389f7876dc2703eb0fa8 /examples/stm32f0
parenta9e63167e1ec230ca3d28da771378f5f4936a840 (diff)
Use embassy/defmt-timestamp-uptime in all examples.
Diffstat (limited to 'examples/stm32f0')
-rw-r--r--examples/stm32f0/Cargo.toml4
-rw-r--r--examples/stm32f0/src/bin/hello.rs5
-rw-r--r--examples/stm32f0/src/example_common.rs17
3 files changed, 4 insertions, 22 deletions
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml
index 0f76dabf0..c973c1f7c 100644
--- a/examples/stm32f0/Cargo.toml
+++ b/examples/stm32f0/Cargo.toml
@@ -13,6 +13,6 @@ cortex-m-rt = "0.7.0"
13defmt = "0.3" 13defmt = "0.3"
14defmt-rtt = "0.3" 14defmt-rtt = "0.3"
15panic-probe = "0.3" 15panic-probe = "0.3"
16embassy = { path = "../../embassy", features = ["defmt"] } 16embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime"] }
17embassy-stm32 = { path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f030f4", "time-driver-any"] } 17embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f030f4", "time-driver-any"] }
18 18
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
5use defmt::info; 5use defmt::info;
6
7use embassy::executor::Spawner; 6use embassy::executor::Spawner;
8use embassy::time::{Duration, Timer}; 7use embassy::time::{Duration, Timer};
9use embassy_stm32::Peripherals; 8use embassy_stm32::Peripherals;
10 9
11#[path = "../example_common.rs"] 10use defmt_rtt as _; // global logger
12mod example_common; 11use panic_probe as _;
13 12
14#[embassy::main] 13#[embassy::main]
15async fn main(_spawner: Spawner, _p: Peripherals) -> ! { 14async 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
3use defmt_rtt as _; // global logger
4use panic_probe as _;
5
6pub use defmt::*;
7
8use core::sync::atomic::{AtomicUsize, Ordering};
9
10defmt::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}