Skip to content

Commit 296b677

Browse files
committed
Fix buffer reference creation
1 parent 9343081 commit 296b677

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/spi/dma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<SPI: Instance, W: FrameSize + Word> Spi<SPI, W> {
213213
) -> Result<DuplexInplaceDmaTransfer<SPI, W, TX, RX>, Error> {
214214
// Note (unsafe): Data will be read from the start of the buffer before data is written
215215
// to those locations just like for blocking non-DMA in-place transfers
216-
let source = unsafe { *(buffer.as_ptr() as *const &[W]) };
216+
let source = unsafe { core::slice::from_raw_parts(buffer.as_ptr(), buffer.len()) };
217217
let mut transfer = DuplexDmaTransfer::new(
218218
self, tx_channel, rx_channel, source, buffer,
219219
);

0 commit comments

Comments
 (0)