mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Do not use SPI.writeBytes on the ESP8266
This commit is contained in:
parent
453a4e1f7f
commit
84bab2d748
1 changed files with 2 additions and 9 deletions
11
usbhost.h
11
usbhost.h
|
@ -176,24 +176,17 @@ void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
|
||||||
c[0] = reg | 0x02;
|
c[0] = reg | 0x02;
|
||||||
c[1] = data;
|
c[1] = data;
|
||||||
spi4teensy3::send(c, 2);
|
spi4teensy3::send(c, 2);
|
||||||
#elif defined(SPI_HAS_TRANSACTION)
|
#elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266)
|
||||||
#ifdef ESP8266
|
|
||||||
uint32_t c[2]; // The data needs to be aligned to 32-bit
|
|
||||||
c[0] = reg | 0x02;
|
|
||||||
c[1] = data;
|
|
||||||
SPI.writeBytes((uint8_t*)c, 2);
|
|
||||||
#else
|
|
||||||
uint8_t c[2];
|
uint8_t c[2];
|
||||||
c[0] = reg | 0x02;
|
c[0] = reg | 0x02;
|
||||||
c[1] = data;
|
c[1] = data;
|
||||||
SPI.transfer(c, 2);
|
SPI.transfer(c, 2);
|
||||||
#endif
|
|
||||||
#elif defined(STM32F4)
|
#elif defined(STM32F4)
|
||||||
uint8_t c[2];
|
uint8_t c[2];
|
||||||
c[0] = reg | 0x02;
|
c[0] = reg | 0x02;
|
||||||
c[1] = data;
|
c[1] = data;
|
||||||
HAL_SPI_Transmit(&SPI_Handle, c, 2, HAL_MAX_DELAY);
|
HAL_SPI_Transmit(&SPI_Handle, c, 2, HAL_MAX_DELAY);
|
||||||
#elif !defined(SPDR)
|
#elif !defined(SPDR) // ESP8266
|
||||||
SPI.transfer(reg | 0x02);
|
SPI.transfer(reg | 0x02);
|
||||||
SPI.transfer(data);
|
SPI.transfer(data);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue