Geremia G
/
UniGraphic_demo
UniGraphic demo for TFT and LCD, par or spi
Revision 6:851dbb62def7, committed 2022-01-25
- Comitter:
- Geremia
- Date:
- Tue Jan 25 18:00:21 2022 +0000
- Parent:
- 5:c69049e461b7
- Commit message:
- updated to OS6 baremetal, got bored about online compiler, mbed studio, platformIO and all this shitty kiddy stuff
Changed in this revision
--- a/UniGraphic.lib Mon Mar 23 16:02:02 2015 +0000 +++ b/UniGraphic.lib Tue Jan 25 18:00:21 2022 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/GraphicsDisplay/code/UniGraphic/#14daa48ffd4c +http://developer.mbed.org/teams/GraphicsDisplay/code/UniGraphic/#c66986d80f72
--- a/main.cpp Mon Mar 23 16:02:02 2015 +0000 +++ b/main.cpp Tue Jan 25 18:00:21 2022 +0000 @@ -1,6 +1,6 @@ -#include "stdio.h" +//#include "stdio.h" #include "mbed.h" -#include "string" +//#include "string" #include "Arial12x12.h" #include "Arial24x23.h" //#include "Terminal6x8.h" @@ -11,20 +11,26 @@ //#include "IST3020.h" //#include "UC1608.h" //#include "ST7565.h" -#include "ILI932x.h" -//#include "ILI9341.h" +//#include "ILI932x.h" +#include "ILI9341.h" //#include "ILI9486.h" //#include "TFT_MIPI.h" //#include "SSD1306.h" -Serial pc(USBTX, USBRX); + +BufferedSerial serial_port(USBTX, USBRX, 115200); +FileHandle *mbed::mbed_override_console(int fd) +{ + return &serial_port; +} + //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 //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(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(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 @@ -46,8 +52,8 @@ // myLCD.set_contrast(46);//for ist3020 myLCD.set_orientation(orient); int time, time2; - pc.baud (115200); - pc.printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000); + // serial_port.set_baud (115200); + 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 @@ -62,7 +68,7 @@ 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); + printf("Display ID: %.8X\r\n", myLCD.tftID); // mem write/read test unsigned short readback; unsigned short colorstep = (0x10000/myLCD.width()); @@ -77,12 +83,12 @@ if(readback!=i*colorstep) { readerror=true; - pc.printf("pix %.4X readback %.4X\r\n", i*colorstep, readback); + printf("pix %.4X readback %.4X\r\n", i*colorstep, readback); } } myLCD.locate(0,10); myLCD.printf("pixelread test %s\r\n", readerror ? "FAIL":"PASS"); - wait(2); + thread_sleep_for(2000); myLCD.cls(); myLCD.set_font((unsigned char*) Terminal6x8,32,127,false); //variable width disabled @@ -91,15 +97,15 @@ 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"); - pc.printf(" Display Test \r\n"); - wait(3); + printf(" Display Test \r\n"); + thread_sleep_for(3000); t.reset(); myLCD.cls(); - time=t.read_us(); + time=t.read_us(); // time=t.elapsed_time().count(); myLCD.locate(2,55); myLCD.printf("cls: %.3fms", (float)time/1000); - pc.printf("cls: %.3fms\r\n", (float)time/1000); - wait(3); + printf("cls: %.3fms\r\n", (float)time/1000); + thread_sleep_for(3000); myLCD.cls(); t.reset(); @@ -132,8 +138,8 @@ myLCD.locate(2,55); myLCD.set_font((unsigned char*) Terminal6x8); myLCD.printf("plot: %.3fms", (float)time/1000); - pc.printf("plot: %.3fms\r\n", (float)time/1000); - wait(3); + printf("plot: %.3fms\r\n", (float)time/1000); + thread_sleep_for(3000); myLCD.cls(); t.reset(); Bitmap_s pic = { @@ -146,8 +152,8 @@ time=t.read_us(); myLCD.locate(2,55); myLCD.printf("bmp: %.3fms", (float)time/1000); - pc.printf("bmp: %.3fms\r\n", (float)time/1000); - wait(3); + printf("bmp: %.3fms\r\n", (float)time/1000); + thread_sleep_for(3000); myLCD.cls(); myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false); //only numbers, variable-width disabled t.reset(); @@ -157,8 +163,8 @@ myLCD.locate(2,55); myLCD.set_font((unsigned char*) Terminal6x8); myLCD.printf("Big Font: %.3fms", (float)time/1000); - pc.printf("Big Font: %.3fms\r\n", (float)time/1000); - wait(3); + printf("Big Font: %.3fms\r\n", (float)time/1000); + thread_sleep_for(3000); // sparse pixels test myLCD.cls(); myLCD.FastWindow(true); @@ -180,8 +186,8 @@ time2=t.read_us(); myLCD.locate(2,55); 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); + printf("std: %.3fms fastw: %.3fms\r\n", (float)time2/1000, (float)time/1000); + thread_sleep_for(3000); // scroll test, only for TFT myLCD.cls(); myLCD.set_font((unsigned char*) Arial24x23); @@ -190,32 +196,32 @@ myLCD.rect(0,0,myLCD.width()-1,myLCD.height()-1,White); myLCD.rect(1,1,myLCD.width()-2,myLCD.height()-2,Blue); myLCD.setscrollarea(0,myLCD.sizeY()); - wait(1); + thread_sleep_for(1000); myLCD.scroll(1); //up 1 - wait(1); + thread_sleep_for(1000); myLCD.scroll(0); //center - wait(1); + thread_sleep_for(1000); myLCD.scroll(myLCD.sizeY()-1); //down 1 - wait(1); + thread_sleep_for(1000); myLCD.scroll(myLCD.sizeY()); // same as 0, center - wait(1); + thread_sleep_for(1000); myLCD.scroll(myLCD.sizeY()>>1); // half screen - wait(1); + thread_sleep_for(1000); myLCD.scrollreset(); // center - wait(1); + thread_sleep_for(1000); for(unsigned short i=1; i<=myLCD.sizeY(); i++) { myLCD.scroll(i); - wait_ms(2); + thread_sleep_for(2); } - wait(2); + thread_sleep_for(2000); // color inversion for(unsigned short i=0; i<=8; i++) { myLCD.invert(i&1); - wait_ms(200); + thread_sleep_for(200); } - wait(2); + thread_sleep_for(2000); // bmp 16bit test myLCD.cls(); t.reset(); @@ -227,7 +233,7 @@ myLCD.locate(2,55); myLCD.set_font((unsigned char*) Terminal6x8); myLCD.printf("Bmp speed: %.3fms", (float)time/1000); - pc.printf("Bmp speed: %.3fms\r\n", (float)time/1000); - wait(2); + printf("Bmp speed: %.3fms\r\n", (float)time/1000); + thread_sleep_for(2000); } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Jan 25 18:00:21 2022 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#b1796dedeb8accde1cbaecf136fab96895e23d81
--- a/mbed.bld Mon Mar 23 16:02:02 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_app.json Tue Jan 25 18:00:21 2022 +0000 @@ -0,0 +1,12 @@ +{ + "requires": ["bare-metal"], + "target_overrides": { + "*": { + "target.c_lib": "small", + "target.printf_lib": "minimal-printf", + "platform.minimal-printf-enable-64-bit": false, + "platform.minimal-printf-enable-floating-point": true, + "platform.minimal-printf-set-floating-point-max-decimals": 3 + } + } +} \ No newline at end of file
--- a/pavement_48x34.h Mon Mar 23 16:02:02 2015 +0000 +++ b/pavement_48x34.h Tue Jan 25 18:00:21 2022 +0000 @@ -1,5 +1,5 @@ -__align(2) -const unsigned char pavement_48x34[] = { /* 0X40,0X10,0X30,0X00,0X22,0X00,0X01,0X1B, */ +//__align(2) +const unsigned char pavement_48x34[] __attribute__((aligned (2))) = { /* 0X40,0X10,0X30,0X00,0X22,0X00,0X01,0X1B, */ 0X0F,0XB4,0XCD,0XB3,0XAD,0XAB,0X6D,0XA3,0XCB,0X82,0X6D,0X9B,0X6D,0X9B,0X4C,0X9B, 0X0B,0X8B,0X48,0X62,0X4C,0X93,0XAD,0XA3,0XAE,0XA3,0X6C,0X9B,0X4C,0X93,0X0B,0X7B, 0X8D,0X9B,0X4C,0X93,0XEB,0X82,0XEB,0X7A,0X8A,0X6A,0X6A,0X6A,0XCB,0X72,0XEB,0X7A,
--- a/pict.h Mon Mar 23 16:02:02 2015 +0000 +++ b/pict.h Tue Jan 25 18:00:21 2022 +0000 @@ -1,5 +1,5 @@ -__align(2) -char burp[] = { /* 0X00,0X01,0X40,0X00,0X40,0X00, */ +//__align(2) +char burp[] __attribute__((aligned (2))) = { /* 0X00,0X01,0X40,0X00,0X40,0X00, */ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X10,0X00,0X00, 0X00,0X00,0X00,0X1F,0X10,0XF0,0X00,0X00,0X00,0X00,0X40,0X0F,0XC9,0XE0,0X00,0X00, 0X00,0X00,0X3C,0X1F,0XFF,0XC0,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XF8,0X00,0X00,