Module stm32f1xx_hal::time [−][src]
Expand description
Time units
See Hertz
, KiloHertz
and MegaHertz
for creating increasingly higher frequencies.
The U32Ext
trait adds various methods like .hz()
, .mhz()
, etc to the u32
primitive type,
allowing it to be converted into frequencies.
Examples
Create a 2 MHz frequency
This example demonstrates various ways of creating a 2 MHz (2_000_000 Hz) frequency. They are
all equivalent, however the 2.mhz()
variant should be preferred for readability.
use stm32f1xx_hal::{
time::Hertz,
// Imports U32Ext trait
prelude::*,
};
let freq_hz = 2_000_000.hz();
let freq_khz = 2_000.khz();
let freq_mhz = 2.mhz();
assert_eq!(freq_hz, freq_khz);
assert_eq!(freq_khz, freq_mhz);
Structs
Bits per second
Hertz
A measurement of a monotonically non-decreasing clock
Kilohertz
Megahertz
Time unit
A monotonic non-decreasing timer
Traits
Extension trait that adds convenience methods to the u32
type