From 8d3c2466cea05eda8194cefaca0ae53c53f13985 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Tue, 2 Feb 2021 01:45:41 +1300 Subject: [PATCH] Use 'avr-config' for CPU frequency logic rather than reimplement it This crate is also used by the 'delay' crate. --- Cargo.toml | 1 + src/config.rs | 13 ------------- src/lib.rs | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 src/config.rs diff --git a/Cargo.toml b/Cargo.toml index 0679f97..c63b3d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/config.rs b/src/config.rs deleted file mode 100644 index bb7723f..0000000 --- a/src/config.rs +++ /dev/null @@ -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. - diff --git a/src/lib.rs b/src/lib.rs index b0a1c26..467e171 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;