mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge pull request #473 from xxxajk/master
Fix corruption. NEVER use SPI method transfer on a pointer.
This commit is contained in:
commit
821e37ed18
1 changed files with 3 additions and 9 deletions
12
usbhost.h
12
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);
|
||||
|
|
Loading…
Reference in a new issue