RP2040: Fixes as per PR

This commit is contained in:
Michael van Niekerk 2023-08-30 21:59:41 +02:00
parent a76ff53fb3
commit 83a976cf4b

View File

@ -631,7 +631,7 @@ fn start_xosc(crystal_hz: u32, delay_multiplier: u32) {
.ctrl() .ctrl()
.write(|w| w.set_freq_range(pac::xosc::vals::CtrlFreqRange::_1_15MHZ)); .write(|w| w.set_freq_range(pac::xosc::vals::CtrlFreqRange::_1_15MHZ));
let startup_delay = (((crystal_hz / 1000) + 128) * delay_multiplier) / 256; let startup_delay = (((crystal_hz / 1000) * delay_multiplier) + 128) / 256;
pac::XOSC.startup().write(|w| w.set_delay(startup_delay as u16)); pac::XOSC.startup().write(|w| w.set_delay(startup_delay as u16));
pac::XOSC.ctrl().write(|w| { pac::XOSC.ctrl().write(|w| {
w.set_freq_range(pac::xosc::vals::CtrlFreqRange::_1_15MHZ); w.set_freq_range(pac::xosc::vals::CtrlFreqRange::_1_15MHZ);