summaryrefslogtreecommitdiff
path: root/examples/stm32g0
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-04-02 04:35:06 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-04-02 04:35:06 +0200
commit82803bffdab0842bf6c3e4bce21131d437b06669 (patch)
tree588c65c93b31b897f53d389f7876dc2703eb0fa8 /examples/stm32g0
parenta9e63167e1ec230ca3d28da771378f5f4936a840 (diff)
downloadembassy-82803bffdab0842bf6c3e4bce21131d437b06669.zip
Use embassy/defmt-timestamp-uptime in all examples.
Diffstat (limited to 'examples/stm32g0')
-rw-r--r--examples/stm32g0/Cargo.toml2
-rw-r--r--examples/stm32g0/src/bin/blinky.rs6
-rw-r--r--examples/stm32g0/src/bin/button.rs6
-rw-r--r--examples/stm32g0/src/bin/button_exti.rs6
-rw-r--r--examples/stm32g0/src/example_common.rs17
5 files changed, 10 insertions, 27 deletions
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml
index a72ba534..9facbc5c 100644
--- a/examples/stm32g0/Cargo.toml
+++ b/examples/stm32g0/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
resolver = "2"
[dependencies]
-embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
+embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] }
defmt = "0.3"
diff --git a/examples/stm32g0/src/bin/blinky.rs b/examples/stm32g0/src/bin/blinky.rs
index 00d67dac..8b85ca96 100644
--- a/examples/stm32g0/src/bin/blinky.rs
+++ b/examples/stm32g0/src/bin/blinky.rs
@@ -2,13 +2,13 @@
#![no_main]
#![feature(type_alias_impl_trait)]
-#[path = "../example_common.rs"]
-mod example_common;
+use defmt::*;
+use defmt_rtt as _; // global logger
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::Peripherals;
-use example_common::*;
+use panic_probe as _;
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
diff --git a/examples/stm32g0/src/bin/button.rs b/examples/stm32g0/src/bin/button.rs
index e901c575..78d7ba1f 100644
--- a/examples/stm32g0/src/bin/button.rs
+++ b/examples/stm32g0/src/bin/button.rs
@@ -2,11 +2,11 @@
#![no_main]
#![feature(type_alias_impl_trait)]
-#[path = "../example_common.rs"]
-mod example_common;
use cortex_m_rt::entry;
+use defmt::*;
+use defmt_rtt as _; // global logger
use embassy_stm32::gpio::{Input, Pull};
-use example_common::*;
+use panic_probe as _;
#[entry]
fn main() -> ! {
diff --git a/examples/stm32g0/src/bin/button_exti.rs b/examples/stm32g0/src/bin/button_exti.rs
index 848818bf..4b1cadcb 100644
--- a/examples/stm32g0/src/bin/button_exti.rs
+++ b/examples/stm32g0/src/bin/button_exti.rs
@@ -2,13 +2,13 @@
#![no_main]
#![feature(type_alias_impl_trait)]
-#[path = "../example_common.rs"]
-mod example_common;
+use defmt::*;
+use defmt_rtt as _; // global logger
use embassy::executor::Spawner;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
use embassy_stm32::Peripherals;
-use example_common::*;
+use panic_probe as _;
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
diff --git a/examples/stm32g0/src/example_common.rs b/examples/stm32g0/src/example_common.rs
deleted file mode 100644
index 54d63383..00000000
--- a/examples/stm32g0/src/example_common.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![macro_use]
-
-use defmt_rtt as _; // global logger
-use panic_probe as _;
-
-pub use defmt::*;
-
-use core::sync::atomic::{AtomicUsize, Ordering};
-
-defmt::timestamp! {"{=u64}", {
- static COUNT: AtomicUsize = AtomicUsize::new(0);
- // NOTE(no-CAS) `timestamps` runs with interrupts disabled
- let n = COUNT.load(Ordering::Relaxed);
- COUNT.store(n + 1, Ordering::Relaxed);
- n as u64
- }
-}