Sorry guys I posted it, and then realized there is a 5 minute waiting time on posting again.
Rest of the code is pretty much TFT functions.
//======= Custom Functions ===========
// drawHomeScreen - Custom Function
void drawHomeScreen() {
//Title Screen
myGLCD.setBackColor(0, 0, 0); // Sets the background color of area where text will be printed to black
myGLCD.setColor(255, 255, 255); // Sets Text color to White
myGLCD.setFont(GroteskBold24x48); //Sets Font to big
myGLCD.print("LEAD TEST", CENTER, 10);
//Yellow Line
myGLCD.setColor(240, 184, 35);
myGLCD.drawLine(25, 65, 775, 65);
myGLCD.drawLine(25, 66, 775, 66);
myGLCD.drawLine(25, 67, 775, 67);
myGLCD.drawLine(25, 68, 775, 68);
//CW Start Button
myGLCD.setColor(240, 184, 35); // Sets rectangle fill color to Yellow
myGLCD.fillRect(40, 100, 325, 200); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets Color of outer rectangle to white
myGLCD.drawRect(40, 100, 325, 200); // Draws the rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(0, 0, 0); // Sets Font Color to black
myGLCD.setBackColor(240, 184, 35); // Sets font background color to Yellow
myGLCD.print("CW START", 87, 127); // Prints button label
//CCW Start Button
myGLCD.setColor(240, 184, 35); // Sets rectangle fill color to Yellow
myGLCD.fillRect(40, 220, 325, 320); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets Color of outer rectangle to white
myGLCD.drawRect(40, 220, 325, 320); // Draws rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(0, 0, 0); // Sets Font Color to black
myGLCD.setBackColor(240, 184, 35); // Sets font background color to Yellow
myGLCD.print("CCW START", 78, 246); // Prints button label
//Rest Button
myGLCD.setColor(240, 184, 35); // Sets rectangle fill color to Yellow
myGLCD.fillRect(40, 340, 325, 440); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets color of outer rectangle to white
myGLCD.drawRect(40, 340, 325, 440); // Draws rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(0, 0, 0); // Sets Font Color to black
myGLCD.setBackColor(240, 184, 35); // Sets font background color to Yellow
myGLCD.print("RESET", 122, 366); // Prints button label
}
// Highlights buttons when pressed
void cwStartButton(int x1, int y1, int x2, int y2) {
if (myTouch.dataAvailable()) { //Checks to see if new data from touchscreen is waiting
myTouch.read(); //Reads data from touchscreen if dataAvailable = true
x = myTouch.getX(); // x values of screen input
y = myTouch.getY(); // y values of screen input
if ((x >= 40) && (x <= 325) && (y >= 100) && (y <= 205)) {
myGLCD.setColor(126, 126, 126);
myGLCD.drawRect (x1, y1, x2, y2);
myGLCD.setColor(0, 150, 0); // Sets rectangle fill color to Yellow
myGLCD.fillRect(x1, y1, x2, y2); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets Color of outer rectangle to white
myGLCD.drawRect(x1, y1, x2, y2); // Draws the rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(255, 255, 255); // Sets Font Color to black
myGLCD.setBackColor(0, 150, 0); // Sets font background color to Yellow
myGLCD.print("CW START", 87, 127); // Prints button label
buttonState = 1;
}
}
}
void ccwStartButton(int x1, int y1, int x2, int y2) {
if (myTouch.dataAvailable()) { //Checks to see if new data from touchscreen is waiting
myTouch.read(); //Reads data from touchscreen if dataAvailable = true
x = myTouch.getX(); // x values of screen input
y = myTouch.getY(); // y values of screen input
if ((x >= 40) && (x <= 325) && (y >= 220) && (y <= 320)) {
myGLCD.setColor(126, 126, 126);
myGLCD.drawRect (x1, y1, x2, y2);
myGLCD.setColor(0, 150, 0); // Sets rectangle fill color to Yellow
myGLCD.fillRect(x1, y1, x2, y2); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets Color of outer rectangle to white
myGLCD.drawRect(x1, y1, x2, y2); // Draws the rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(255, 255, 255); // Sets Font Color to black
myGLCD.setBackColor(0, 150, 0); // Sets font background color to Yellow
myGLCD.print("CCW START", 78, 246); // Prints button label
buttonState = 2;
}
}
}
void resetButton(int x1, int y1, int x2, int y2) {
if (myTouch.dataAvailable()) { //Checks to see if new data from touchscreen is waiting
myTouch.read(); //Reads data from touchscreen if dataAvailable = true
x = myTouch.getX(); // x values of screen input
y = myTouch.getY(); // y values of screen input
if ((x >= 40) && (x <= 325) && (y >= 340) && (y <= 440)) {
myGLCD.setColor(126, 126, 126);
myGLCD.drawRect (x1, y1, x2, y2);
myGLCD.setColor(0, 150, 0); // Sets rectangle fill color to Yellow
myGLCD.fillRect(x1, y1, x2, y2); // Draws filled rectangle
myGLCD.setColor(255, 255, 255); // Sets Color of outer rectangle to white
myGLCD.drawRect(x1, y1, x2, y2); // Draws the rectangle to give button outer border
myGLCD.setFont(GroteskBold24x48); // Sets font to Grotesk Size
myGLCD.setColor(255, 255, 255); // Sets Font Color to black
myGLCD.setBackColor(0, 150, 0); // Sets font background color to Yellow
myGLCD.print("RESET", 122, 366); // Prints button label
buttonState = 0;
cwstateMillis = 0;
ccwstateMillis = 0;
drawHomeScreen();
}
}
}