Using touch screen features of LCD screen.

Dependencies:   DmTouch_UniGraphic UniGraphic mbed

Fork of DisplayModule24_demo by John Larkin

Revision:
2:2b781c215ac0
Parent:
1:083257298075
Child:
3:65af1a9fedda
--- a/main.cpp	Mon Feb 16 01:04:34 2015 +0000
+++ b/main.cpp	Tue Feb 17 11:06:11 2015 +0000
@@ -9,15 +9,17 @@
 
 //#include "IST3020.h"
 //#include "UC1608.h"
-//#include "ILI9341.h"
-#include "ILI9486.h"
+#include "ILI9341.h"
+//#include "ILI9486.h"
+//#include "TFT_MIPI.h"
 
 Serial pc(USBTX, USBRX);
 
 //IST3020 LCD(PAR_8, PortC, PC_8, PC_9, PA_0, PA_1, PA_4,"LCD"); // Parallel 8bit, Port, CS, reset, A0, WR, RD for F302
 //UC1608 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD"); // Spi 16bit, 10MHz, mosi, miso, sclk, cs, reset, dc
-//ILI9341 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD"); // Spi 16bit, 10MHz, mosi, miso, sclk, cs, reset, dc
-ILI9486 LCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"LCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401
+ILI9341 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD"); // Spi 16bit, 10MHz, mosi, miso, sclk, cs, reset, dc
+//ILI9486 LCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"LCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401
+//TFT_MIPI LCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"LCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401
 
 Timer t;
 
@@ -41,7 +43,8 @@
     LCD.foreground(foregroundcolor);    // set chars to white
     LCD.cls();                // clear the screen
  //   LCD.set_font((unsigned char*) Terminal6x8);
-    
+    LCD.locate(0,30);
+    LCD.printf("Display ID: %.8X\r\n", LCD.tftID);
     // mem write/read test
     unsigned short readback;
     unsigned short colorstep = (0x10000/LCD.width());
@@ -140,5 +143,40 @@
     LCD.printf("Big Font speed: %.3fms", (float)time/1000);
     pc.printf("Big Font speed: %.3fms\r\n", (float)time/1000);
     wait(3);
+    // scroll test, only for TFT
+    LCD.cls();
+    LCD.set_font((unsigned char*) Arial24x23);
+    LCD.locate(10,10);
+    LCD.printf("Scrolling");
+    LCD.rect(0,0,LCD.width()-1,LCD.height()-1,White);
+    LCD.rect(1,1,LCD.width()-2,LCD.height()-2,Blue);
+    LCD.setscrollarea(0,LCD.sizeY());
+    wait(1);
+    LCD.scroll(1); //up 1
+    wait(1);
+    LCD.scroll(0); //center
+    wait(1);
+    LCD.scroll(LCD.sizeY()-1); //down 1
+    wait(1);
+    LCD.scroll(LCD.sizeY()); // same as 0, center
+    wait(1);
+    LCD.scroll(LCD.sizeY()>>1); // half screen
+    wait(1);
+    LCD.scrollreset(); // center
+    wait(1);
+    for(unsigned short i=1; i<=LCD.sizeY(); i++)
+    {
+        LCD.scroll(i);
+        wait_ms(2);
+    }
+    wait(2);
+    // color inversion
+    for(unsigned short i=0; i<=8; i++)
+    {
+        LCD.invert(i&1);
+        wait_ms(200);
+    }
+    wait(2);
+    
     }
 }
\ No newline at end of file