Kazuki Yamamoto / Mbed 2 deprecated 11u35_usbLocalFilesystem Featured

Dependencies:   BaseDAP SWD USBDAP USBLocalFileSystem mbed DA14580 SWSPI W25X40BV

USB memory + Writer for DA14580 BLE chip + CMSIS-DAP debugger + USB-UART functions in one chip

One button input loads your application into DA14580 or DA14580 included BLE modules

Quote:

Current compatible hardware description can be found at https://github.com/K4zuki/da14580/releases/tag/MurataBLEr04

Files at this revision

API Documentation at this revision

Comitter:
k4zuki
Date:
Mon Aug 17 19:20:25 2015 +0000
Child:
1:484bd6db1378
Commit message:
initial forked version

Changed in this revision

BaseDAP.lib Show annotated file Show diff for this revision Revisions of this file
SWD.lib Show annotated file Show diff for this revision Revisions of this file
USBDAP.lib Show annotated file Show diff for this revision Revisions of this file
USBLocalFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BaseDAP.lib	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/va009039/code/BaseDAP/#76588be01e71
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SWD.lib	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/va009039/code/SWD/#794d2801ff94
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDAP.lib	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/va009039/code/USBDAP/#7dee016756ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBLocalFileSystem.lib	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/k4zuki/code/USBLocalFileSystem/#9c95f21a578d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "USBLocalFileSystem.h"
+#include "USBDAP.h"
+#include "BaseDAP.h"
+#include "USB_HID.h"
+
+SWD swd(p25,p24,p23); // SWDIO,SWCLK,nRESET
+DigitalOut connected(LED1);
+DigitalOut running(LED2);
+
+class myDAP : public BaseDAP
+{
+public:
+    myDAP(SWD* swd):BaseDAP(swd) {};
+    virtual void infoLED(int select, int value) {
+        switch(select) {
+            case 0:
+                connected = value^1;
+                running = 1;
+                break;
+            case 1:
+                running = value^1;
+                connected = 1;
+                break;
+        }
+    }
+};
+
+int main()
+{
+    USBLocalFileSystem* usb_local = new USBLocalFileSystem(P0_9, P0_8, P0_10, P0_7,"local"); // RamDisk(64KB)
+    myDAP* dap = new myDAP(&swd);
+
+//    USBStorage2* _usb = usb_local->getUsb();
+//    USB_HID* _hid = _usb->getHID();
+
+    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);
+#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
+                free(fp);
+#endif
+            }
+        }
+
+        HID_REPORT recv_report;
+        if( usb_local->getUsb()->getHID()->readNB(&recv_report) ) {
+            HID_REPORT send_report;
+            dap->Command(recv_report.data, send_report.data);
+            send_report.length = 64;
+            usb_local->getUsb()->getHID()->send(&send_report);
+        }
+
+        usb_local->lock(false);
+        wait_ms(100*5);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Aug 17 19:20:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b9ad9a133dc7
\ No newline at end of file