Fix frequency range check.

This commit is contained in:
Nic0w 2021-04-25 08:58:43 +02:00
parent d5cbd44ade
commit 72694a07b5

View file

@ -94,7 +94,9 @@ impl CrystalOscillator<Disabled> {
const STABLE_DELAY: Milliseconds = Milliseconds(1_u32); const STABLE_DELAY: Milliseconds = Milliseconds(1_u32);
const DIVIDER: Fraction = Fraction::new(256, 1); const DIVIDER: Fraction = Fraction::new(256, 1);
if !ALLOWED_FREQUENCY_RANGE.contains(&frequency) { let freq_mhz: Megahertz = frequency.into();
if !ALLOWED_FREQUENCY_RANGE.contains(&freq_mhz) {
return Err(Error::FrequencyOutOfRange) return Err(Error::FrequencyOutOfRange)
} }
@ -120,7 +122,7 @@ impl CrystalOscillator<Disabled> {
map_err(|_|Error::BadArgument)?; map_err(|_|Error::BadArgument)?;
self.device.startup.write(|w| unsafe { self.device.startup.write(|w| unsafe {
w.delay().bits(startup_delay+1); w.delay().bits(startup_delay);
w w
}); });