Skip to content

Commit

Permalink
fix read for case (bits <= 32 && !wholeBytes) || len <= 4))
Browse files Browse the repository at this point in the history
Before, each copy from SPI transaction buf to destination buf was overwriting
all previously copied data, so always only the last $bytesPerChunk bytes were
stored.
Fix by shifting pointer within destination buf to actually append newly read
data instead of overwriting.
  • Loading branch information
Mirko Vogt committed Oct 28, 2021
1 parent 494ecaf commit 5c2230c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ports/esp32/machine_hw_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const ui

if (dest != NULL) {
memcpy(dest, &transaction.rx_data, bytesPerChunk);
dest += bytesPerChunk;
}
src += bytesPerChunk;
len -= bytesPerChunk;
Expand Down

0 comments on commit 5c2230c

Please sign in to comment.