stm32/spi: issue correct DMA word length when reading

Currently, when calling read() of the SPI bus, DMA always transmits u8,
which will cause hang if SPI transfer size > 8bit. Use matching word
size for TX DMA instead.
This commit is contained in:
Shaw Drastin 2024-09-22 02:05:17 +08:00 committed by Dario Nieuwenhuis
parent 233905e18c
commit db31e36485

View File

@ -783,7 +783,7 @@ impl<'d> Spi<'d, Async> {
let rx_f = unsafe { self.rx_dma.as_mut().unwrap().read(rx_src, data, Default::default()) };
let tx_dst = self.info.regs.tx_ptr();
let clock_byte = 0x00u8;
let clock_byte = W::default();
let tx_f = unsafe {
self.tx_dma
.as_mut()
@ -1195,7 +1195,7 @@ trait SealedWord {
/// Word sizes usable for SPI.
#[allow(private_bounds)]
pub trait Word: word::Word + SealedWord {}
pub trait Word: word::Word + SealedWord + Default {}
macro_rules! impl_word {
($T:ty, $config:expr) => {