
Using touch screen features of LCD screen.
Dependencies: DmTouch_UniGraphic UniGraphic mbed
Fork of DisplayModule24_demo by
Revision 0:2ccd65a72ab8, committed 2015-02-14
- Comitter:
- Geremia
- Date:
- Sat Feb 14 19:56:13 2015 +0000
- Child:
- 1:083257298075
- Commit message:
- UniGraphic demo for lcd and tft, par and spi
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UniGraphic.lib Sat Feb 14 19:56:13 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/GraphicsDisplay/code/UniGraphic/#48f3282c2be8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 14 19:56:13 2015 +0000 @@ -0,0 +1,131 @@ +#include "stdio.h" +#include "mbed.h" +#include "string" +#include "Arial12x12.h" +#include "Arial24x23.h" +//#include "Terminal6x8.h" +#include "Arial43x48_numb.h" +#include "pict.h" + +#include "IST3020.h" +//#include "UC1608.h" +//#include "ILI9341.h" + +Serial pc(USBTX, USBRX); + +IST3020 LCD(PAR_8, PortC, PC_8, PC_9, PA_0, PA_1, PA_4,"LCD"); // Parallel8bit, Port, CS, reset, A0, WR, RD for F302 +//UC1608 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD"); // Spi16bit, 10MHz, mosi, miso, sclk, cs, reset, dc +//ILI9341 LCD(SPI_16, 10000000, D11, D12, D13, D10, D9, D8,"LCD"); // Spi16bit, 10MHz, mosi, miso, sclk, cs, reset, dc + +Timer t; + +unsigned short backgroundcolor=Black; +unsigned short foregroundcolor=White; + +char orient=1; +int main() +{ +// LCD.set_contrast(26);//for uc1608 + // LCD.set_contrast(46);//for ist3020 + LCD.set_orientation(orient); + int time; + pc.baud (115200); + pc.printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000); + t.start(); + + // LCD.claim(stdout); // send stdout to the LCD display + //LCD.claim(stderr); // send stderr to the LCD display + LCD.background(backgroundcolor); // set background to black + LCD.foreground(foregroundcolor); // set chars to white + LCD.cls(); // clear the screen + + // mem write/read test + /* LCD.locate(0,0); + unsigned short readback; + unsigned short colorstep = (0x10000/LCD.width()) + for(unsigned short i=0; i<LCD.width(); i++) LCD.pixel(i,0,i*colorstep); // write line + for(unsigned short i=0; i<LCD.width(); i++) // verify line + { + readback = LCD.pixelread(i,0); + if(readback!=i*colorstep) pc.printf("pix %.4X readback %.4X\r\n", i*colorstep, readback); + } +*/ + + + while(1) + { + LCD.set_orientation((orient++)%4); +// LCD.set_orientation(2); + LCD.cls(); + LCD.set_font((unsigned char*) Terminal6x8); + LCD.locate(0,0); + LCD.printf("Display Test\r\nSome text just to see if auto carriage return works correctly"); + pc.printf(" Display Test \r\n"); + wait(3); + t.reset(); + LCD.cls(); + time=t.read_us(); + LCD.locate(2,55); + LCD.printf("cls: %.3fms", (float)time/1000); + pc.printf("cls: %.3fms\r\n", (float)time/1000); + wait(3); + LCD.cls(); + t.reset(); + // draw some graphics + //LCD.cls(); + LCD.set_font((unsigned char*) Arial24x23); + LCD.locate(10,10); + LCD.printf("Test"); + + LCD.line(0,0,LCD.width()-1,0,foregroundcolor); + LCD.line(0,0,0,LCD.height()-1,foregroundcolor); + LCD.line(0,0,LCD.width()-1,LCD.height()-1,foregroundcolor); + + LCD.rect(10,30,50,40,foregroundcolor); + LCD.fillrect(60,30,100,40,foregroundcolor); + + LCD.circle(150,32,30,foregroundcolor); + LCD.fillcircle(140,20,10,foregroundcolor); + + double s; + + for (unsigned short i=0; i<LCD.width(); i++) + { + s =10 * sin((long double) i / 10 ); + LCD.pixel(i,40 + (int)s ,foregroundcolor); + } + + + time=t.read_us(); + LCD.locate(2,55); + LCD.set_font((unsigned char*) Terminal6x8); + LCD.printf("plot: %.3fms", (float)time/1000); + pc.printf("plot: %.3fms\r\n", (float)time/1000); + wait(3); + LCD.cls(); + t.reset(); + Bitmap_s pic = { + 64, // XSize + 64, // YSize + 8, // Bytes in Line + burp, // Pointer to picture data + }; + LCD.Bitmap_BW(pic,LCD.width()-64,0); + time=t.read_us(); + LCD.locate(2,55); + LCD.printf("bmp: %.3fms", (float)time/1000); + pc.printf("bmp: %.3fms\r\n", (float)time/1000); + wait(3); + LCD.cls(); + LCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false); //only numbers, variable-width disabled + t.reset(); + LCD.locate(0,0); + LCD.printf("%d", 12345); + time=t.read_us(); + LCD.locate(2,55); + LCD.set_font((unsigned char*) Terminal6x8); + LCD.printf("Big Font speed: %.3fms", (float)time/1000); + pc.printf("Big Font speed: %.3fms\r\n", (float)time/1000); + wait(3); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 14 19:56:13 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pict.h Sat Feb 14 19:56:13 2015 +0000 @@ -0,0 +1,35 @@ +__align(2) +char burp[] = { /* 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, +0X00,0X00,0XFF,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X00, +0X00,0X00,0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XF8,0X00,0X00, +0X00,0X01,0XFF,0XFF,0XFF,0XBC,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0X07,0X00,0X00, +0X00,0X0F,0XFF,0XFF,0XF1,0X80,0X30,0X00,0X00,0X0F,0XFF,0XFF,0XC0,0X67,0XF0,0X00, +0X00,0X0F,0XFF,0XFF,0X80,0X38,0X08,0X00,0X00,0X0F,0XFF,0XFC,0X00,0X10,0X00,0X00, +0X00,0X1F,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X1F,0XFD,0XE8,0X00,0X00,0X00,0X00, +0X00,0X3F,0XDD,0XC8,0X00,0X00,0X00,0X00,0X00,0X7F,0XEF,0X88,0X18,0X00,0X18,0X00, +0X01,0X7F,0X3F,0X08,0X18,0X00,0X18,0X00,0X07,0X7C,0X35,0X08,0X00,0X00,0X00,0X00, +0X26,0X7E,0X00,0X0C,0X00,0X18,0X00,0X00,0X84,0X5E,0X00,0X04,0X00,0X3F,0XFE,0X00, +0X84,0X1B,0XC0,0X02,0X00,0X40,0X01,0X00,0X84,0X00,0X00,0X01,0X80,0X80,0X01,0X00, +0X84,0X00,0X00,0X00,0X7E,0X00,0X01,0X00,0X8E,0X00,0X00,0X23,0XFC,0X00,0X01,0X00, +0X8E,0X00,0X00,0X98,0XE0,0X0C,0X02,0X00,0X8A,0X00,0X01,0X04,0X06,0X0F,0XFE,0X00, +0X8A,0X00,0X02,0X02,0X08,0X80,0X21,0X86,0X8B,0X00,0X02,0X81,0X30,0X40,0X60,0X7E, +0X89,0X00,0X07,0XC4,0XC0,0X21,0XB8,0X0C,0X89,0X00,0X0F,0XFE,0X20,0X1E,0X06,0X38, +0X89,0X80,0X1F,0XFF,0XFC,0X00,0X00,0XC0,0X88,0X80,0X3F,0XFF,0XF8,0X00,0X00,0X00, +0X88,0XC0,0X1F,0XFF,0XE8,0X00,0X00,0X00,0X88,0X40,0X0F,0XFF,0XE8,0X00,0X00,0X00, +0X88,0X60,0X07,0XFF,0XFC,0X00,0X00,0X00,0X88,0X20,0X07,0XFF,0XFE,0X00,0X00,0X00, +0X88,0X30,0X07,0XFF,0XFC,0X80,0X00,0X00,0X88,0X18,0X03,0XFF,0XFC,0X00,0X00,0X00, +0XC4,0X08,0X03,0XE3,0XFE,0X10,0X00,0X00,0XC4,0X0C,0X00,0XC3,0XF1,0X98,0X00,0X00, +0XC4,0X06,0X00,0X00,0XE0,0XFC,0X00,0X00,0XC4,0XE3,0X00,0X00,0X00,0X18,0X00,0X00, +0XA3,0XFD,0X00,0X00,0X0F,0XF0,0X00,0X00,0XA0,0X07,0X80,0X00,0X3A,0XC1,0X00,0X00, +0XA0,0X03,0XC0,0X00,0XF2,0X00,0X80,0X00,0XA0,0X01,0XC0,0X00,0XF2,0X00,0X80,0X00, +0XA0,0X00,0X60,0X00,0XFE,0X00,0X00,0X00,0XE0,0X00,0X20,0X00,0X4E,0X00,0X40,0X00, +0XE0,0X00,0X30,0X00,0XC4,0X00,0X00,0X00,0XC0,0X00,0X10,0X00,0XC2,0X00,0X20,0X00, +0XC0,0X00,0X18,0X77,0X82,0X00,0X80,0X00,0X80,0X00,0X0D,0XF7,0X81,0X01,0X00,0X00, +0X80,0X00,0X05,0XB7,0X81,0X06,0X00,0X00,0X80,0X00,0X07,0XFF,0X01,0XFA,0X00,0X00, +0X80,0X00,0X02,0XFD,0X00,0XC2,0X00,0X00,0X80,0X00,0X02,0X7F,0X00,0X82,0X00,0X00, +0X80,0X00,0X03,0X7E,0X00,0XC2,0X00,0X00,0X80,0X00,0X01,0XFE,0X00,0X42,0X00,0X00, +0X80,0X00,0X01,0XB4,0X00,0X42,0X00,0X00,0X80,0X00,0X00,0XBC,0X00,0X42,0X00,0X00, +};