Karl Zweimüller
/
UniGraphic-St7920-Test
Unigraphic Testprogramm for ST7920-controller
Diff: main.cpp
- Revision:
- 1:5ebf4110eee0
- Parent:
- 0:51143e132729
--- a/main.cpp Sat May 20 21:12:25 2017 +0000 +++ b/main.cpp Sun May 21 20:51:06 2017 +0000 @@ -40,7 +40,8 @@ //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 // cs, reset,dc must not be NC! -ST7920 myLCD(SPI_8, 1000000, p11, p12, p13, p15, p14, p16, "128x64-ST7920", 128, 64); //Spi 8bit, 1MHz, mosi, miso, sclk, cs, reset, dc +// ST7920 can go up to 2,5MHz SPI-clock according to datasheet.Mine works with 10MHz fine too... +ST7920 myLCD(SPI_8, 10000000, p11, p12, p13, p15, p14, p16, "128x64-ST7920", 128, 64); //Spi 8bit, 1MHz, mosi, miso, sclk, cs, reset, dc Timer t; @@ -77,11 +78,11 @@ pc.printf("cls() ...\r\n"); myLCD.cls(); - wait(5); + wait(1); pc.printf("fillrect(0, 0, 127 , 63, black) ...\r\n"); myLCD.fillrect(0, 0, 127 , 63, Black); - wait(10); + wait(5); pc.printf("Pixels at corners...\n\r"); myLCD.cls(); @@ -90,19 +91,23 @@ myLCD.pixel(1,62,Black); myLCD.pixel(126,1,Black); myLCD.copy_to_lcd(); - wait(10); + wait(5); myLCD.cls(); // clear the screen myLCD.locate(0,30); + myLCD.printf("Display ID: %.8X\r\n", myLCD.tftID); pc.printf("Display ID: %.8X\r\n", myLCD.tftID); // mem write/read test + myLCD.printf("Dimension: %dX%d\r\n",myLCD.width(),myLCD.height()); + unsigned short readback; unsigned short colorstep = (0x10000/myLCD.width()); for(unsigned short i=0; i<myLCD.width(); i++) { myLCD.pixel(i,0,i*colorstep); // write line } + myLCD.copy_to_lcd(); bool readerror=false; for(unsigned short i=0; i<myLCD.width(); i++) // verify line { @@ -118,6 +123,7 @@ wait(2); led2=1; myLCD.cls(); + myLCD.set_auto_up(false); 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"); @@ -125,6 +131,7 @@ // myLCD.locate(0,0); myLCD.printf("\r\nDisplay Test\r\nSome text just to see if auto carriage return works correctly"); pc.printf(" Display Test \r\n"); + myLCD.set_auto_up(true); wait(3); led1=0; t.reset(); @@ -136,6 +143,7 @@ wait(3); myLCD.cls(); + myLCD.set_auto_up(false); t.reset(); // draw some graphics //myLCD.cls(); @@ -167,8 +175,10 @@ myLCD.set_font((unsigned char*) Terminal6x8); myLCD.printf("plot: %.3fms", (float)time/1000); pc.printf("plot: %.3fms\r\n", (float)time/1000); + myLCD.set_auto_up(true); wait(3); myLCD.cls(); + myLCD.set_auto_up(false); t.reset(); Bitmap_s pic = { 64, // XSize @@ -181,8 +191,10 @@ myLCD.locate(2,55); myLCD.printf("bmp: %.3fms", (float)time/1000); pc.printf("bmp: %.3fms\r\n", (float)time/1000); + myLCD.set_auto_up(true); wait(3); myLCD.cls(); + myLCD.set_auto_up(false); myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false); //only numbers, variable-width disabled t.reset(); myLCD.locate(0,0); @@ -192,6 +204,7 @@ myLCD.set_font((unsigned char*) Terminal6x8); myLCD.printf("Big Font: %.3fms", (float)time/1000); pc.printf("Big Font: %.3fms\r\n", (float)time/1000); + myLCD.set_auto_up(true); wait(3); // sparse pixels test myLCD.cls();