@@ -1037,6 +1037,17 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, bool block,
1037
1037
spi_write_blocking (pi_spi, (uint8_t *)colors, len * 2 );
1038
1038
}
1039
1039
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
+ }
1040
1051
#elif defined(USE_SPI_DMA) && \
1041
1052
(defined (__SAMD51__) || defined (ARDUINO_SAMD_ZERO))
1042
1053
if ((connection == TFT_HARD_SPI) || (connection == TFT_PARALLEL)) {
@@ -1219,6 +1230,24 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
1219
1230
}
1220
1231
return ;
1221
1232
}
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
+ }
1222
1251
#elif defined(ARDUINO_NRF52_ADAFRUIT) && \
1223
1252
defined (NRF52840_XXAA) // Adafruit nRF52840 use SPIM3 DMA at 32Mhz
1224
1253
// at most 2 scan lines
@@ -2426,6 +2455,8 @@ void Adafruit_SPITFT::SPI_WRITE16(uint16_t w) {
2426
2455
spi_inst_t *pi_spi = hwspi._spi == &SPI ? spi0 : spi1;
2427
2456
w = __builtin_bswap16 (w);
2428
2457
spi_write_blocking (pi_spi, (uint8_t *)&w, 2 );
2458
+ #elif defined(ARDUINO_ARCH_SPRESENSE)
2459
+ hwspi._spi ->transfer16 (w);
2429
2460
#else
2430
2461
// MSB, LSB because TFTs are generally big-endian
2431
2462
hwspi._spi ->transfer (w >> 8 );
0 commit comments