arduino_hal/clock.rs
1//! MCU core clock support.
2//!
3//! This module contains common definitions to abtract over the MCU core clock speed. `avr-hal`
4//! does not support changing the clock-speed at runtime.
5//!
6//! Most items in this module are re-exported from [`avr_hal_generic::clock`].
7pub use avr_hal_generic::clock::*;
8
9pub(crate) mod default {
10 /// Default clock speed for this board.
11 ///
12 /// `arduino-hal` contains a lot of type aliases for assuming this clock speed. As such it is
13 /// easiest to keep the processor at the selected default speed.
14 ///
15 /// However, you can of course still use other clock speeds but you'll then need to correctly
16 /// name the types from the HAL crate using your own clock definition.
17 #[cfg(any(
18 feature = "arduino-diecimila",
19 feature = "arduino-leonardo",
20 feature = "arduino-mega2560",
21 feature = "arduino-mega1280",
22 feature = "arduino-nano",
23 feature = "arduino-uno",
24 feature = "sparkfun-promicro",
25 feature = "sparkfun-promini-5v",
26 feature = "trinket-pro",
27 feature = "nano168",
28 ))]
29 pub type DefaultClock = avr_hal_generic::clock::MHz16;
30 #[cfg(any(feature = "trinket", feature = "sparkfun-promini-3v3"))]
31 pub type DefaultClock = avr_hal_generic::clock::MHz8;
32}