Rename AVR_FREQUENCY to AVR_FREQUENCY_HZ
A bit less ambiguous.
This commit is contained in:
parent
dcab721dc1
commit
4b451634e7
|
@ -42,8 +42,8 @@ fn generate_config_module() -> Result<(), io::Error> {
|
|||
let path = src_path().join("config.rs");
|
||||
let mut f = File::create(&path)?;
|
||||
|
||||
let clock = env!("AVR_CPU_FREQUENCY");
|
||||
writeln!(f, "pub const CPU_FREQUENCY: u32 = {};", clock)?;
|
||||
let clock = env!("AVR_CPU_FREQUENCY_HZ");
|
||||
writeln!(f, "pub const CPU_FREQUENCY_HZ: u32 = {};", clock)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -19,17 +19,17 @@ pub struct ClockMask(pub u8);
|
|||
impl ClockMask {
|
||||
/// Gets the clock mask for a specific baute rate.
|
||||
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
|
||||
} else if spi_clock >= config::CPU_FREQUENCY / 4 {
|
||||
} else if spi_clock >= config::CPU_FREQUENCY_HZ / 4 {
|
||||
1
|
||||
} else if spi_clock >= config::CPU_FREQUENCY / 8 {
|
||||
} else if spi_clock >= config::CPU_FREQUENCY_HZ / 8 {
|
||||
2
|
||||
} else if spi_clock >= config::CPU_FREQUENCY / 16 {
|
||||
} else if spi_clock >= config::CPU_FREQUENCY_HZ / 16 {
|
||||
3
|
||||
} else if spi_clock >= config::CPU_FREQUENCY / 32 {
|
||||
} else if spi_clock >= config::CPU_FREQUENCY_HZ / 32 {
|
||||
4
|
||||
} else if spi_clock >= config::CPU_FREQUENCY / 64 {
|
||||
} else if spi_clock >= config::CPU_FREQUENCY_HZ / 64 {
|
||||
5
|
||||
} else {
|
||||
6
|
||||
|
|
Loading…
Reference in New Issue