test for the SPI_TFT Lib

Dependencies:   SPI_TFT TFT_fonts mbed

Fork of TFT by Peter Drescher

Branch:
cleanup
Revision:
3:0d07cf37bc00
Parent:
1:b295f3228ea2
Child:
4:bc093468602e
--- a/main.cpp	Sat Apr 07 14:28:58 2012 +0000
+++ b/main.cpp	Thu Sep 27 20:34:26 2012 +0000
@@ -1,5 +1,5 @@
 // example to test the TFT Display
-// Thanks to the GraphicsDisplay and TextDisplay classes from
+// Thanks to the GraphicsDisplay and TextDisplay classes 
 
 #include "stdio.h"
 #include "mbed.h"
@@ -11,40 +11,32 @@
 #include "font_big.h"
 
 extern unsigned char p1[];  // the mbed logo
-DigitalOut xx(p6);     // debug !!
-Serial pc(USBTX, USBRX); // tx, rx
-DigitalOut myled(LED1);
 
 // the TFT is connected to SPI pin 11-14
 SPI_TFT TFT(p11, p12, p13, p14, p15,"TFT"); // mosi, miso, sclk, cs, reset
 
-//LocalFileSystem local("local");
 
 int main() {
      
-    //pc.printf("start main  \n\r");
     int i;
+    unsigned int y;
     TFT.claim(stdout);      // send stdout to the TFT display
     //TFT.claim(stderr);      // send stderr to the TFT display
-    TFT.set_orientation(0);
+    TFT.set_orientation(1);
     TFT.background(Black);    // set background to black
     TFT.foreground(White);    // set chars to white
     TFT.cls();                // clear the screen
-
-    // first show the 4 directions
-    // mbed logo
-    //TFT.set_orientation(0);
-    //TFT.background(Black);
-    //TFT.cls();
     
-    //do{} while(1);
+    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");
     
-   // do{} while(1);
-    
     TFT.set_orientation(1);
     TFT.locate(0,0);
     printf("  Hello Mbed 1");
@@ -77,6 +69,14 @@
     
     TFT.circle(80,150,33,White);
     TFT.fillcircle(160,190,20,Yellow);
+    
+     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
 
@@ -110,10 +110,14 @@
     TFT.Bitmap(90,90,172,55,p1);
     
     wait(5);
+    graphix:
+    TFT.set_orientation(1);
     TFT.cls();
     TFT.locate(10,10);
     TFT.printf("Graphic from File System");
-    int err = TFT.BMP_16(20,50,"test.bmp");
+    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);   
 }