ISP example program.

Dependencies:   SLCD mbed USBLocalFileSystem

/media/uploads/va009039/lpc81isp-360x240.jpg

FRDM-KL46ZLPC810
UART RXDPTE23p2(P0_4)
UART TXDPTE22p8(P0_0)
nRESETD6p1(P0_5)
nISPD8p5(P0_1)
GNDGNDp7
3.3VP3V3p6

Copy binary image to the disk called LPC81ISP.
Push sw1 or sw3, start write to LPC810 flash.

Revision:
0:ad2b1fc04955
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Storage.cpp	Sat Feb 15 10:15:42 2014 +0000
@@ -0,0 +1,50 @@
+#include "Storage.h"
+#include "FATFileSystem.h"
+#include "mbed_debug.h"
+#include "mystring.h"
+#include <ctype.h>
+
+#if (DEBUG2 > 3)
+#define STORAGE_DBG(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0);
+#else
+#define STORAGE_DBG(...)
+#endif
+
+#define LOCAL_DIR "local"
+
+LocalStorage::LocalStorage(StorageInterface* storage)
+        : FATFileSystem(LOCAL_DIR),_storage(storage)
+{
+}
+
+extern FILINFO FATDirHandle_finfo; // fst/FATDirHandle.cpp
+/* static */ bool LocalStorage::find_bin(mystring& filename)
+{
+    DIR *dir = ::opendir("/"LOCAL_DIR);
+    if (dir == NULL) {
+        return false;
+    }
+    uint32_t fdatetime = 0;
+    bool found = false;
+    struct dirent *entry;
+    while ((entry = readdir(dir)) != NULL) {
+        mystring name(entry->d_name);
+        int len = name.size();
+        if (name[len-4] == '.' && 
+            toupper(name[len-3]) == 'B' &&
+            toupper(name[len-2]) == 'I' &&
+            toupper(name[len-1]) == 'N') {
+            FILINFO* fi = &FATDirHandle_finfo;
+            uint32_t datetime =  fi->ftime | (fi->fdate<<16);
+            STORAGE_DBG("datetime=%08x [%s]", datetime, entry->d_name);
+            if (datetime > fdatetime) {
+                fdatetime = datetime;
+                filename = "/"LOCAL_DIR"/";
+                filename += entry->d_name;
+                found = true;
+            }
+        }
+    }
+    closedir(dir);
+    return found;
+}