Emulation of LocalFileSystem with virtual COM.

Dependencies:   USBDevice

Dependents:   KL46Z-lpc81isp lpcterm2

#include "USBLocalFileSystem.h"

int main() {
    USBLocalFileSystem* usb_local = new USBLocalFileSystem(); // RamDisk(64KB)

    while(1) {
        usb_local->lock(true);
        usb_local->remount();
        char filename[32];
        if (usb_local->find(filename, sizeof(filename), "*.TXT")) {
            FILE* fp = fopen(filename, "r");
            if (fp) {
                int c;
                while((c = fgetc(fp)) != EOF) {
                    usb_local->putc(c);
                }
                fclose(fp);
            }
        }    
        usb_local->lock(false);

        wait_ms(1000*5);
    }
}



Sample application:

Import programKL46Z-lpc81isp

ISP example program.

Import programlpcterm2

semihost server example program

Revision:
4:8f6857784854
Parent:
2:97c314eae8b8
--- a/src/Storage.h	Tue May 06 16:05:57 2014 +0900
+++ b/src/Storage.h	Thu May 08 23:43:46 2014 +0900
@@ -18,7 +18,8 @@
     virtual uint64_t disk_sectors() {
         return _storage->storage_sectors();
     }
-    static bool find_bin(mystring& filename);
+    static bool find(char* buf, size_t size, const char* dirname, const char* pat);
+
 private:
     StorageInterface* _storage;
     const char* _name;