Geremia G
/
UniGraphic_demo
UniGraphic demo for TFT and LCD, par or spi
Diff: main.cpp
- Revision:
- 5:c69049e461b7
- Parent:
- 4:818956c30cae
- Child:
- 6:851dbb62def7
--- a/main.cpp Mon Feb 23 23:40:04 2015 +0000 +++ b/main.cpp Mon Mar 23 16:02:02 2015 +0000 @@ -10,7 +10,9 @@ //#include "IST3020.h" //#include "UC1608.h" -#include "ILI9341.h" +//#include "ST7565.h" +#include "ILI932x.h" +//#include "ILI9341.h" //#include "ILI9486.h" //#include "TFT_MIPI.h" //#include "SSD1306.h" @@ -19,14 +21,21 @@ //IST3020 myLCD(PAR_8, PortC, PC_8, PC_9, PA_0, PA_1, PA_4,"myLCD", 192, 64); // Parallel 8bit, Port, CS, reset, A0, WR, RD for F302 //UC1608 myLCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"myLCD", 240, 120); // Spi 16bit, 10MHz, mosi, miso, sclk, cs, reset, dc -ILI9341 myLCD(SPI_16, 12000000, D11, D12, D13, D10, D9, D8,"myLCD"); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset, dc -//ILI9341 myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401 -//ILI9486 myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401 -//TFT_MIPI myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, A0, WR, RD for F401 +//ST7565 myLCD(PAR_8, PortC, PC_8, PC_9, PA_0, PA_1, PA_4,"myLCD", 128, 64); // Parallel 8bit, Port, CS, reset, A0, WR, RD +ILI932x myLCD(PAR_8, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 8bit, Port, CS, reset, RS, WR, RD for F401 +//ILI932x myLCD(SPI_16, 10000000, D11, D12, D13, D10, D9,"myLCD"); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset +//ILI9341 myLCD(SPI_16, 12000000, D11, D12, D13, D10, D9, D8,"myLCD"); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset, dc +//ILI9341 myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, DC, WR, RD for F401 +//ILI9486 myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, DC, WR, RD for F401 +//TFT_MIPI myLCD(PAR_16, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 16bit, Port, CS, reset, DC, WR, RD for F401 //SSD1306 myLCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"myLCD", 240, 120); // Spi 16bit, 10MHz, mosi, miso, sclk, cs, reset, dc +//ILI9486 myLCD(SPI_8, 12000000, PA_7, PA_6, PA_5, PB_6, PA_8, PA_9,"myLCD"); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset, dc for minimaple +//ILI9341 myLCD(SPI_8, 12000000, PA_7, PA_6, PA_5, PB_6, PA_8, PA_9,"myLCD"); // Spi 16bit, 12MHz, mosi, miso, sclk, cs, reset, dc for minimaple Timer t; +//unsigned short backgroundcolor=White; +//unsigned short foregroundcolor=Black; unsigned short backgroundcolor=Black; unsigned short foregroundcolor=White; @@ -40,13 +49,17 @@ pc.baud (115200); pc.printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000); t.start(); - + // myLCD.set_font((unsigned char*) Terminal6x8); // myLCD.claim(stdout); // send stdout to the LCD display //myLCD.claim(stderr); // send stderr to the LCD display myLCD.background(backgroundcolor); // set background to black myLCD.foreground(foregroundcolor); // set chars to white + + while(1) + { + myLCD.set_orientation((orient++)%4); +// myLCD.set_orientation(2); myLCD.cls(); // clear the screen - // myLCD.set_font((unsigned char*) Terminal6x8); myLCD.locate(0,30); myLCD.printf("Display ID: %.8X\r\n", myLCD.tftID); pc.printf("Display ID: %.8X\r\n", myLCD.tftID); @@ -70,20 +83,14 @@ myLCD.locate(0,10); myLCD.printf("pixelread test %s\r\n", readerror ? "FAIL":"PASS"); wait(2); - - - while(1) - { - myLCD.set_orientation((orient++)%4); -// myLCD.set_orientation(2); myLCD.cls(); myLCD.set_font((unsigned char*) Terminal6x8,32,127,false); //variable width disabled myLCD.locate(0,0); - myLCD.printf("Display Test\r\nSome text just to see if auto carriage return works correctly 00__"); + myLCD.printf("Display Test\r\nSome text just to see if auto carriage return works correctly"); myLCD.set_font((unsigned char*) Terminal6x8); // myLCD.locate(0,0); - myLCD.printf("\r\nDisplay Test\r\nSome text just to see if auto carriage return works correctly 00__"); + myLCD.printf("\r\nDisplay Test\r\nSome text just to see if auto carriage return works correctly"); pc.printf(" Display Test \r\n"); wait(3); t.reset(); @@ -149,8 +156,8 @@ time=t.read_us(); myLCD.locate(2,55); myLCD.set_font((unsigned char*) Terminal6x8); - myLCD.printf("Big Font speed: %.3fms", (float)time/1000); - pc.printf("Big Font speed: %.3fms\r\n", (float)time/1000); + myLCD.printf("Big Font: %.3fms", (float)time/1000); + pc.printf("Big Font: %.3fms\r\n", (float)time/1000); wait(3); // sparse pixels test myLCD.cls(); @@ -172,13 +179,13 @@ myLCD.copy_to_lcd(); time2=t.read_us(); myLCD.locate(2,55); - myLCD.printf("std: %.3fms fastw: %.3fms", (float)time2/1000, (float)time/1000); + myLCD.printf("std:%.3fms fastw:%.3fms", (float)time2/1000, (float)time/1000); pc.printf("std: %.3fms fastw: %.3fms\r\n", (float)time2/1000, (float)time/1000); wait(3); // scroll test, only for TFT myLCD.cls(); myLCD.set_font((unsigned char*) Arial24x23); - myLCD.locate(10,10); + myLCD.locate(2,10); myLCD.printf("Scrolling"); myLCD.rect(0,0,myLCD.width()-1,myLCD.height()-1,White); myLCD.rect(1,1,myLCD.width()-2,myLCD.height()-2,Blue);