Program to demonstrate the features of the DisplayModule DM-TFT24-104 display using the UniGraphics library.

Dependencies:   DmTouch_UniGraphic UniGraphic mbed

Fork of DisplayModule24_demo by Whitworth-EN173-2016

Revision:
3:65af1a9fedda
Parent:
2:2b781c215ac0
Child:
4:818956c30cae
--- a/main.cpp	Tue Feb 17 11:06:11 2015 +0000
+++ b/main.cpp	Thu Feb 19 00:39:57 2015 +0000
@@ -15,8 +15,8 @@
 
 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
+//IST3020 LCD(PAR_8, PortC, PC_8, PC_9, PA_0, PA_1, PA_4,"LCD", 192, 64); // Parallel 8bit, Port, CS, reset, A0, WR, RD for F302
+//UC1608 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD", 240, 120); // 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
 //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
@@ -32,7 +32,7 @@
 //    LCD.set_contrast(26);//for uc1608
  //   LCD.set_contrast(46);//for ist3020
     LCD.set_orientation(orient);
-    int time;
+    int time, time2;
     pc.baud (115200);
     pc.printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000);
     t.start();
@@ -73,9 +73,12 @@
     LCD.set_orientation((orient++)%4);
 //    LCD.set_orientation(2);
     LCD.cls();
-    LCD.set_font((unsigned char*) Terminal6x8);
+    LCD.set_font((unsigned char*) Terminal6x8,32,127,false); //variable width disabled
     LCD.locate(0,0);
-    LCD.printf("Display Test\r\nSome text just to see if auto carriage return works correctly");
+    LCD.printf("Display Test\r\nSome text just to see if auto carriage return works correctly 00__");
+    LCD.set_font((unsigned char*) Terminal6x8);
+ //   LCD.locate(0,0);
+    LCD.printf("\r\nDisplay Test\r\nSome text just to see if auto carriage return works correctly 00__");
     pc.printf("  Display Test \r\n");
     wait(3);
     t.reset();
@@ -143,6 +146,29 @@
     LCD.printf("Big Font speed: %.3fms", (float)time/1000);
     pc.printf("Big Font speed: %.3fms\r\n", (float)time/1000);
     wait(3);
+    // sparse pixels test
+    LCD.cls();
+    LCD.FastWindow(false);
+    t.reset();
+    for(unsigned int i=0; i<20000; i++)
+    {
+        LCD.pixel((i+(i*89)%LCD.width()), (i+(i*61)%LCD.height()), White);
+    }
+    LCD.copy_to_lcd();
+    time=t.read_us();
+    LCD.cls();
+    LCD.FastWindow(true);
+    t.reset();
+    for(unsigned int i=0; i<20000; i++)
+    {
+        LCD.pixel((i+(i*89)%LCD.width()), (i+(i*61)%LCD.height()), White);
+    }
+    LCD.copy_to_lcd();
+    time2=t.read_us();
+    LCD.locate(2,55);
+    LCD.printf("std: %.3fms fastw: %.3fms", (float)time/1000, (float)time2/1000);
+    pc.printf("std: %.3fms fastw: %.3fms\r\n", (float)time/1000, (float)time2/1000);
+    wait(3);
     // scroll test, only for TFT
     LCD.cls();
     LCD.set_font((unsigned char*) Arial24x23);