USB composite device example program, drag-and-drop flash writer.

Dependencies:   SWD USBDevice mbed BaseDAP

tests/test_USBMSD_Drop.cpp

Committer:
va009039
Date:
2013-09-28
Revision:
1:ea8e179320d7

File content as of revision 1:ea8e179320d7:

// 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