Adaptation of the official mbed USBHost repository to work with the LPC4088 Display Module

Dependents:   DMSupport DMSupport DMSupport DMSupport

Fork of DM_USBHost by EmbeddedArtists AB

Revision:
29:dc8179214fd7
Parent:
27:aa2fd412f1d3
Child:
32:f2d129436056
diff -r a55c5a98d5e9 -r dc8179214fd7 USBHostMSD/USBHostMSD.cpp
--- a/USBHostMSD/USBHostMSD.cpp	Wed Dec 03 13:32:37 2014 +0000
+++ b/USBHostMSD/USBHostMSD.cpp	Mon Dec 08 12:46:05 2014 +0000
@@ -15,6 +15,7 @@
  */
 
 #include "USBHostMSD.h"
+#include "diskio.h"
 
 #if USBHOST_MSD
 
@@ -322,7 +323,18 @@
 int USBHostMSD::disk_initialize() {
     USB_DBG("FILESYSTEM: init");
     U16 i, timeout = 10;
+    
+    if (!connected()) {
+        // not connected
+        disk_init = 0;
+        return STA_NODISK | STA_NOINIT;
+    }
 
+    if (disk_init) {
+        // already initialized
+        return 0;
+    }
+    
     getMaxLun();
 
     for (i = 0; i < timeout; i++) {