diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index 2c8ef01b..d55ad68f 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -1037,6 +1037,17 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, bool block, spi_write_blocking(pi_spi, (uint8_t *)colors, len * 2); } return; +#elif defined(ARDUINO_ARCH_SPRESENSE) + if(connection == TFT_HARD_SPI) { + if (!bigEndian) { + swapBytes(colors, len); // convert little-to-big endian for display + } + hwspi._spi->send16(colors, len); + if (!bigEndian) { + swapBytes(colors, len); // big-to-little endian to restore pixel buffer + } + return; + } #elif defined(USE_SPI_DMA) && \ (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO)) if ((connection == TFT_HARD_SPI) || (connection == TFT_PARALLEL)) { @@ -1219,6 +1230,24 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) { } return; } +#elif defined(ARDUINO_ARCH_SPRESENSE) + if(connection == TFT_HARD_SPI) { +#define SPI_MAX_PIXELS_AT_ONCE 1024 + static uint16_t temp[SPI_MAX_PIXELS_AT_ONCE]; + uint16_t bufLen = (len < SPI_MAX_PIXELS_AT_ONCE) ? len : SPI_MAX_PIXELS_AT_ONCE, + xferLen; + + for(uint32_t t=0; ttransfer16(w); #else // MSB, LSB because TFTs are generally big-endian hwspi._spi->transfer(w >> 8);