test for the SPI_TFT Lib
Dependencies: SPI_TFT TFT_fonts mbed
Fork of TFT by
Revision 4:bc093468602e, committed 2012-09-27
- Comitter:
- dreschpe
- Date:
- Thu Sep 27 20:52:45 2012 +0000
- Branch:
- cleanup
- Parent:
- 3:0d07cf37bc00
- Commit message:
- typo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0d07cf37bc00 -r bc093468602e main.cpp --- a/main.cpp Thu Sep 27 20:34:26 2012 +0000 +++ b/main.cpp Thu Sep 27 20:52:45 2012 +0000 @@ -1,5 +1,5 @@ // example to test the TFT Display -// Thanks to the GraphicsDisplay and TextDisplay classes +// Thanks to the GraphicsDisplay and TextDisplay classes #include "stdio.h" #include "mbed.h" @@ -16,8 +16,9 @@ SPI_TFT TFT(p11, p12, p13, p14, p15,"TFT"); // mosi, miso, sclk, cs, reset -int main() { - +int main() +{ + int i; unsigned int y; TFT.claim(stdout); // send stdout to the TFT display @@ -26,17 +27,17 @@ TFT.background(Black); // set background to black TFT.foreground(White); // set chars to white TFT.cls(); // clear the screen - + y= 0; //first show the 4 directions TFT.set_orientation(0); TFT.background(Black); TFT.cls(); - + TFT.set_font((unsigned char*) Arial12x12); TFT.locate(0,0); printf(" Hello Mbed 0"); - + TFT.set_orientation(1); TFT.locate(0,0); printf(" Hello Mbed 1"); @@ -63,20 +64,20 @@ TFT.line(0,0,100,0,Green); TFT.line(0,0,0,200,Green); TFT.line(0,0,100,200,Green); - + TFT.rect(100,50,150,100,Red); TFT.fillrect(180,25,220,70,Blue); - + TFT.circle(80,150,33,White); TFT.fillcircle(160,190,20,Yellow); - - double s; - - for (i=0;i<320;i++){ + + double s; + + for (i=0; i<320; i++) { s =20 * sin((long double) i / 10 ); TFT.pixel(i,100 + (int)s ,Red); - } - + } + wait(5); // wait two seconds @@ -103,14 +104,14 @@ TFT.set_orientation(1); TFT.background(Black); TFT.cls(); - + TFT.locate(10,10); TFT.printf("Graphic from Flash"); - + TFT.Bitmap(90,90,172,55,p1); - + wait(5); - graphix: +graphix: TFT.set_orientation(1); TFT.cls(); TFT.locate(10,10); @@ -118,6 +119,6 @@ TFT.locate(10,20); TFT.printf("open test2.bmp"); int err = TFT.BMP_16(20,50,"test2.bmp"); - if (err != 1) TFT.printf(" - Err: %d",err); + if (err != 1) TFT.printf(" - Err: %d",err); }