KL25Z TFT ILI9341

Dependencies:   SDFileSystem SPI_TFT_ILI9341 TFT_fonts mbed

Fork of TFT_banggood by Peter Drescher

Issue with reading a 16-bit BMP file from SD card. Has anyone successfully loaded an image from the SD card of the LCD display with FRDM-25Z?

/media/uploads/kenno/img_20140317_224436.jpg

If anyone can help pointing out what I did wrong, it'll be very appreciated. Thanks.

Files at this revision

API Documentation at this revision

Comitter:
kenno
Date:
Tue Mar 11 12:29:54 2014 +0000
Parent:
0:7c3b9bfd6ead
Commit message:
Initial commit. SD card not working.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7c3b9bfd6ead -r 2b61fee5799f main.cpp
--- a/main.cpp	Sun Jan 26 20:55:50 2014 +0000
+++ b/main.cpp	Tue Mar 11 12:29:54 2014 +0000
@@ -14,22 +14,25 @@
 #include "SDFileSystem.h"
  
 // the SD-connector is connected to SPI pin 11-13 
-SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
+//SDFileSystem sd(p11, p12, p13, p14, "sd"); // mosi,miso,sck,cs
+SDFileSystem sd(PTD2, PTD3, PTD1, PTA4, "sd"); // mosi,miso,sck,cs
 
-LocalFileSystem local("local");
+// FRDM-KL25Z doesn't have external flash
+//LocalFileSystem local("local");               // Create the local filesystem under the name "local"
 
-extern unsigned char p1[];  // the mbed logo graphic
+//extern unsigned char p1[];  // the mbed logo graphic
 
 // the display has a backlight switch on board 
-DigitalOut LCD_LED(p21);       
+//DigitalOut LCD_LED(p21);       
 
 // the TFT is connected to SPI pin 5-7
-SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc
+//SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc
+SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTD5, PTD0, PTD7,"TFT"); // mosi, miso, sclk, cs, reset, dc
 
 int main()
 {
     int i;
-    LCD_LED = 1;            // backlite on
+    //LCD_LED = 1;            // backlite on
    
     TFT.claim(stdout);        // send stdout to the TFT display
     TFT.set_orientation(1);
@@ -108,8 +111,8 @@
 
     TFT.background(Black);
     TFT.cls();
-    TFT.locate(10,10);
-    TFT.printf("Graphic from Flash");
+    //TFT.locate(10,10);
+    //TFT.printf("Graphic from Flash");
     
     // mbed logo
     // defined in graphics.c
@@ -117,22 +120,22 @@
     //unsigned char p1[18920] = {
     //0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ....
     // 
-    TFT.Bitmap(90,90,172,55,p1);
+    //TFT.Bitmap(90,90,172,55,p1);
 
-    wait(5);
-    TFT.cls();
+    //wait(5);
+    //TFT.cls();
     
     // to compare the speed of the internal file system and a SD-card
-    TFT.locate(10,10);
+/*    TFT.locate(10,10);
     TFT.printf("Graphic from internal File System");
     TFT.locate(10,20);
     TFT.printf("open test.bmp");
     int err = TFT.BMP_16(1,50,"/local/test.bmp");
     if (err != 1) TFT.printf(" - Err: %d",err);
-    
+*/    
     TFT.locate(10,110);
     TFT.printf("Graphic from external SD-card");
     TFT.locate(10,120);
-    err = TFT.BMP_16(1,140,"/sd/test.bmp");
-    if (err != 1) TFT.printf(" - Err: %d",err);
+    int err = TFT.BMP_16(0,0,"/sd/teppy.bmp");    //1, 140
+    if (err != 1) TFT.printf(" - Err: %d",err);    
 }