From 3dfc52ff11859521b84881f717f303fb9013bec9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 17 Aug 2020 18:44:44 +0200 Subject: [PATCH] use transfer(wbuf,rbuf,count) also for read --- src/utility/w5100.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utility/w5100.cpp b/src/utility/w5100.cpp index 4ae4ee7a..9b0cf1c8 100644 --- a/src/utility/w5100.cpp +++ b/src/utility/w5100.cpp @@ -413,9 +413,14 @@ uint16_t W5100Class::read(uint16_t addr, uint8_t *buf, uint16_t len) cmd[1] = addr & 0xFF; cmd[2] = (len >> 8) & 0x7F; cmd[3] = len & 0xFF; +#ifdef SPI_HAS_TRANSFER_BUF + SPI.transfer(cmd, NULL, 4); + SPI.transfer(NULL, buf, len); +#else SPI.transfer(cmd, 4); memset(buf, 0, len); SPI.transfer(buf, len); +#endif resetSS(); } else { // chip == 55 setSS(); @@ -457,9 +462,14 @@ uint16_t W5100Class::read(uint16_t addr, uint8_t *buf, uint16_t len) cmd[2] = ((addr >> 6) & 0xE0) | 0x18; // 2K buffers #endif } +#ifdef SPI_HAS_TRANSFER_BUF + SPI.transfer(cmd, NULL, 3); + SPI.transfer(NULL, buf, len); +#else SPI.transfer(cmd, 3); memset(buf, 0, len); SPI.transfer(buf, len); +#endif resetSS(); } return len;