rp/spi: disable+enable when setting frequency

This commit is contained in:
Dario Nieuwenhuis 2021-07-20 09:43:06 +02:00
parent dbff5cc232
commit da33b3a4d2

View File

@ -142,10 +142,17 @@ impl<'d, T: Instance> Spi<'d, T> {
let (presc, postdiv) = calc_prescs(freq);
let p = self.inner.regs();
unsafe {
// disable
p.cr1().write(|w| w.set_sse(false));
// change stuff
p.cpsr().write(|w| w.set_cpsdvsr(presc));
p.cr0().modify(|w| {
w.set_scr(postdiv);
});
// enable
p.cr1().write(|w| w.set_sse(true));
}
}
}