TFT 1.44

Dependencies:   mbed

Fork of DL144128_LCD by Jun Morita

Revision:
1:b64c81071d96
Parent:
0:c0be4e018a09
diff -r c0be4e018a09 -r b64c81071d96 main.cpp
--- a/main.cpp	Sat Jun 14 02:27:06 2014 +0000
+++ b/main.cpp	Sat Feb 28 20:26:45 2015 +0000
@@ -24,120 +24,33 @@
 #include "mbed.h"
 #include "ili9163lcd.h"
 
-DigitalOut LED(LED1);
+ILI9163 TFT(D2,D3,D4,D5,D6);
 
 int main()
 {
-    uint8_t tm=10;
-    uint8_t R=0,G=0,B=0;
-    uint8_t RGB_state=0;
+
+    TFT.lcdInitialise(LCD_ORIENTATION2);
     
-    lcdInitialise(LCD_ORIENTATION3);
+    TFT.lcdClearDisplay(Black);
     
-    lcdClearDisplay(decodeRgbValue(0, 0, 0));
-    
-    lcdLine(0, 0, 127, 127, decodeRgbValue(31, 31, 31));
-    lcdLine(0, 127, 127, 0, decodeRgbValue(31, 31, 31));
-    lcdCircle(64, 64, 32, decodeRgbValue(31, 0, 0));
-    lcdCircle(64, 64, 40, decodeRgbValue(0, 31, 0));
-    lcdCircle(64, 64, 48, decodeRgbValue(0, 0, 31));
+    TFT.lcdLine(0, 0, 127, 127, White);
+    TFT.lcdLine(0, 127, 127, 0, White);
+    TFT.lcdCircle(64, 64, 32, Red);
+    TFT.lcdCircle(64, 64, 40, Blue);
+    TFT.lcdCircle(64, 64, 48, Green);
     
-    lcdPutS("Hello World!", lcdTextX(4), lcdTextY(0), decodeRgbValue(0, 0, 0), decodeRgbValue(31, 31, 31));
-    
-    lcdPutS("The quick brown fox jumped over the lazy dog 0123456789", lcdTextX(0), lcdTextY(2), decodeRgbValue(0, 31, 31), decodeRgbValue(0, 0, 0));
-    
-    lcdFilledRectangle(0, 64, 127, 127, decodeRgbValue(0, 0, 0));
-    lcdRectangle(0, 64, 127, 127, decodeRgbValue(31, 31, 31));
+    TFT.lcdFilledRectangle(62, 62, 65, 65, Green);
     
-    // Run the LCD test
-    uint8_t ballX = 64, ballY = 96;
-    int8_t ballSpeed = 1;
-    int8_t xDir = ballSpeed, yDir = ballSpeed;
+    TFT.set_font((unsigned char*)font11x16); 
+    TFT.lcdPutS("Hallo", TFT.lcdTextX(2), TFT.lcdTextY(0),Black, White);
+    //TFT.lcdPutS("Hello World!", TFT.lcdTextX(4), TFT.lcdTextY(0), Blue, Cyan);  // Vordergund, Hintergrund
     
-    // Bouncy ball demo
+    TFT.set_font((unsigned char*)font5x8);
+    TFT.lcdPutS("The quick brown fox jumped over the lazy dog 0123456789", TFT.lcdTextX(0), TFT.lcdTextY(4), Black, Magenta);
+    
+    
     while(1)
     {
-        // Delete the ball
-        lcdFilledRectangle(ballX-2, ballY-1, ballX+2, ballY+1, decodeRgbValue(0, 0, 0));
-        
-        // Delete the bat
-        lcdFilledRectangle(ballX-4, 121, ballX+4, 123, decodeRgbValue(0, 0, 0));
-        
-        // Move the ball
-        ballX += xDir;
-        ballY += yDir;
-        
-        // Range check
-        if (ballX > 120) xDir = -ballSpeed;
-        if (ballX < 7) xDir = ballSpeed;
-        
-        if (ballY > 120) yDir = -ballSpeed;
-        if (ballY < 70) yDir = ballSpeed;
-        
-        // Plot the ball
-        lcdFilledRectangle(ballX-2, ballY-1, ballX+2, ballY+1, decodeRgbValue(31, 31, 31));
-        
-        // Plot the bat
-        lcdFilledRectangle(ballX-4, 121, ballX+4, 123, decodeRgbValue(31, 0, 31));
-        
-//        lcdPutS("Hello World!", lcdTextX(4), lcdTextY(0), decodeRgbValue(0, 0, 0), decodeRgbValue(31, 31, 31));
-        lcdPutS("Hello World!", lcdTextX(4), lcdTextY(0), decodeRgbValue(0, 0, 0), decodeRgbValue(R, G, B));
-        switch (RGB_state){
-            case 0:
-                if(++R >= 31)RGB_state++;
-                break;
-            case 1:
-                if(--R == 0)RGB_state++;
-                break;
-            case 2:
-                if(++G >= 31)RGB_state++;
-                break;
-            case 3:
-                if(--G == 0)RGB_state++;
-                break;
-            case 4:
-                if(++B >= 31)RGB_state++;
-                break;
-            case 5:
-                if(--B == 0)RGB_state++;
-                break;
-            case 6:
-                if(++R >= 31)RGB_state++;
-                B = R;
-                break;
-            case 7:
-                if(-- R== 0)RGB_state++;
-                B = R;
-                break;
-            case 8:
-                if(++R >= 31)RGB_state++;
-                G = R;
-                break;
-            case 9:
-                if(-- R== 0)RGB_state++;
-                G = R;
-                break;
-            case 10:
-                if(++G >= 31)RGB_state++;
-                B = G;
-                break;
-            case 11:
-                if(-- G== 0)RGB_state++;
-                B = G;
-                break;
-            case 12:
-                if(++R >= 31)RGB_state++;
-                B = G = R;
-                break;
-            case 13:
-                if(--R == 0)RGB_state = 0;
-                B = G = R;
-                break;
-        }
-        wait_ms(10);
-        if(--tm==0){
-            tm=10;
-            LED = LED ^ 1;
-        }
+
     }
 }