Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
Revision 9:e279dee6e41c, committed 2016-03-09
- Comitter:
- k4zuki
- Date:
- Wed Mar 09 04:15:46 2016 +0000
- Parent:
- 8:6b8e38e24938
- Child:
- 10:4553fd77a832
- Commit message:
- remove unused comments
Changed in this revision
--- a/W25X40BV.lib Sat Mar 05 01:50:01 2016 +0000 +++ b/W25X40BV.lib Wed Mar 09 04:15:46 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/k4zuki/code/W25X40BV/#4f7e8756d1c4 +https://developer.mbed.org/users/k4zuki/code/W25X40BV/#11e271d4fbc5
--- a/main.cpp Sat Mar 05 01:50:01 2016 +0000
+++ b/main.cpp Wed Mar 09 04:15:46 2016 +0000
@@ -119,14 +119,10 @@
// usb_local->lock(true);
-// uint8_t recieve;
-// uint8_t read=0;
int read = 0;
int loadersize = sizeof(loader)/sizeof(loader[0]);
int targetsize = 0;
FILE* fp;
-// BLE.baud(57600);
-// int crc=0x00;
// myDAP* dap = new myDAP(&swd);
@@ -134,33 +130,27 @@
BL.mode(PullUp);
BL.fall(&BL_int);
-/*
- fp = fopen(LOADER_FILE, "rb");
- loadersize = file_size(fp);
- fclose(fp);
-#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
-#warning "free(fp)"
- free(fp);
-#endif
-*/
-/*
- fp = fopen(TARGET_FILE, "rb");
- targetsize = file_size(fp);
- fclose(fp);
-#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
-#warning "free(fp)"
- free(fp);
-#endif
-*/
-
bool _hidresult;
usb_local.lock(false);
+// usb_local->lock(false);
while(1) {
running.write(1);
wait_ms(1000);
running.write(0);
wait_ms(1000);
}
+ /*
+ usb_local->puts("loadersize: ");
+ read= 0x0f& (loadersize>>12);
+ usb_local->putc(hex[read]);
+ read= 0x0f& (loadersize>>8);
+ usb_local->putc(hex[read]);
+ read= 0x0f& (loadersize>>4);
+ usb_local->putc(hex[read]);
+ read= 0x0f& (loadersize);
+ usb_local->putc(hex[read]);
+ usb_local->puts("\n\r");
+ */
/*
while(1) {
usb_local->lock(true);
@@ -187,34 +177,6 @@
}
}
*/
- /*
- usb_local->puts("loadersize: ");
- read= 0x0f& (loadersize>>12);
- usb_local->putc(hex[read]);
- read= 0x0f& (loadersize>>8);
- usb_local->putc(hex[read]);
- read= 0x0f& (loadersize>>4);
- usb_local->putc(hex[read]);
- read= 0x0f& (loadersize);
- usb_local->putc(hex[read]);
- usb_local->puts("\n\r");
- */
- /*
- if (usb_local->find(filename, sizeof(filename), "*.TXT")) {
- 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
- #warning "free(fp)"
- free(fp);
- #endif
- }
- }
- */
// USBStorage2* _usb = usb_local->getUsb();
/*
--- a/mbed.bld Sat Mar 05 01:50:01 2016 +0000 +++ b/mbed.bld Wed Mar 09 04:15:46 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/f141b2784e32 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb \ No newline at end of file
--- a/mystorage.cpp Sat Mar 05 01:50:01 2016 +0000
+++ b/mystorage.cpp Wed Mar 09 04:15:46 2016 +0000
@@ -14,7 +14,7 @@
// receive the data
// _read(buffer, 512);
// _flash.readStream(uint32_t addr, uint8_t* buf, uint32_t count);
- _flash.readStream(256 * (block_number * 2), buffer, 512);
+ _flash.readStream(256 * ((block_number) * 2), buffer, 512);
return 0;
}
@@ -26,22 +26,22 @@
// _write(buffer, 512);
// writeStream(uint32_t addr, uint8_t* buf, uint32_t count);
// void pageErase(uint8_t page);
- _flash.pageErase(block_number * 2);
- _flash.pageErase(block_number * 2 + 1);
- _flash.writeStream(256 * (block_number * 2), (uint8_t*)buffer, 256);
- _flash.writeStream(256 * (block_number * 2 + 1), (uint8_t*)(buffer + 256), 256);
+ _flash.pageErase((block_number) * 2);
+ _flash.pageErase((block_number) * 2 + 1);
+ _flash.writeStream(512 * (block_number), (uint8_t*)buffer, 256);
+ _flash.writeStream(512 * (block_number) + 256, (uint8_t*)(buffer + 256), 256);
return 0;
}
// virtual uint32_t storage_sectors();
uint32_t MyStorage::storage_sectors() {
report_sectors_count++;
- return (128); //256*512
+ return (256); //256*512
}
// virtual uint32_t storage_size();
uint32_t MyStorage::storage_size()
{
report_size_count++;
- return (128*512); //256*512
+ return (256*512); //256*512
}
--- a/mystorage.h Sat Mar 05 01:50:01 2016 +0000
+++ b/mystorage.h Wed Mar 09 04:15:46 2016 +0000
@@ -12,9 +12,21 @@
public:
MyStorage(PinName mosi, PinName miso, PinName sclk, PinName cs);
+ /** read 512bytes from memory;
+ @param data
+ @param block numbered from 0
+ */
virtual int storage_read(uint8_t* data, uint32_t block);
+ /** write 512bytes to memory;
+ @param data
+ @param block numbered from 0
+ */
virtual int storage_write(const uint8_t* data, uint32_t block);
+ /** returns number of 512byte sectors in storage;
+ */
virtual uint32_t storage_sectors();
+ /** returns size of storage in bytes;
+ */
virtual uint32_t storage_size();
private: