![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
USB composite device example program, drag-and-drop flash writer.
Dependencies: SWD USBDevice mbed BaseDAP
Diff: tests/test_BuildRomDisk.cpp
- Revision:
- 1:ea8e179320d7
- Parent:
- 0:2385683c867a
--- a/tests/test_BuildRomDisk.cpp Tue Sep 17 04:33:44 2013 +0000 +++ b/tests/test_BuildRomDisk.cpp Sat Sep 28 03:21:14 2013 +0000 @@ -1,13 +1,37 @@ +// test_BuildRomDisk.cpp 2013/9/22 #if 0 #include "mbed.h" -#include "BuildRomDisk.h" - +#include "USBMSD2.h" +#include "RamDisk.h" #include "mytest.h" #include "mydebug.h" Serial pc(USBTX, USBRX); DigitalIn exit_btn(p14); // application board +class BuildRomDisk : public USBMSD2 { +public: + BuildRomDisk() { + _sectors = 128; // 64KB(512*128) + _status = 0x01; + connect(); + } + virtual int disk_initialize() { + _status = 0x00; + return 0; + } + virtual int disk_status() { return _status; } + virtual int disk_read(uint8_t * data, uint64_t block) { return _ramdisk.read(data, block); } + virtual int disk_write(const uint8_t * data, uint64_t block) { return _ramdisk.write(data, block); } + virtual uint64_t disk_sectors() { return _sectors; } + virtual uint64_t disk_size() { return _sectors * 512; } + void exportData(Stream* pc) { _ramdisk.exportData(pc); } +protected: + RamDisk _ramdisk; + uint64_t _sectors; + uint8_t _status; +}; + TEST(BuildRomDisk1,test1) { BuildRomDisk* target = new BuildRomDisk(); while(!exit_btn);