diff options
| -rw-r--r-- | embassy-stm32/src/time.rs | 7 |
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 | ||
| 3 | use core::fmt::Display; | ||
| 3 | use core::ops::{Div, Mul}; | 4 | use 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))] |
| 8 | pub struct Hertz(pub u32); | 9 | pub struct Hertz(pub u32); |
| 9 | 10 | ||
| 11 | impl Display for Hertz { | ||
| 12 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
| 13 | write!(f, "{} Hz", self.0) | ||
| 14 | } | ||
| 15 | } | ||
| 16 | |||
| 10 | impl Hertz { | 17 | impl 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 { |
