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§
- Bps
- Bits per second
- Duration
- Represents a duration of time.
- DwtInstant
- A
TickInstantimplementation - Instant
- A measurement of a monotonically non-decreasing clock
- Mono
Timer - A monotonic non-decreasing timer
Traits§
- U32Ext
- Extension trait that adds convenience methods to the
u32type
Functions§
Type Aliases§
- Hertz
- Alias for hertz rate (
u32backing storage) - Kilo
Hertz - Alias for kilohertz rate (
u32backing storage) - Mega
Hertz - Alias for megahertz rate (
u32backing storage) - Micro
Seconds - Alias for microsecond duration (
u32backing storage) - Milli
Seconds - Alias for millisecond duration (
u32backing storage) - Nanos
Duration U64 - Alias for nanosecond duration (
u64backing storage)