Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

drawStates.h

Committer:
Owenmatthewmcgowan
Date:
2017-05-26
Revision:
49:243b5e826228
Parent:
48:76ac309a2bd9

File content as of revision 49:243b5e826228:



void draw_state(int i)
{
    TFT.cls(); // clear screen
    switch (i) {
        case (1): // interface 1 : digital clock 
            //buttons
            TFT.fillrect(0, 0, 50, 50, Red);  //first button for digital to analog interface change
            TFT.background(Red);
            TFT.locate(2,5);
            TFT.set_font((unsigned char*) Arial12x12);
            TFT.printf("Digi/\n\rALog");
            TFT.fillrect(0, 50, 50, 100, Green); //second button for settings page
            TFT.background(Green);
            TFT.locate(2, 55);
            TFT.printf("Set\n\rTime");
            TFT.fillrect(0, 100, 50, 150, Blue); //third button for whiteboard
            TFT.background(Blue);
            TFT.locate(2, 105);
            TFT.printf("Draw");
            TFT.background(White);
            TFT.fillrect(0, 150, 50, 200, White); //last button for pong game
            TFT.foreground(Black);
            TFT.locate(2,155);
            TFT.printf("Cycle\n\rFaces");
            TFT.background(Black);
            TFT.foreground(White);
            TFT.fillrect(0, 200, 50, 240, Black); //home button to reset
            TFT.locate(2, 205);
            TFT.printf("Home");

            TFT.rect(0, 0, 50, 50, White);
            TFT.rect(0, 50, 50, 100, White);
            TFT.rect(0, 100, 50, 150, White);
            TFT.rect(0, 150, 50, 200, White);
            TFT.rect(0, 200, 50, 240, White);
            //clock area
            TFT.rect(50, 0, 320, 100, White);
            //Day
            TFT.rect(50, 100, 140, 200, White);
            //Alarm Area
            TFT.rect(140, 100 , 320, 200, White);
            //Date Area
            TFT.rect(50, 200, 320, 240, White);
            //Colons
            int tx,ty = 0;
            ty = 50;
            tx = 140;
            TFT.fillcircle(tx, ty - 10, 2, White);
            TFT.fillcircle(tx, ty + 10, 2, White);
            tx = 230;
            TFT.fillcircle(tx, ty - 10, 2, White);
            TFT.fillcircle(tx, ty + 10, 2, White);
            ty = 150;
            TFT.fillcircle(tx, ty - 10, 2, White);
            TFT.fillcircle(tx, ty + 10, 2, White);
            break;
        case (2): // analog clock interface
            //same button configuration as the first interface
            TFT.fillrect(0, 0, 50, 50, Red);
            TFT.background(Red);
            TFT.locate(2,5);
            TFT.set_font((unsigned char*) Arial12x12);
            TFT.printf("Digi/\n\rALog");
            TFT.fillrect(0, 50, 50, 100, Green);
            TFT.background(Green);
            TFT.locate(2, 55);
            TFT.printf("Set\n\rTime");
            TFT.fillrect(0, 100, 50, 150, Blue);
            TFT.background(Blue);
            TFT.locate(2, 105);
            TFT.printf("Draw");
            TFT.background(White);
            TFT.fillrect(0, 150, 50, 200, White);
            TFT.foreground(Black);
            TFT.locate(2,155);
            TFT.printf("Cycle\n\rFaces");
            TFT.background(Black);
            TFT.foreground(White);
            TFT.fillrect(0, 200, 50, 240, Black);
            TFT.locate(2, 205);
            TFT.printf("Home");

            TFT.rect(0, 0, 50, 50, White);
            TFT.rect(0, 50, 50, 100, White);
            TFT.rect(0, 100, 50, 150, White);
            TFT.rect(0, 150, 50, 200, White);
            TFT.rect(0, 200, 50, 240, White);
            //Date Area

            //clock area
            int r = 100;
            draw_clockface(50 + r, r, r, 5, White);
            //Alarm Area
            TFT.rect(250, 0, 320, 200, White);
            TFT.rect(50, 0, 250, 200, White);
            TFT.rect(50, 200, 320, 240, White);
            tx = 285;
            TFT.fillcircle(tx - 10, 100, 2, White);
            TFT.fillcircle(tx + 10, 100, 2, White);
            break;
        case (4): // whiteboard
            whiteboard();
            break;

        

        
    }
}