Skip to content

Commit b406c71

Browse files
committed
Use SPI.writeBytes instead of SPI.transfer on the ESP8266
1 parent 61fb23d commit b406c71

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

usbhost.h

+12
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
168168
uint8_t c[2];
169169
c[0] = reg | 0x02;
170170
c[1] = data;
171+
#ifdef ESP8266
172+
SPI.writeBytes(c, 2);
173+
#else
171174
SPI.transfer(c, 2);
175+
#endif
172176
#elif defined(STM32F4)
173177
uint8_t c[2];
174178
c[0] = reg | 0x02;
@@ -208,7 +212,11 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t*
208212
data_p += nbytes;
209213
#elif defined(SPI_HAS_TRANSACTION)
210214
SPI.transfer(reg | 0x02);
215+
#ifdef ESP8266
216+
SPI.writeBytes(data_p, nbytes);
217+
#else
211218
SPI.transfer(data_p, nbytes);
219+
#endif
212220
data_p += nbytes;
213221
#elif defined(__ARDUINO_X86__)
214222
SPI.transfer(reg | 0x02);
@@ -311,7 +319,11 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t*
311319
#elif defined(SPI_HAS_TRANSACTION)
312320
SPI.transfer(reg);
313321
memset(data_p, 0, nbytes); // Make sure we send out empty bytes
322+
#ifdef ESP8266
323+
SPI.writeBytes(data_p, nbytes);
324+
#else
314325
SPI.transfer(data_p, nbytes);
326+
#endif
315327
data_p += nbytes;
316328
#elif defined(__ARDUINO_X86__)
317329
SPI.transfer(reg);

0 commit comments

Comments
 (0)