David Prentice has done a wonderful job of providing a library that works with a number of TFT displays. I happen to be working on a project that may use the 3.95" or 3.5" displays, depending on cost. Also, I had to move to a Mega2560 because of the program code size, which, as David mentions, has a performance hit compared to the Uno. I can live with that.
My problem is that output on the one display has great colors, but switching to the other display is way off the mark. The ID on the smaller display is 0x9486 while it is 0x9488 on the larger display. After a little testing, it because obvious that the one display uses color constants that are "flipped" relative to the other display. The following hack seems to work.
uint16_t g_identifier;
int BLUE = 0x001F; // These color constants take from David's examples
int GREEN = 0x07E0;
int RED = 0xF800;
int YELLOW = 0xFFE0;
int WHITE = 0xFFFF;
int BLACK = 0x0000;
int DKGREEN = 0x03E0;
// more code...
void setup() {
Serial.begin(9600);
g_identifier = tft.readID(); // Get TFT ID
Serial.print("g_identifier = "); // Probably remove once you know what it is...
Serial.println(g_identifier, HEX);
if (g_identifier == 0x9486) { // If 3.5" board, invert colors
BLUE = ~BLUE; // Flip the bits for each color you use...
GREEN = ~GREEN;
RED = ~RED;
YELLOW = ~YELLOW;
WHITE = ~WHITE;
BLACK = ~BLACK;
DKGREEN = ~DKGREEN;
}
I have not tried to use the touch screen features of these displays, so it someone does, it would be nice to know about it. If you'd like to try David's library, look at the bottom of his first post at: