From 45afa0dec5b279f305d7a396b0a28748e67920aa Mon Sep 17 00:00:00 2001 From: xxxajk Date: Tue, 2 Jul 2019 15:49:41 -0400 Subject: [PATCH] Fix corruption. NEVER use SPI method transfer on a pointer. --- usbhost.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/usbhost.h b/usbhost.h index 6b80f831..a81ea210 100644 --- a/usbhost.h +++ b/usbhost.h @@ -228,21 +228,15 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* spi4teensy3::send(reg | 0x02); spi4teensy3::send(data_p, nbytes); data_p += nbytes; -#elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266) && !defined(ESP32) - USB_SPI.transfer(reg | 0x02); - USB_SPI.transfer(data_p, nbytes); - data_p += nbytes; -#elif defined(__ARDUINO_X86__) - USB_SPI.transfer(reg | 0x02); - USB_SPI.transferBuffer(data_p, NULL, nbytes); - data_p += nbytes; #elif defined(STM32F4) uint8_t data = reg | 0x02; HAL_SPI_Transmit(&SPI_Handle, &data, 1, HAL_MAX_DELAY); HAL_SPI_Transmit(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY); data_p += nbytes; -#elif !defined(SPDR) // ESP8266, ESP32 +#elif !defined(__AVR__) || !defined(SPDR) +#if defined(ESP8266) || defined(ESP32) yield(); +#endif USB_SPI.transfer(reg | 0x02); while(nbytes) { USB_SPI.transfer(*data_p);