Module time

Module 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§

Bps
Bits per second
Duration
Represents a duration of time.
DwtInstant
A TickInstant implementation
Instant
A measurement of a monotonically non-decreasing clock
MonoTimer
A monotonic non-decreasing timer

Traits§

U32Ext
Extension trait that adds convenience methods to the u32 type

Functions§

Hz
MHz
kHz
ms
us

Type Aliases§

Hertz
Alias for hertz rate (u32 backing storage)
KiloHertz
Alias for kilohertz rate (u32 backing storage)
MegaHertz
Alias for megahertz rate (u32 backing storage)
MicroSeconds
Alias for microsecond duration (u32 backing storage)
MilliSeconds
Alias for millisecond duration (u32 backing storage)
NanosDurationU64
Alias for nanosecond duration (u64 backing storage)