aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/time.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/embassy-stm32/src/time.rs b/embassy-stm32/src/time.rs
index 71fe668a9..532877f70 100644
--- a/embassy-stm32/src/time.rs
+++ b/embassy-stm32/src/time.rs
@@ -5,7 +5,6 @@ use core::ops::{Div, Mul};
5 5
6/// Hertz 6/// Hertz
7#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Debug)] 7#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Debug)]
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9pub struct Hertz(pub u32); 8pub struct Hertz(pub u32);
10 9
11impl Display for Hertz { 10impl Display for Hertz {
@@ -14,6 +13,13 @@ impl Display for Hertz {
14 } 13 }
15} 14}
16 15
16#[cfg(feature = "defmt")]
17impl defmt::Format for Hertz {
18 fn format(&self, f: defmt::Formatter) {
19 defmt::write!(f, "{=u32} Hz", self.0)
20 }
21}
22
17impl Hertz { 23impl Hertz {
18 /// Create a `Hertz` from the given hertz. 24 /// Create a `Hertz` from the given hertz.
19 pub const fn hz(hertz: u32) -> Self { 25 pub const fn hz(hertz: u32) -> Self {