USB composite device example program, drag-and-drop flash writer.
Dependencies: SWD USBDevice mbed BaseDAP
Diff: tests/test_USBMSD_Drop.cpp
- Revision:
- 1:ea8e179320d7
diff -r 2385683c867a -r ea8e179320d7 tests/test_USBMSD_Drop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_USBMSD_Drop.cpp Sat Sep 28 03:21:14 2013 +0000 @@ -0,0 +1,44 @@ +// test_USBMSD_Drop.cpp 2013/9/26 +#if 0 +#include "mbed.h" +#include "USBMSD_Drop.h" +#include "mytest.h" +#include "mydebug.h" + +Serial pc(USBTX, USBRX); + +class myUSBMSD_Drop : public USBMSD_Drop { +public: + virtual void Drop(const uint8_t* data, int len, int offset, int total) { + TEST_PRINT("offset=%d, total=%d", offset, total); + } +}; + +TEST(USBMSD_Drop,test1) { + myUSBMSD_Drop* intf = new myUSBMSD_Drop(); + Timer t; + t.reset(); + t.start(); + int n = 0; + while(1) { // forever + if (intf->readable()) { + int c = intf->getc(); + debug("%02x[%c]\n", c, c > ' ' ? c : '.'); + } + if (t.read_ms() > 1000*1) { + t.reset(); + intf->putc('A'+ n%26); + n++; + } + } +} + +int main() { + pc.baud(921600); + //pc.baud(9600); + DBG("%s", __FILE__); + + RUN_ALL_TESTS(); + exit(0); +} +#endif