Shows how to use a display, the onboard SD Card and the onboard SPI Flash. Requires a display module with direct Arduino pinning

Dependencies:   DmTftLibrary SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
displaymodule
Date:
Tue May 20 15:41:11 2014 +0000
Parent:
0:3ecd25651727
Child:
2:a77053c4f5cc
Commit message:
Removed code for displays requiring an adapter to work as that code is moved into the dm_sdcard_with_adapter project.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue May 20 10:30:34 2014 +0000
+++ b/main.cpp	Tue May 20 15:41:11 2014 +0000
@@ -16,9 +16,6 @@
 
 #include "mbed.h"
 
-#include "DmTftHX8353C.h"
-#include "DmTftS6D0164.h"
-#include "DmTftIli9325.h"
 #include "DmTftIli9341.h"
 #include "DmTftSsd2119.h"
 #include "DmTouch.h"
@@ -47,15 +44,9 @@
  * Local variables
  *****************************************************************************/
 
-//DmTftHX8353C tft;  /* DM_TFT18_101 */
-//DmTftS6D0164 tft;  /* DM_TFT22_102 */
-//DmTftIli9325 tft;  /* DM_TFT28_103 and DM_TFT24_104 */
 DmTftIli9341 tft;  /* DM_TFT28_105 */
 //DmTftSsd2119 tft;   /* DM_TFT35_107 */
 
-//DmTouch touch(DmTouch::DM_TFT28_103, false); /* For LPC4088 QuickStart Board */
-//DmTouch touch(DmTouch::DM_TFT28_103);
-//DmTouch touch(DmTouch::DM_TFT24_104);
 DmTouch touch(DmTouch::DM_TFT28_105);
 //DmTouch touch(DmTouch::DM_TFT35_107);
 
@@ -67,6 +58,7 @@
 DigitalInOut csSDCard(DM_PIN_CS_SDCARD, PIN_OUTPUT, PullUp, 1);
 DigitalInOut csFlash(DM_PIN_CS_FLASH, PIN_OUTPUT, PullUp, 1);
 
+
 /******************************************************************************
  * Global variables
  *****************************************************************************/
@@ -133,7 +125,6 @@
  *****************************************************************************/
 
 int main() {
-  //DmTftBase* tft = factory.display();
   DmDrawBmpBase bmp;
   const char* fname = "/sd/logop565.bmp";
 
@@ -150,6 +141,8 @@
       fclose(fp);
     } else {
       log("failed to open file\n");
+      log("Skipping SDCard reading as it is unsupported\n");
+      tft.drawStringCentered(0, 0, tft.width(), tft.height(), "SD Card Unsupported!");
     }
 
     wait_ms(3000);
@@ -157,7 +150,10 @@
     wait_ms(1000);
 
     log("Attempting to decode image from SPI flash...\n");
-    bmp.drawBitmap(tft, 0, 0, spiFlashReader, (uint32_t)&flash);
+    if (!bmp.drawBitmap(tft, 0, 0, spiFlashReader, (uint32_t)&flash)) {
+      log("Skipping SPI Flash reading as it is unsupported\n");
+      tft.drawStringCentered(0, 0, tft.width(), tft.height(), "SPI Flash Unsupported!");
+    }
 
     wait_ms(3000);
     tft.clearScreen(GREEN);