1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Generic trait for clock speeds

/// A clock speed
pub trait Clock {
    /// Frequency of this clock in Hz
    const FREQ: u32;
}

/// 24 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz24;
impl Clock for MHz24 {
    const FREQ: u32 = 24_000_000;
}

/// 20 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz20;
impl Clock for MHz20 {
    const FREQ: u32 = 20_000_000;
}

/// 16 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz16;
impl Clock for MHz16 {
    const FREQ: u32 = 16_000_000;
}

/// 12 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz12;
impl Clock for MHz12 {
    const FREQ: u32 = 12_000_000;
}

/// 8 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz8;
impl Clock for MHz8 {
    const FREQ: u32 = 8_000_000;
}

/// 1 MHz Clock
#[derive(ufmt::derive::uDebug, Debug)]
pub struct MHz1;
impl Clock for MHz1 {
    const FREQ: u32 = 1_000_000;
}