Use 'avr-config' for CPU frequency logic rather than reimplement it

This crate is also used by the 'delay' crate.
This commit is contained in:
Dylan McKay 2021-02-02 01:45:41 +13:00
parent 37884cc15f
commit 8d3c2466ce
3 changed files with 2 additions and 14 deletions

View File

@ -28,6 +28,7 @@ default = ["avr-std-stub"]
all-mcus = []
[dependencies]
avr-config = "1.0"
avr-std-stub = { version = "1.0", optional = true }
const_env--value = "0.1"
target-cpu-macro = "0.1"

View File

@ -1,13 +0,0 @@
#[cfg(target_arch = "avr")] use const_env::value_from_env;
/// The clock frequency of device being targeted in Hertz.
#[cfg(target_arch = "avr")]
pub const CPU_FREQUENCY_HZ: u32 = value_from_env!("AVR_CPU_FREQUENCY_HZ": u32);
/// The clock frequency of device being targeted in Hertz.
///
/// This value is arbitrarily set to 16MHz as this crate is currently being targeted for a non-AVR
/// device.
#[cfg(not(target_arch = "avr"))]
pub const CPU_FREQUENCY_HZ: u32 = 16_000_000; // Choose a nice default when not targeting AVR.

View File

@ -24,7 +24,7 @@ pub mod interrupt;
pub mod modules;
/// Configuration for the currently-targeted microcontroller.
pub mod config;
pub use avr_config as config;
mod register;
mod pin;