mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 04:40:39 +00:00
Disable SPI before changing config, then re-enable SPI on STM32
Fixes #2259
This commit is contained in:
parent
fb5ce05b26
commit
d8631f96d9
@ -284,6 +284,10 @@ impl<'d, M: PeriMode> Spi<'d, M> {
|
||||
|
||||
#[cfg(any(spi_v3, spi_v4, spi_v5))]
|
||||
{
|
||||
self.info.regs.cr1().modify(|w| {
|
||||
w.set_spe(false);
|
||||
});
|
||||
|
||||
self.info.regs.cfg2().modify(|w| {
|
||||
w.set_cpha(cpha);
|
||||
w.set_cpol(cpol);
|
||||
@ -292,6 +296,10 @@ impl<'d, M: PeriMode> Spi<'d, M> {
|
||||
self.info.regs.cfg1().modify(|w| {
|
||||
w.set_mbr(br);
|
||||
});
|
||||
|
||||
self.info.regs.cr1().modify(|w| {
|
||||
w.set_spe(true);
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user