aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/time.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/embassy-stm32/src/time.rs b/embassy-stm32/src/time.rs
index f08abe331..604503e61 100644
--- a/embassy-stm32/src/time.rs
+++ b/embassy-stm32/src/time.rs
@@ -8,31 +8,31 @@ use core::ops::{Div, Mul};
8pub struct Hertz(pub u32); 8pub struct Hertz(pub u32);
9 9
10impl Hertz { 10impl Hertz {
11 pub fn hz(hertz: u32) -> Self { 11 pub const fn hz(hertz: u32) -> Self {
12 Self(hertz) 12 Self(hertz)
13 } 13 }
14 14
15 pub fn khz(kilohertz: u32) -> Self { 15 pub const fn khz(kilohertz: u32) -> Self {
16 Self(kilohertz * 1_000) 16 Self(kilohertz * 1_000)
17 } 17 }
18 18
19 pub fn mhz(megahertz: u32) -> Self { 19 pub const fn mhz(megahertz: u32) -> Self {
20 Self(megahertz * 1_000_000) 20 Self(megahertz * 1_000_000)
21 } 21 }
22} 22}
23 23
24/// This is a convenience shortcut for [`Hertz::hz`] 24/// This is a convenience shortcut for [`Hertz::hz`]
25pub fn hz(hertz: u32) -> Hertz { 25pub const fn hz(hertz: u32) -> Hertz {
26 Hertz::hz(hertz) 26 Hertz::hz(hertz)
27} 27}
28 28
29/// This is a convenience shortcut for [`Hertz::khz`] 29/// This is a convenience shortcut for [`Hertz::khz`]
30pub fn khz(kilohertz: u32) -> Hertz { 30pub const fn khz(kilohertz: u32) -> Hertz {
31 Hertz::khz(kilohertz) 31 Hertz::khz(kilohertz)
32} 32}
33 33
34/// This is a convenience shortcut for [`Hertz::mhz`] 34/// This is a convenience shortcut for [`Hertz::mhz`]
35pub fn mhz(megahertz: u32) -> Hertz { 35pub const fn mhz(megahertz: u32) -> Hertz {
36 Hertz::mhz(megahertz) 36 Hertz::mhz(megahertz)
37} 37}
38 38