mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
rp/spi: disable+enable when setting frequency
This commit is contained in:
parent
dbff5cc232
commit
da33b3a4d2
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user