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:
- 5:77c115650c1f
- Parent:
- 3:6af8771e7f71
- Child:
- 6:cb6984367a7a
--- a/main.cpp Wed Aug 19 15:53:30 2015 +0000 +++ b/main.cpp Sat Sep 19 10:48:38 2015 +0000 @@ -22,15 +22,29 @@ #define LOADER_FILE "/local/loader.bin" #define TARGET_FILE "/local/target.bin" +#if defined(TARGET_LPC1768) +//SWD swd(p25,p24,p23); // SWDIO,SWCLK,nRESET +SWD swd(p24, p23, p22); // SWDIO,SWCLK,nRESET +DigitalOut connected(LED1); +DigitalOut running(LED4); + +SWSPI spi(p5, p7, p6); // mosi, miso, sclk + +ATD45DB161D memory(spi, p8); +RawSerial ble(p5, p6); +DA14580 BLE(ble, p26); + +#elif defined(TARGET_LPC11U35_501) //SWD swd(p25,p24,p23); // SWDIO,SWCLK,nRESET SWD swd(P0_5,P0_4,P0_21); // SWDIO,SWCLK,nRESET DigitalOut connected(P0_20); DigitalOut running(P0_2); -SPI spi(P0_9,P0_8,P0_10); // mosi, miso, sclk +SWSPI spi(P0_9,P0_8,P0_10); // mosi, miso, sclk ATD45DB161D memory(spi, P0_7); RawSerial ble(P0_19,P0_18); DA14580 BLE(ble, P0_1); +#endif int file_size( FILE *fp ); void flash_write (int addr, char *buf, int len); @@ -57,7 +71,8 @@ int main() { - USBLocalFileSystem* usb_local = new USBLocalFileSystem(P0_9, P0_8, P0_10, P0_7,"local"); // RamDisk(64KB) +// USBLocalFileSystem* usb_local = new USBLocalFileSystem(P0_9, P0_8, P0_10, P0_7,"local"); // RamDisk(64KB) + USBLocalFileSystem* usb_local = new USBLocalFileSystem(p17, p15, p16, p18,"local"); // SD // USBLocalFileSystem* usb_local = new USBLocalFileSystem(P0_14, P0_15, P0_16, P0_32,"local"); // SD usb_local->lock(true); myDAP* dap = new myDAP(&swd); @@ -76,15 +91,11 @@ usb_local->remount(); char filename[32]; + usb_local->puts("Try BLE.load(): "); result = BLE.load(); usb_local->putc(result); - /* - fp = fopen( SOURCE_FILE, "rb" ) - if (fp) { - filesize=file_size(fp); - pc.printf("0x%04X\n\r",filesize); - } - */ + usb_local->puts("\n\r"); + if (usb_local->find(filename, sizeof(filename), "*.TXT")) { fp = fopen(filename, "r"); if (fp) { @@ -100,7 +111,6 @@ } } - USBStorage2* _usb = usb_local->getUsb(); USB_HID* _hid = _usb->getHID(); HID_REPORT recv_report;