//=============================================================================
//=============================================================================
#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()
{
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
while (!Serial && millis() < 3000) ;
Serial.begin(115200);
delay(50);
tft.begin();
tft.setRotation(3); // 180
delay(100);
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);
}
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);
}
//=============================================================================
// Loop
//=============================================================================
bool use_frame_buffer = false;
void loop()
{
uint32_t time_start = millis();
#if defined(ENABLE_ILI9488_FRAMEBUFFER)
tft.useFrameBuffer(use_frame_buffer);
#endif
tft.setFont(Arial_18_Bold);
tft.setCursor(0, 150);
#if defined(ENABLE_ILI9488_FRAMEBUFFER)
if (use_frame_buffer) {
tft.fillScreen(ILI9488_GREENYELLOW);
} else {
tft.fillScreen(ILI9488_BLACK);
}
#else
tft.fillScreen(ILI9488_BLACK);
#endif
drawColor(0, 0, "Red", ILI9488_RED);
drawColor(0, 80, "Green", ILI9488_GREEN);
drawColor(0, 160, "Blue", ILI9488_BLUE);
drawColor(0, 240, "White", ILI9488_WHITE);
drawColor(240, 0, "Yellow", ILI9488_YELLOW);
drawColor(240, 80, "Orange", ILI9488_ORANGE);
drawColor(240, 160, "Cyan", ILI9488_CYAN);
drawColor(240, 240, "Pink", ILI9488_PINK);
#if defined(ENABLE_ILI9488_FRAMEBUFFER)
if (use_frame_buffer) {
tft.updateScreen();
use_frame_buffer = false;
} else {
use_frame_buffer = true;
}
#endif
if (Serial) {
Serial.println(millis()-time_start, DEC);
}
delay(2500);
}