Skip to content

Commit 99c11dc

Browse files
committed
sdmmcspi: add method for borrowing spi (useful for re-clocking)
It is currently possible to re-clock the SPI after acquiring the BlockSpi struct. However, if this fails later or needs to be re-done the SPI bus should be clocked down to 100 - 400 kHz again. There is no way to do this before acquiring without borrowing the spi device from SdmmcSpi.
1 parent aa1d3c2 commit 99c11dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sdmmc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@ where
360360
}
361361
Ok(())
362362
}
363+
364+
/// Get a temporary borrow on the underlying SPI device. Useful if you
365+
/// need to re-clock the SPI.
366+
pub fn spi(&mut self) -> core::cell::RefMut<SPI> {
367+
self.spi.borrow_mut()
368+
}
363369
}
364370

365371
impl<SPI, CS> BlockSpi<'_, SPI, CS>

0 commit comments

Comments
 (0)