//! Clock System use core::cmp; use pac::{cs, CS}; use crate::time::Hertz; /// Extension trait that constrains the `CS` peripheral pub trait CsExt { /// Constrains the `CS` peripheral so that it plays nicely with other abstractions fn constrain(self) -> Cs; } impl CsExt for CS { fn constrain(self) -> Cs { Cs { } } } /* +--------+-----------------------+---------------+-------------------------------------+ | Clock | Default Clock Source | Default Clock | Description | | | | Frequency | | +========+=======================+===============+=====================================+ | MCLK | DCO | 3 MHz | Master Clock - Sources CPU and | | | | | peripherals | +--------+-----------------------+---------------+-------------------------------------+ | HSMCLK | DCO | 3 MHz | Subsystem Master Clock - Sources | | | | | peripherals | +--------+-----------------------+---------------+-------------------------------------+ | SMCLK | DCO | 3 MHz | Low-speed subsystem master clock - | | | | | Sources peripherals | +--------+-----------------------+---------------+-------------------------------------+ | ACLK | LFXT (or REFO if no | 32.768 kHz | Auxiliary clock - Sources | | | crystal present) | | peripherals | +--------+-----------------------+---------------+-------------------------------------+ | BCLK | LFXT (or REFO if no | 32.768 kHz | Low-speed backup domain clock - | | | crystal present) | | Sources LPM peripherals | +--------+-----------------------+---------------+-------------------------------------+ */ pub struct Cs { } /// Frozen clock frequencies /// /// This value holds the current clocks frequencies and indicates that they can /// no longer be changed #[derive(Clone, Copy)] pub struct Clocks { sysclk: Hertz, } impl Clocks { /// Returns the system (core) frequency pub fn sysclk(&self) -> Hertz { self.sysclk } }