//=============================================================================
// 1st:: https://forum.pjrc.com/threads/55735-ILI9488_t3-Support-for-the-ILI9488-on-T3-x-and-beyond?p=203151&viewfull=1#post203151
// 2nd:: https://forum.pjrc.com/threads/55735-ILI9488_t3-Support-for-the-ILI9488-on-T3-x-and-beyond?p=203577&viewfull=1#post203577
//=============================================================================
#include <ILI9488_t3.h>
#include <ILI9488_t3_font_Arial.h>
#include <ILI9488_t3_font_ArialBold.h>
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3( &SPI, TFT_CS, TFT_DC, TFT_RST);
//=============================================================================
// Setup
//=============================================================================
void setup()
{
tft.begin();
tft.setRotation(3); // 180
while (!Serial && millis() < 4000 );
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
tft.fillScreen(ILI9488_BLACK);
delay(250);
tft.fillScreen(ILI9488_RED);
delay(250);
tft.fillScreen(ILI9488_BLUE);
delay(250);
tft.fillScreen(ILI9488_GREEN);
delay(250);
tft.fillScreen(ILI9488_BLACK);
}
bool use_frame_buffer = false;
void drawColor(uint16_t x, uint16_t y, const char *psz, uint16_t color)
{
tft.setFontAdafruit();
tft.setTextColor(color);
tft.setTextSize(2);
tft.setCursor(x, y);
tft.print(psz);
tft.drawRect(x + 100, y, 50, 50, color);
tft.fillRect(x + 110, y + 10, 30, 30, color);
tft.drawLine(x + 100, y + 70, x + 200, y + 70, color);
tft.drawLine(x + 220, y, x + 220, y + 70, color);
tft.drawLine(x + 100, y + 70, x + 220, y, color);
tft.drawCircle(x + 50, y + 50, 28, color);
tft.fillCircle(x + 50, y + 50, 20, color);
tft.setFont(Arial_12_Bold);
tft.setCursor(x + 160, y + 50);
tft.print(psz);
}
void drawColorDelay(uint16_t x, uint16_t y, const char *psz, uint16_t color)
{
tft.setFontAdafruit();
tft.setTextColor(color);
tft.setTextSize(2);
tft.setCursor(x, y);
tft.print(psz);
tft.drawRect(x + 100, y, 50, 50, color);
delay(30);
tft.fillRect(x + 110, y + 10, 30, 30, color);
delay(30);
tft.drawLine(x + 100, y + 70, x + 200, y + 70, color);
delay(30);
tft.drawLine(x + 220, y, x + 220, y + 70, color);
tft.drawLine(x + 100, y + 70, x + 220, y, color);
if (use_frame_buffer && (color == ILI9488_GREEN || color == ILI9488_CYAN || color == ILI9488_YELLOW)) {
tft.updateScreen();
delay(210);
}
delay(30);
tft.drawCircle(x + 50, y + 50, 28, color);
tft.fillCircle(x + 50, y + 50, 20, color);
delay(30);
tft.setFont(Arial_12_Bold);
tft.setCursor(x + 160, y + 50);
tft.print(psz);
}
//=============================================================================
// Loop
//=============================================================================
int hh=0;
void loop()
{
if ( hh>10 ) {
for ( int oo=0; oo<4; oo++ )
loop1();
delay(500);
}
tft.useFrameBuffer(use_frame_buffer);
tft.setFont(Arial_18_Bold);
tft.setCursor(0, 150);
if (use_frame_buffer) {
tft.fillScreen(ILI9488_DARKGREY);
} else {
tft.fillScreen(ILI9488_BLACK);
}
int myX1, myX2;
if ( use_frame_buffer ) {
myX1 = 240;
myX2 = 0;
}
else {
myX1 = 0;
myX2 = 240;
}
drawColor(myX1, 0, "Red", ILI9488_RED);
drawColor(myX1, 80, "Green", ILI9488_GREEN);
drawColor(myX1, 160, "Blue", ILI9488_BLUE);
drawColor(myX1, 240, "White", ILI9488_WHITE);
//if (!use_frame_buffer) delay(1000);
drawColor(myX2, 0, "Yellow", ILI9488_YELLOW);
drawColor(myX2, 80, "Orange", ILI9488_ORANGE);
drawColor(myX2, 160, "Cyan", ILI9488_CYAN);
drawColor(myX2, 240, "Pink", ILI9488_PINK);
if (use_frame_buffer) {
tft.updateScreen();
use_frame_buffer = false;
} else {
use_frame_buffer = true;
}
hh++;
delay(200);
}
void loop1()
{
hh=0;
tft.useFrameBuffer(use_frame_buffer);
tft.setFont(Arial_18_Bold);
tft.setCursor(0, 150);
if (use_frame_buffer) {
tft.fillScreen(ILI9488_DARKGREY);
} else {
tft.fillScreen(ILI9488_BLACK);
}
int myX1, myX2;
if ( use_frame_buffer ) {
myX1 = 240;
myX2 = 0;
}
else {
myX1 = 0;
myX2 = 240;
}
drawColor(myX1, 0, "Red", ILI9488_RED);
drawColor(myX1, 80, "Green", ILI9488_GREEN);
drawColor(myX1, 160, "Blue", ILI9488_BLUE);
drawColor(myX1, 240, "White", ILI9488_WHITE);
if (!use_frame_buffer) delay(1000);
drawColor(myX2, 0, "Yellow", ILI9488_YELLOW);
drawColor(myX2, 80, "Orange", ILI9488_ORANGE);
drawColor(myX2, 160, "Cyan", ILI9488_CYAN);
drawColor(myX2, 240, "Pink", ILI9488_PINK);
if (use_frame_buffer) {
tft.updateScreen();
use_frame_buffer = false;
} else {
use_frame_buffer = true;
}
delay(2500);
}