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:
parent
233905e18c
commit
db31e36485
@ -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 rx_f = unsafe { self.rx_dma.as_mut().unwrap().read(rx_src, data, Default::default()) };
|
||||||
|
|
||||||
let tx_dst = self.info.regs.tx_ptr();
|
let tx_dst = self.info.regs.tx_ptr();
|
||||||
let clock_byte = 0x00u8;
|
let clock_byte = W::default();
|
||||||
let tx_f = unsafe {
|
let tx_f = unsafe {
|
||||||
self.tx_dma
|
self.tx_dma
|
||||||
.as_mut()
|
.as_mut()
|
||||||
@ -1195,7 +1195,7 @@ trait SealedWord {
|
|||||||
|
|
||||||
/// Word sizes usable for SPI.
|
/// Word sizes usable for SPI.
|
||||||
#[allow(private_bounds)]
|
#[allow(private_bounds)]
|
||||||
pub trait Word: word::Word + SealedWord {}
|
pub trait Word: word::Word + SealedWord + Default {}
|
||||||
|
|
||||||
macro_rules! impl_word {
|
macro_rules! impl_word {
|
||||||
($T:ty, $config:expr) => {
|
($T:ty, $config:expr) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user