@mjs513 @KurtE
I think there was a little bit of confusion on what I had did the other day.
I used the below code and attached library to operate the adafruit display with the t3.6 but still had the touchscreen from the ili9488 connected to the t3.6 instead of the one on the adafruit display. I did not have any rotation or mirror problems. I used the same jumper wires with the adafruit display as I did with the ili9488 which would lead me to believe that the problem is in the display library and that the touchscreen and the touchscreen library are fine. Unfortunately I'm not experienced enough to understand everything that is going on in the library. I might be better off trying to incorporate a touch screen controller.
I did try this with ili9488 but I still ended up with the rotation and mirror problem.
I think there was a little bit of confusion on what I had did the other day.
I used the below code and attached library to operate the adafruit display with the t3.6 but still had the touchscreen from the ili9488 connected to the t3.6 instead of the one on the adafruit display. I did not have any rotation or mirror problems. I used the same jumper wires with the adafruit display as I did with the ili9488 which would lead me to believe that the problem is in the display library and that the touchscreen and the touchscreen library are fine. Unfortunately I'm not experienced enough to understand everything that is going on in the library. I might be better off trying to incorporate a touch screen controller.
Code:
#include "SPI.h"
#include "HX8357_t3.h"
#include "TouchScreen.h"
#define TFT_DC 9
#define TFT_CS 10
HX8357_t3 tft = HX8357_t3(TFT_CS, TFT_DC);
#define YP A18
#define XM A19
#define YM 5
#define XP 6
#define TS_MINX 120
#define TS_MINY 50
#define TS_MAXX 920
#define TS_MAXY 940
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define MINPRESSURE 10
#define MAXPRESSURE 1000
void setup(){
tft.begin(HX8357D);
tft.setRotation(3);
tft.fillScreen(HX8357_BLACK);
tft.setTextColor(HX8357_GREEN, HX8357_BLACK); tft.setTextSize(3);
}
void loop(){
touchscreen();
}
void touchscreen(){
TSPoint p = ts.getPoint();
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
tft.setCursor(0,25);
tft.print("Z=");
tft.print(p.z);
tft.print(" ");
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
tft.setCursor(0,0);
tft.print("X=");
tft.print(p.x);
tft.print(" ");
tft.setCursor(200,0);
tft.print("Y=");
tft.print(p.y);
tft.print(" ");
}
}
I did try this with ili9488 but I still ended up with the rotation and mirror problem.
Code:
#include "SPI.h"
#include "ILI9488_t3.h"
#include "TouchScreen.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);
unsigned long time = 0;
unsigned long ptouchtime = 0;
#define YP A18
#define XM A19
#define YM 5
#define XP 6
#define TS_MINX 120
#define TS_MINY 50
#define TS_MAXX 920
#define TS_MAXY 940
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define MINPRESSURE 10
#define MAXPRESSURE 1000
int screenx = 0;
int screeny = 0;
int screenz = 0;
void setup(){
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9488_BLACK);
tft.setTextColor(ILI9488_GREEN, ILI9488_BLACK); tft.setTextSize(3);
}
void loop(){
tftdisplay();
touchscreen();
}
void tftdisplay(){
tft.setCursor(0,0);
tft.print("X=");
tft.print(screenx);
tft.print(" ");
tft.setCursor(200,0);
tft.print("Y=");
tft.print(screeny);
tft.print(" ");
tft.setCursor(0,25);
tft.print("Z=");
tft.print(screenz);
tft.print(" ");
}
void touchscreen(){
time = millis();
unsigned long touchtime = time;
if(touchtime - ptouchtime >= 1000){
TSPoint p = ts.getPoint();
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
screenz = p.z;
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
screenx = p.x;
screeny = p.y;
}
else{
screenx = 0;
screeny = 0;
}
ptouchtime = touchtime;
}
}