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

Committer:
va009039
Date:
Sat Jun 21 22:39:59 2014 +0000
Revision:
6:528036abfb02
Parent:
0:39eb4d5b97df
add LPC11U68

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:39eb4d5b97df 1 /*-------------------------------------------*/
va009039 0:39eb4d5b97df 2 /* Integer type definitions for FatFs module */
va009039 0:39eb4d5b97df 3 /*-------------------------------------------*/
va009039 0:39eb4d5b97df 4
va009039 0:39eb4d5b97df 5 #ifndef _INTEGER
va009039 0:39eb4d5b97df 6 #define _INTEGER
va009039 0:39eb4d5b97df 7
va009039 0:39eb4d5b97df 8 #ifdef _WIN32 /* FatFs development platform */
va009039 0:39eb4d5b97df 9
va009039 0:39eb4d5b97df 10 #include <windows.h>
va009039 0:39eb4d5b97df 11 #include <tchar.h>
va009039 0:39eb4d5b97df 12
va009039 0:39eb4d5b97df 13 #else /* Embedded platform */
va009039 0:39eb4d5b97df 14
va009039 0:39eb4d5b97df 15 /* These types must be 16-bit, 32-bit or larger integer */
va009039 0:39eb4d5b97df 16 typedef int INT;
va009039 0:39eb4d5b97df 17 typedef unsigned int UINT;
va009039 0:39eb4d5b97df 18
va009039 0:39eb4d5b97df 19 /* These types must be 8-bit integer */
va009039 0:39eb4d5b97df 20 typedef char CHAR;
va009039 0:39eb4d5b97df 21 typedef unsigned char UCHAR;
va009039 0:39eb4d5b97df 22 typedef unsigned char BYTE;
va009039 0:39eb4d5b97df 23
va009039 0:39eb4d5b97df 24 /* These types must be 16-bit integer */
va009039 0:39eb4d5b97df 25 typedef short SHORT;
va009039 0:39eb4d5b97df 26 typedef unsigned short USHORT;
va009039 0:39eb4d5b97df 27 typedef unsigned short WORD;
va009039 0:39eb4d5b97df 28 typedef unsigned short WCHAR;
va009039 0:39eb4d5b97df 29
va009039 0:39eb4d5b97df 30 /* These types must be 32-bit integer */
va009039 0:39eb4d5b97df 31 typedef long LONG;
va009039 0:39eb4d5b97df 32 typedef unsigned long ULONG;
va009039 0:39eb4d5b97df 33 typedef unsigned long DWORD;
va009039 0:39eb4d5b97df 34
va009039 0:39eb4d5b97df 35 #endif
va009039 0:39eb4d5b97df 36
va009039 0:39eb4d5b97df 37 #endif