Has anyone tried using Adafruit GFX Library with the Zero for Adafruit's 2.8" TFTLCD screen?

I get a bunch of errors regarding undefined symbols when I compile the basic graphicstest.ino example sketch. The sketch compiles and runs just fine on my old Arduino Uno.

^~~~~~~~~
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:573:9: note: in expansion of macro 'WR_STROBE'
         WR_STROBE;
         ^~~~~~~~~
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:493:20: note: suggested alternative: 'Port'
 #define WR_ACTIVE *wrPort &= wrPinUnset
                    ^
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:506:5: note: in expansion of macro 'WR_ACTIVE'
     WR_ACTIVE;                                                                 \
     ^~~~~~~~~
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:573:9: note: in expansion of macro 'WR_STROBE'
         WR_STROBE;
         ^~~~~~~~~
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:493:30: error: 'wrPinUnset' was not declared in this scope
 #define WR_ACTIVE *wrPort &= wrPinUnset
                              ^
c:\Users\MT\Desktop\SynologyDrive\Code\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:506:5: note: in expansion of macro 'WR_ACTIVE'
     WR_ACTIVE;                                                                 \
     ^~~~~~~~~

Digging into the library and where wrPinUnset was defined, I see this in Adafruit_TFTLCD.h

#ifdef __AVR__
  volatile uint8_t *csPort, *cdPort, *wrPort, *rdPort;
  uint8_t csPinSet, cdPinSet, wrPinSet, rdPinSet, csPinUnset, cdPinUnset,
      wrPinUnset, rdPinUnset, _reset;
#endif
#if defined(__SAM3X8E__)
  Pio *csPort, *cdPort, *wrPort, *rdPort;
  uint32_t csPinSet, cdPinSet, wrPinSet, rdPinSet, csPinUnset, cdPinUnset,
      wrPinUnset, rdPinUnset, _reset;
#endif

I'm guessing __AVR__ was defined by the IDE while I was using the UNO but there's no corresponding preprocessor directive for the Zero. I tried using __SAM3X8E__ but the compiler complained that Pio wasn't defined (this was the only error).

Yes, the Adafruit GFX library works well with the 2.8" TFT LCD on the Arduino Zero. Just install the Adafruit GFX and ILI9341 libraries, wire the screen for SPI communication, and use example sketches like graphicstest to test it. It should work smoothly with the right setup.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.