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
//! MCU core clock support.
//!
//! This module contains common definitions to abtract over the MCU core clock speed.  `avr-hal`
//! does not support changing the clock-speed at runtime.
//!
//! Most items in this module are re-exported from [`avr_hal_generic::clock`].
pub use avr_hal_generic::clock::*;

pub(crate) mod default {
    /// Default clock speed for this board.
    ///
    /// `arduino-hal` contains a lot of type aliases for assuming this clock speed.  As such it is
    /// easiest to keep the processor at the selected default speed.
    ///
    /// However, you can of course still use other clock speeds but you'll then need to correctly
    /// name the types from the HAL crate using your own clock definition.
    #[cfg(any(
        feature = "arduino-diecimila",
        feature = "arduino-leonardo",
        feature = "arduino-mega2560",
        feature = "arduino-mega1280",
        feature = "arduino-nano",
        feature = "arduino-uno",
        feature = "sparkfun-promicro",
        feature = "sparkfun-promini-5v",
        feature = "trinket-pro",
        feature = "nano168",
    ))]
    pub type DefaultClock = avr_hal_generic::clock::MHz16;
    #[cfg(any(feature = "trinket", feature = "sparkfun-promini-3v3"))]
    pub type DefaultClock = avr_hal_generic::clock::MHz8;
}