aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f2
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/stm32f2
parenta9e63167e1ec230ca3d28da771378f5f4936a840 (diff)
Use embassy/defmt-timestamp-uptime in all examples.
Diffstat (limited to 'examples/stm32f2')
-rw-r--r--examples/stm32f2/Cargo.toml2
-rw-r--r--examples/stm32f2/src/bin/blinky.rs8
-rw-r--r--examples/stm32f2/src/example_common.rs19
3 files changed, 5 insertions, 24 deletions
diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml
index ee1d7ce2b..4eef3a6fe 100644
--- a/examples/stm32f2/Cargo.toml
+++ b/examples/stm32f2/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
6resolver = "2" 6resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f207zg", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
11 11
12defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32f2/src/bin/blinky.rs b/examples/stm32f2/src/bin/blinky.rs
index 637c2f4fd..395f4df51 100644
--- a/examples/stm32f2/src/bin/blinky.rs
+++ b/examples/stm32f2/src/bin/blinky.rs
@@ -2,14 +2,14 @@
2#![no_main] 2#![no_main]
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5#[path = "../example_common.rs"] 5use defmt::*;
6mod example_common;
7
8use embassy::executor::Spawner; 6use embassy::executor::Spawner;
9use embassy::time::{Duration, Timer}; 7use embassy::time::{Duration, Timer};
10use embassy_stm32::gpio::{Level, Output, Speed}; 8use embassy_stm32::gpio::{Level, Output, Speed};
11use embassy_stm32::Peripherals; 9use embassy_stm32::Peripherals;
12use example_common::*; 10
11use defmt_rtt as _; // global logger
12use panic_probe as _;
13 13
14#[embassy::main] 14#[embassy::main]
15async fn main(_spawner: Spawner, p: Peripherals) { 15async fn main(_spawner: Spawner, p: Peripherals) {
diff --git a/examples/stm32f2/src/example_common.rs b/examples/stm32f2/src/example_common.rs
deleted file mode 100644
index e14517033..000000000
--- a/examples/stm32f2/src/example_common.rs
+++ /dev/null
@@ -1,19 +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! {
11 "{=u64}",
12 {
13 static COUNT: AtomicUsize = AtomicUsize::new(0);
14 // NOTE(no-CAS) `timestamps` runs with interrupts disabled
15 let n = COUNT.load(Ordering::Relaxed);
16 COUNT.store(n + 1, Ordering::Relaxed);
17 n as u64
18 }
19}