@@ -1037,6 +1037,17 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, bool block,
10371037 spi_write_blocking (pi_spi, (uint8_t *)colors, len * 2 );
10381038 }
10391039 return ;
1040+ #elif defined(ARDUINO_ARCH_SPRESENSE)
1041+ if (connection == TFT_HARD_SPI) {
1042+ if (!bigEndian) {
1043+ swapBytes (colors, len); // convert little-to-big endian for display
1044+ }
1045+ hwspi._spi ->send16 (colors, len);
1046+ if (!bigEndian) {
1047+ swapBytes (colors, len); // big-to-little endian to restore pixel buffer
1048+ }
1049+ return ;
1050+ }
10401051#elif defined(USE_SPI_DMA) && \
10411052 (defined (__SAMD51__) || defined (ARDUINO_SAMD_ZERO))
10421053 if ((connection == TFT_HARD_SPI) || (connection == TFT_PARALLEL)) {
@@ -1219,6 +1230,24 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
12191230 }
12201231 return ;
12211232 }
1233+ #elif defined(ARDUINO_ARCH_SPRESENSE)
1234+ if (connection == TFT_HARD_SPI) {
1235+ #define SPI_MAX_PIXELS_AT_ONCE 1024
1236+ static uint16_t temp[SPI_MAX_PIXELS_AT_ONCE];
1237+ uint16_t bufLen = (len < SPI_MAX_PIXELS_AT_ONCE) ? len : SPI_MAX_PIXELS_AT_ONCE,
1238+ xferLen;
1239+
1240+ for (uint32_t t=0 ; t<bufLen; t++) {
1241+ temp[t] = color;
1242+ }
1243+ // Issue pixels in blocks from temp buffer
1244+ while (len) { // While pixels remain
1245+ xferLen = (bufLen < len) ? bufLen : len; // How many this pass?
1246+ writePixels ((uint16_t *)temp, xferLen, true , true );
1247+ len -= xferLen;
1248+ }
1249+ return ;
1250+ }
12221251#elif defined(ARDUINO_NRF52_ADAFRUIT) && \
12231252 defined (NRF52840_XXAA) // Adafruit nRF52840 use SPIM3 DMA at 32Mhz
12241253 // at most 2 scan lines
@@ -2426,6 +2455,8 @@ void Adafruit_SPITFT::SPI_WRITE16(uint16_t w) {
24262455 spi_inst_t *pi_spi = hwspi._spi == &SPI ? spi0 : spi1;
24272456 w = __builtin_bswap16 (w);
24282457 spi_write_blocking (pi_spi, (uint8_t *)&w, 2 );
2458+ #elif defined(ARDUINO_ARCH_SPRESENSE)
2459+ hwspi._spi ->transfer16 (w);
24292460#else
24302461 // MSB, LSB because TFTs are generally big-endian
24312462 hwspi._spi ->transfer (w >> 8 );
0 commit comments