@@ -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,25 @@ 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 =
1238
+ (len < SPI_MAX_PIXELS_AT_ONCE) ? len : SPI_MAX_PIXELS_AT_ONCE;
1239
+ uint16_t xferLen;
1240
+
1241
+ for (uint32_t t = 0 ; t < bufLen; t++) {
1242
+ temp[t] = color;
1243
+ }
1244
+ // Issue pixels in blocks from temp buffer
1245
+ while (len) { // While pixels remain
1246
+ xferLen = (bufLen < len) ? bufLen : len; // How many this pass?
1247
+ writePixels ((uint16_t *)temp, xferLen, true , true );
1248
+ len -= xferLen;
1249
+ }
1250
+ return ;
1251
+ }
1222
1252
#elif defined(ARDUINO_NRF52_ADAFRUIT) && \
1223
1253
defined (NRF52840_XXAA) // Adafruit nRF52840 use SPIM3 DMA at 32Mhz
1224
1254
// at most 2 scan lines
@@ -2426,6 +2456,8 @@ void Adafruit_SPITFT::SPI_WRITE16(uint16_t w) {
2426
2456
spi_inst_t *pi_spi = hwspi._spi == &SPI ? spi0 : spi1;
2427
2457
w = __builtin_bswap16 (w);
2428
2458
spi_write_blocking (pi_spi, (uint8_t *)&w, 2 );
2459
+ #elif defined(ARDUINO_ARCH_SPRESENSE)
2460
+ hwspi._spi ->transfer16 (w);
2429
2461
#else
2430
2462
// MSB, LSB because TFTs are generally big-endian
2431
2463
hwspi._spi ->transfer (w >> 8 );
0 commit comments