aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/time.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/embassy-stm32/src/time.rs b/embassy-stm32/src/time.rs
index 802ff41ce..71fe668a9 100644
--- a/embassy-stm32/src/time.rs
+++ b/embassy-stm32/src/time.rs
@@ -1,5 +1,6 @@
1//! Time units 1//! Time units
2 2
3use core::fmt::Display;
3use core::ops::{Div, Mul}; 4use core::ops::{Div, Mul};
4 5
5/// Hertz 6/// Hertz
@@ -7,6 +8,12 @@ use core::ops::{Div, Mul};
7#[cfg_attr(feature = "defmt", derive(defmt::Format))] 8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
8pub struct Hertz(pub u32); 9pub struct Hertz(pub u32);
9 10
11impl Display for Hertz {
12 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13 write!(f, "{} Hz", self.0)
14 }
15}
16
10impl Hertz { 17impl Hertz {
11 /// Create a `Hertz` from the given hertz. 18 /// Create a `Hertz` from the given hertz.
12 pub const fn hz(hertz: u32) -> Self { 19 pub const fn hz(hertz: u32) -> Self {