#include <XPT2046_Touchscreen.h>
#include "ILI9341_t3.h"
#include "font_Georgia.h"
#include "font_CourierNew.h"
#define CS_PIN 8
#define TFT_DC 9
#define TFT_CS 10
int screenX = 1920;
int screenY = 1080;
int intDoneLeft = 182;
int intDoneTop = 160;
int intDoneWidth = 120;
int intDoneHeight = 60;
int intDoneTextTop = intDoneTop + 16;
int intDoneTextLeft = intDoneLeft + 32;
int intLine1Top = 76;
int intButtonRadius = 5;
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
XPT2046_Touchscreen ts(CS_PIN);
TS_Point p;
int screenWidth = 1920;
int screenHeight = 1080;
void setup()
{
tft.begin();
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
Serial.begin(9600);
while (!Serial & millis() <4000)
{
}
Serial.println("ILI9341 Test");
if (!ts.begin())
{
Serial.println("Couldn't start touchscreen controller");
while (1);
}
Serial.println("Touchscreen started");
}
void loop(void)
{
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_YELLOW);
tft.setCursor(32, 10);
tft.setFont(CourierNew_18);
tft.println("Screen Resolution");
tft.setTextColor(ILI9341_WHITE);
tft.setCursor(71, intLine1Top);
tft.setFont(CourierNew_12);
tft.println("Screen Width:");
tft.setCursor(86, intLine1Top);
tft.println(screenX);
tft.setCursor(61, intLine1Top + 20);
tft.println("Screen Height:");
tft.setCursor(86, intLine1Top + 20);
tft.println(screenY);
tft.fillRoundRect(intDoneLeft, intDoneTop, intDoneWidth, intDoneHeight, intButtonRadius, ILI9341_GREEN);
tft.setFont(CourierNew_16);
tft.setTextColor(ILI9341_BLACK);
tft.setCursor(intDoneTextLeft + 4, intDoneTextTop + 8);
tft.println("Done");
tft.setFont(Georgia_12);
while (1);
} // end Loop()