Use modify() for subsequent changes to RCC.cr()

This commit is contained in:
Frank Stevenson 2025-06-03 15:47:33 +02:00
parent c637ee7d79
commit 011d7832f8

View File

@ -181,7 +181,7 @@ pub(crate) unsafe fn init(config: Config) {
w.set_msikrange(range); w.set_msikrange(range);
w.set_msirgsel(Msirgsel::ICSCR1); w.set_msirgsel(Msirgsel::ICSCR1);
}); });
RCC.cr().write(|w| { RCC.cr().modify(|w| {
w.set_msikon(true); w.set_msikon(true);
}); });
while !RCC.cr().read().msikrdy() {} while !RCC.cr().read().msikrdy() {}
@ -189,7 +189,7 @@ pub(crate) unsafe fn init(config: Config) {
}); });
let hsi = config.hsi.then(|| { let hsi = config.hsi.then(|| {
RCC.cr().write(|w| w.set_hsion(true)); RCC.cr().modify(|w| w.set_hsion(true));
while !RCC.cr().read().hsirdy() {} while !RCC.cr().read().hsirdy() {}
HSI_FREQ HSI_FREQ
@ -207,7 +207,7 @@ pub(crate) unsafe fn init(config: Config) {
} }
// Enable HSE, and wait for it to stabilize // Enable HSE, and wait for it to stabilize
RCC.cr().write(|w| { RCC.cr().modify(|w| {
w.set_hseon(true); w.set_hseon(true);
w.set_hsebyp(hse.mode != HseMode::Oscillator); w.set_hsebyp(hse.mode != HseMode::Oscillator);
w.set_hseext(match hse.mode { w.set_hseext(match hse.mode {