Rename AVR_FREQUENCY to AVR_FREQUENCY_HZ

A bit less ambiguous.
This commit is contained in:
Dylan McKay 2018-11-05 20:16:51 +13:00
parent dcab721dc1
commit 4b451634e7
2 changed files with 8 additions and 8 deletions

View File

@ -42,8 +42,8 @@ fn generate_config_module() -> Result<(), io::Error> {
let path = src_path().join("config.rs"); let path = src_path().join("config.rs");
let mut f = File::create(&path)?; let mut f = File::create(&path)?;
let clock = env!("AVR_CPU_FREQUENCY"); let clock = env!("AVR_CPU_FREQUENCY_HZ");
writeln!(f, "pub const CPU_FREQUENCY: u32 = {};", clock)?; writeln!(f, "pub const CPU_FREQUENCY_HZ: u32 = {};", clock)?;
Ok(()) Ok(())
} }

View File

@ -19,17 +19,17 @@ pub struct ClockMask(pub u8);
impl ClockMask { impl ClockMask {
/// Gets the clock mask for a specific baute rate. /// Gets the clock mask for a specific baute rate.
pub fn with_clock(spi_clock: u32) -> ClockMask { pub fn with_clock(spi_clock: u32) -> ClockMask {
let mut divider_bits = if spi_clock >= config::CPU_FREQUENCY / 2 { let mut divider_bits = if spi_clock >= config::CPU_FREQUENCY_HZ / 2 {
0 0
} else if spi_clock >= config::CPU_FREQUENCY / 4 { } else if spi_clock >= config::CPU_FREQUENCY_HZ / 4 {
1 1
} else if spi_clock >= config::CPU_FREQUENCY / 8 { } else if spi_clock >= config::CPU_FREQUENCY_HZ / 8 {
2 2
} else if spi_clock >= config::CPU_FREQUENCY / 16 { } else if spi_clock >= config::CPU_FREQUENCY_HZ / 16 {
3 3
} else if spi_clock >= config::CPU_FREQUENCY / 32 { } else if spi_clock >= config::CPU_FREQUENCY_HZ / 32 {
4 4
} else if spi_clock >= config::CPU_FREQUENCY / 64 { } else if spi_clock >= config::CPU_FREQUENCY_HZ / 64 {
5 5
} else { } else {
6 6