Module stm32f1xx_hal::time
source · Expand description
Time units
See Hertz
, KiloHertz
and MegaHertz
for creating increasingly higher frequencies.
The fugit::ExtU32
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
A measurement of a monotonically non-decreasing clock
A monotonic non-decreasing timer
Traits
Extension trait that adds convenience methods to the
u32
typeFunctions
Type Definitions
Alias for hertz rate (
u32
backing storage)Alias for kilohertz rate (
u32
backing storage)Alias for megahertz rate (
u32
backing storage)Alias for microsecond duration (
u32
backing storage)Alias for millisecond duration (
u32
backing storage)