@@ -87,7 +87,7 @@ static const struct {
8787#endif
8888};
8989#define NUM_TIMERS (sizeof tcList / sizeof tcList[0 ]) // /< # timer/counters
90- #endif // end __SAMD51__
90+ #endif // end __SAMD51__
9191
9292#endif // end USE_SPI_DMA
9393
@@ -157,7 +157,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
157157 } else {
158158 swspi.misoPort = portInputRegister (dc);
159159 }
160- #else // !CORE_TEENSY
160+ #else // !CORE_TEENSY
161161 dcPinMask = digitalPinToBitMask (dc);
162162 swspi.sckPinMask = digitalPinToBitMask (sck);
163163 swspi.mosiPinMask = digitalPinToBitMask (mosi);
@@ -188,7 +188,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
188188 swspi.misoPort = (PORTreg_t)portInputRegister (digitalPinToPort (dc));
189189 }
190190#endif // end !CORE_TEENSY
191- #else // !HAS_PORT_SET_CLR
191+ #else // !HAS_PORT_SET_CLR
192192 dcPort = (PORTreg_t)portOutputRegister (digitalPinToPort (dc));
193193 dcPinMaskSet = digitalPinToBitMask (dc);
194194 swspi.sckPort = (PORTreg_t)portOutputRegister (digitalPinToPort (sck));
@@ -241,7 +241,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
241241 _dc(dc) {
242242 hwspi._spi = &SPI;
243243}
244- #else // !ESP8266
244+ #else // !ESP8266
245245Adafruit_SPITFT::Adafruit_SPITFT (uint16_t w, uint16_t h, int8_t cs, int8_t dc,
246246 int8_t rst)
247247 : Adafruit_SPITFT(w, h, &SPI, cs, dc, rst) {
@@ -304,7 +304,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
304304 csPortSet = dcPortSet;
305305 csPortClr = dcPortClr;
306306 }
307- #else // !CORE_TEENSY
307+ #else // !CORE_TEENSY
308308 dcPinMask = digitalPinToBitMask (dc);
309309 dcPortSet = &(PORT->Group [g_APinDescription[dc].ulPort ].OUTSET .reg );
310310 dcPortClr = &(PORT->Group [g_APinDescription[dc].ulPort ].OUTCLR .reg );
@@ -322,7 +322,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
322322 csPinMask = 0 ;
323323 }
324324#endif // end !CORE_TEENSY
325- #else // !HAS_PORT_SET_CLR
325+ #else // !HAS_PORT_SET_CLR
326326 dcPort = (PORTreg_t)portOutputRegister (digitalPinToPort (dc));
327327 dcPinMaskSet = digitalPinToBitMask (dc);
328328 if (cs >= 0 ) {
@@ -425,7 +425,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth,
425425 tft8.readPort = portInputRegister (d0);
426426 tft8.dirSet = portModeRegister (d0);
427427 tft8.dirClr = portModeRegister (d0);
428- #else // !CORE_TEENSY
428+ #else // !CORE_TEENSY
429429 tft8.wrPinMask = digitalPinToBitMask (wr);
430430 tft8.wrPortSet = &(PORT->Group [g_APinDescription[wr].ulPort ].OUTSET .reg );
431431 tft8.wrPortClr = &(PORT->Group [g_APinDescription[wr].ulPort ].OUTCLR .reg );
@@ -467,7 +467,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth,
467467 tft8.dirSet = (volatile uint8_t *)&(p->DIRSET .reg ) + offset;
468468 tft8.dirClr = (volatile uint8_t *)&(p->DIRCLR .reg ) + offset;
469469#endif // end !CORE_TEENSY
470- #else // !HAS_PORT_SET_CLR
470+ #else // !HAS_PORT_SET_CLR
471471 tft8.wrPort = (PORTreg_t)portOutputRegister (digitalPinToPort (wr));
472472 tft8.wrPinMaskSet = digitalPinToBitMask (wr);
473473 dcPort = (PORTreg_t)portOutputRegister (digitalPinToPort (dc));
@@ -616,7 +616,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) {
616616 *(volatile uint16_t *)tft8.dirSet = 0xFFFF ;
617617 *(volatile uint16_t *)tft8.writePort = 0x0000 ;
618618 }
619- #else // !CORE_TEENSY
619+ #else // !CORE_TEENSY
620620 uint8_t portNum = g_APinDescription[tft8._d0 ].ulPort , // d0 PORT #
621621 dBit = g_APinDescription[tft8._d0 ].ulPin , // d0 bit in PORT
622622 lastBit = dBit + (tft8.wide ? 15 : 7 );
@@ -870,7 +870,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) {
870870 DMA_ADDRESS_INCREMENT_STEP_SIZE_1;
871871 descriptor[d].DSTADDR .reg = (uint32_t )tft8.writePort ;
872872 }
873- #endif // __SAMD51
873+ #endif // __SAMD51
874874 } // end parallel-specific DMA setup
875875
876876 lastFillColor = 0x0000 ;
@@ -1216,7 +1216,7 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
12161216 rtos_free (pixbuf);
12171217 return ;
12181218 }
1219- #else // !ESP32
1219+ #else // !ESP32
12201220#if defined(USE_SPI_DMA) && (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO))
12211221 if (((connection == TFT_HARD_SPI) || (connection == TFT_PARALLEL)) &&
12221222 (len >= 16 )) { // Don't bother with DMA on short pixel runs
@@ -1381,7 +1381,7 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
13811381 SPI_SCK_LOW ();
13821382 x <<= 1 ;
13831383 }
1384- #else // !__AVR__
1384+ #else // !__AVR__
13851385 for (uint16_t bit = 0 , x = color; bit < 16 ; bit++) {
13861386 if (x & 0x8000 )
13871387 SPI_MOSI_HIGH ();
@@ -1391,9 +1391,9 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
13911391 x <<= 1 ;
13921392 SPI_SCK_LOW ();
13931393 }
1394- #endif // end !__AVR__
1394+ #endif // end !__AVR__
13951395 }
1396- #endif // end !ESP8266
1396+ #endif // end !ESP8266
13971397 } else { // PARALLEL
13981398 if (hi == lo) {
13991399#if defined(__AVR__)
@@ -1999,12 +1999,12 @@ uint16_t Adafruit_SPITFT::readcommand16(uint16_t addr) {
19991999 *(volatile uint16_t *)tft8.dirClr = 0xFFFF ; // Input state
20002000 result = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
20012001 *(volatile uint16_t *)tft8.dirSet = 0xFFFF ; // Output state
2002- #else // !HAS_PORT_SET_CLR
2003- *(volatile uint16_t *)tft8.portDir = 0x0000 ; // Input state
2004- result = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
2005- *(volatile uint16_t *)tft8.portDir = 0xFFFF ; // Output state
2006- #endif // end !HAS_PORT_SET_CLR
2007- TFT_RD_HIGH (); // Read line HIGH
2002+ #else // !HAS_PORT_SET_CLR
2003+ *(volatile uint16_t *)tft8.portDir = 0x0000 ; // Input state
2004+ result = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
2005+ *(volatile uint16_t *)tft8.portDir = 0xFFFF ; // Output state
2006+ #endif // end !HAS_PORT_SET_CLR
2007+ TFT_RD_HIGH (); // Read line HIGH
20082008 endWrite ();
20092009 }
20102010 return result;
@@ -2153,31 +2153,31 @@ uint8_t Adafruit_SPITFT::spiRead(void) {
21532153 *tft8.portDir = 0x00 ; // Set port to input state
21542154 w = *tft8.readPort ; // Read value from port
21552155 *tft8.portDir = 0xFF ; // Restore port to output
2156- #else // !__AVR__
2157- if (!tft8.wide ) { // 8-bit TFT connection
2156+ #else // !__AVR__
2157+ if (!tft8.wide ) { // 8-bit TFT connection
21582158#if defined(HAS_PORT_SET_CLR)
2159- *tft8.dirClr = 0xFF ; // Set port to input state
2160- w = *tft8.readPort ; // Read value from port
2161- *tft8.dirSet = 0xFF ; // Restore port to output
2162- #else // !HAS_PORT_SET_CLR
2163- *tft8.portDir = 0x00 ; // Set port to input state
2164- w = *tft8.readPort ; // Read value from port
2165- *tft8.portDir = 0xFF ; // Restore port to output
2159+ *tft8.dirClr = 0xFF ; // Set port to input state
2160+ w = *tft8.readPort ; // Read value from port
2161+ *tft8.dirSet = 0xFF ; // Restore port to output
2162+ #else // !HAS_PORT_SET_CLR
2163+ *tft8.portDir = 0x00 ; // Set port to input state
2164+ w = *tft8.readPort ; // Read value from port
2165+ *tft8.portDir = 0xFF ; // Restore port to output
21662166#endif // end HAS_PORT_SET_CLR
2167- } else { // 16-bit TFT connection
2167+ } else { // 16-bit TFT connection
21682168#if defined(HAS_PORT_SET_CLR)
21692169 *(volatile uint16_t *)tft8.dirClr = 0xFFFF ; // Input state
21702170 w = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
21712171 *(volatile uint16_t *)tft8.dirSet = 0xFFFF ; // Output state
2172- #else // !HAS_PORT_SET_CLR
2172+ #else // !HAS_PORT_SET_CLR
21732173 *(volatile uint16_t *)tft8.portDir = 0x0000 ; // Input state
21742174 w = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
21752175 *(volatile uint16_t *)tft8.portDir = 0xFFFF ; // Output state
21762176#endif // end !HAS_PORT_SET_CLR
21772177 }
2178- TFT_RD_HIGH (); // Read line HIGH
2178+ TFT_RD_HIGH (); // Read line HIGH
21792179#endif // end !__AVR__
2180- #else // !USE_FAST_PINIO
2180+ #else // !USE_FAST_PINIO
21812181 w = 0 ; // Parallel TFT is NOT SUPPORTED without USE_FAST_PINIO
21822182#endif // end !USE_FAST_PINIO
21832183 }
@@ -2237,16 +2237,16 @@ uint16_t Adafruit_SPITFT::read16(void) {
22372237 *(volatile uint16_t *)tft8.dirClr = 0xFFFF ; // Input state
22382238 w = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
22392239 *(volatile uint16_t *)tft8.dirSet = 0xFFFF ; // Output state
2240- #else // !HAS_PORT_SET_CLR
2240+ #else // !HAS_PORT_SET_CLR
22412241 *(volatile uint16_t *)tft8.portDir = 0x0000 ; // Input state
22422242 w = *(volatile uint16_t *)tft8.readPort ; // 16-bit read
22432243 *(volatile uint16_t *)tft8.portDir = 0xFFFF ; // Output state
2244- #endif // end !HAS_PORT_SET_CLR
2244+ #endif // end !HAS_PORT_SET_CLR
22452245 }
22462246 TFT_RD_HIGH (); // Read line HIGH
2247- #else // !USE_FAST_PINIO
2247+ #else // !USE_FAST_PINIO
22482248 w = 0 ; // Parallel TFT is NOT SUPPORTED without USE_FAST_PINIO
2249- #endif // end !USE_FAST_PINIO
2249+ #endif // end !USE_FAST_PINIO
22502250 }
22512251 }
22522252 return w;
@@ -2263,10 +2263,10 @@ inline void Adafruit_SPITFT::SPI_MOSI_HIGH(void) {
22632263#else // !KINETISK
22642264 *swspi.mosiPortSet = swspi.mosiPinMask ;
22652265#endif
2266- #else // !HAS_PORT_SET_CLR
2266+ #else // !HAS_PORT_SET_CLR
22672267 *swspi.mosiPort |= swspi.mosiPinMaskSet ;
22682268#endif // end !HAS_PORT_SET_CLR
2269- #else // !USE_FAST_PINIO
2269+ #else // !USE_FAST_PINIO
22702270 digitalWrite (swspi._mosi , HIGH);
22712271#if defined(ESP32)
22722272 for (volatile uint8_t i = 0 ; i < 1 ; i++)
@@ -2286,10 +2286,10 @@ inline void Adafruit_SPITFT::SPI_MOSI_LOW(void) {
22862286#else // !KINETISK
22872287 *swspi.mosiPortClr = swspi.mosiPinMask ;
22882288#endif
2289- #else // !HAS_PORT_SET_CLR
2289+ #else // !HAS_PORT_SET_CLR
22902290 *swspi.mosiPort &= swspi.mosiPinMaskClr ;
22912291#endif // end !HAS_PORT_SET_CLR
2292- #else // !USE_FAST_PINIO
2292+ #else // !USE_FAST_PINIO
22932293 digitalWrite (swspi._mosi , LOW);
22942294#if defined(ESP32)
22952295 for (volatile uint8_t i = 0 ; i < 1 ; i++)
@@ -2306,17 +2306,17 @@ inline void Adafruit_SPITFT::SPI_SCK_HIGH(void) {
23062306#if defined(HAS_PORT_SET_CLR)
23072307#if defined(KINETISK)
23082308 *swspi.sckPortSet = 1 ;
2309- #else // !KINETISK
2309+ #else // !KINETISK
23102310 *swspi.sckPortSet = swspi.sckPinMask ;
23112311#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
23122312 for (volatile uint8_t i = 0 ; i < 1 ; i++)
23132313 ;
23142314#endif
23152315#endif
2316- #else // !HAS_PORT_SET_CLR
2316+ #else // !HAS_PORT_SET_CLR
23172317 *swspi.sckPort |= swspi.sckPinMaskSet ;
23182318#endif // end !HAS_PORT_SET_CLR
2319- #else // !USE_FAST_PINIO
2319+ #else // !USE_FAST_PINIO
23202320 digitalWrite (swspi._sck , HIGH);
23212321#if defined(ESP32)
23222322 for (volatile uint8_t i = 0 ; i < 1 ; i++)
@@ -2333,17 +2333,17 @@ inline void Adafruit_SPITFT::SPI_SCK_LOW(void) {
23332333#if defined(HAS_PORT_SET_CLR)
23342334#if defined(KINETISK)
23352335 *swspi.sckPortClr = 1 ;
2336- #else // !KINETISK
2336+ #else // !KINETISK
23372337 *swspi.sckPortClr = swspi.sckPinMask ;
23382338#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
23392339 for (volatile uint8_t i = 0 ; i < 1 ; i++)
23402340 ;
23412341#endif
23422342#endif
2343- #else // !HAS_PORT_SET_CLR
2343+ #else // !HAS_PORT_SET_CLR
23442344 *swspi.sckPort &= swspi.sckPinMaskClr ;
23452345#endif // end !HAS_PORT_SET_CLR
2346- #else // !USE_FAST_PINIO
2346+ #else // !USE_FAST_PINIO
23472347 digitalWrite (swspi._sck , LOW);
23482348#if defined(ESP32)
23492349 for (volatile uint8_t i = 0 ; i < 1 ; i++)
@@ -2360,10 +2360,10 @@ inline bool Adafruit_SPITFT::SPI_MISO_READ(void) {
23602360#if defined(USE_FAST_PINIO)
23612361#if defined(KINETISK)
23622362 return *swspi.misoPort ;
2363- #else // !KINETISK
2363+ #else // !KINETISK
23642364 return *swspi.misoPort & swspi.misoPinMask ;
23652365#endif // end !KINETISK
2366- #else // !USE_FAST_PINIO
2366+ #else // !USE_FAST_PINIO
23672367 return digitalRead (swspi._miso );
23682368#endif // end !USE_FAST_PINIO
23692369}
@@ -2491,15 +2491,15 @@ inline void Adafruit_SPITFT::TFT_WR_STROBE(void) {
24912491#if defined(KINETISK)
24922492 *tft8.wrPortClr = 1 ;
24932493 *tft8.wrPortSet = 1 ;
2494- #else // !KINETISK
2494+ #else // !KINETISK
24952495 *tft8.wrPortClr = tft8.wrPinMask ;
24962496 *tft8.wrPortSet = tft8.wrPinMask ;
24972497#endif // end !KINETISK
2498- #else // !HAS_PORT_SET_CLR
2498+ #else // !HAS_PORT_SET_CLR
24992499 *tft8.wrPort &= tft8.wrPinMaskClr ;
25002500 *tft8.wrPort |= tft8.wrPinMaskSet ;
25012501#endif // end !HAS_PORT_SET_CLR
2502- #else // !USE_FAST_PINIO
2502+ #else // !USE_FAST_PINIO
25032503 digitalWrite (tft8._wr , LOW);
25042504 digitalWrite (tft8._wr , HIGH);
25052505#endif // end !USE_FAST_PINIO
@@ -2513,10 +2513,10 @@ inline void Adafruit_SPITFT::TFT_RD_HIGH(void) {
25132513#if defined(USE_FAST_PINIO)
25142514#if defined(HAS_PORT_SET_CLR)
25152515 *tft8.rdPortSet = tft8.rdPinMask ;
2516- #else // !HAS_PORT_SET_CLR
2516+ #else // !HAS_PORT_SET_CLR
25172517 *tft8.rdPort |= tft8.rdPinMaskSet ;
25182518#endif // end !HAS_PORT_SET_CLR
2519- #else // !USE_FAST_PINIO
2519+ #else // !USE_FAST_PINIO
25202520 digitalWrite (tft8._rd , HIGH);
25212521#endif // end !USE_FAST_PINIO
25222522}
@@ -2529,10 +2529,10 @@ inline void Adafruit_SPITFT::TFT_RD_LOW(void) {
25292529#if defined(USE_FAST_PINIO)
25302530#if defined(HAS_PORT_SET_CLR)
25312531 *tft8.rdPortClr = tft8.rdPinMask ;
2532- #else // !HAS_PORT_SET_CLR
2532+ #else // !HAS_PORT_SET_CLR
25332533 *tft8.rdPort &= tft8.rdPinMaskClr ;
25342534#endif // end !HAS_PORT_SET_CLR
2535- #else // !USE_FAST_PINIO
2535+ #else // !USE_FAST_PINIO
25362536 digitalWrite (tft8._rd , LOW);
25372537#endif // end !USE_FAST_PINIO
25382538}
0 commit comments