Skip to main content

k210_hal/
clock.rs

1//! Clock configuration
2//use crate::pac::PRCI;
3use crate::time::Hertz;
4
5/// Frozen clock frequencies
6///
7/// The existence of this value indicates that the clock configuration can no
8/// longer be changed.
9#[derive(Clone, Copy)]
10pub struct Clocks {
11    cpu: Hertz,
12    apb0: Hertz,
13}
14
15impl Clocks {
16    #[doc(hidden)]
17    pub fn new() -> Self {
18/*
19        [MAIXPY]Pll0:freq:806000000
20        [MAIXPY]Pll1:freq:398666666
21        [MAIXPY]Pll2:freq:45066666
22        [MAIXPY]cpu:freq:403000000
23        [MAIXPY]kpu:freq:398666666
24        in freq: 26000000
25        cpu_freq: 390000000
26*/
27        Self {
28            cpu: Hertz(403_000_000),
29            apb0: Hertz(195_000_000),
30        }
31    }
32
33    /// Returns CPU frequency
34    pub fn cpu(&self) -> Hertz {
35        Hertz(self.cpu.0)
36    }
37
38    /// Returns APB0 frequency
39    pub fn apb0(&self) -> Hertz {
40        self.apb0
41    }
42}