Skip to content

Commit 45d9201

Browse files
author
Henrik Alsér
committed
Chunk size is min value of EASY_DMA_SIZE and FORCE_COPY_BUFFER_SIZE
1 parent 4f64fc2 commit 45d9201

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nrf-hal-common/src/twim.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ where
380380
unsafe { w.maxcnt().bits(rx_buffer.len() as _) });
381381

382382
// Chunk write data
383-
for chunk in tx_buffer.chunks(FORCE_COPY_BUFFER_SIZE) {
383+
let wr_buffer = &mut [0; FORCE_COPY_BUFFER_SIZE][..];
384+
for chunk in tx_buffer.chunks(FORCE_COPY_BUFFER_SIZE.min(EASY_DMA_SIZE)) {
384385
// Copy chunk into RAM
385-
let wr_buffer = &mut [0; FORCE_COPY_BUFFER_SIZE][..];
386386
wr_buffer[..chunk.len()].copy_from_slice(chunk);
387387

388388
// Set up the DMA write

0 commit comments

Comments
 (0)