USBLocalFileSystem.lib testing program for LPC11U35
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
Diff: main.cpp
- Revision:
- 0:eba731be11fb
- Child:
- 1:484bd6db1378
diff -r 000000000000 -r eba731be11fb main.cpp --- /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