USB composite device example program, drag-and-drop flash writer.
Dependencies: SWD USBDevice mbed BaseDAP
tests/test2_USBMSD_Drop.cpp@1:ea8e179320d7, 2013-09-28 (annotated)
- Committer:
- va009039
- Date:
- Sat Sep 28 03:21:14 2013 +0000
- Revision:
- 1:ea8e179320d7
add USBMSD_Drop class. add CDC(Virtual COM) and HID(for example CMSIS-DAP), but KL25Z not work.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 1:ea8e179320d7 | 1 | // test2_USBMSD_Drop.cpp 2013/9/26 |
va009039 | 1:ea8e179320d7 | 2 | #if 0 |
va009039 | 1:ea8e179320d7 | 3 | #include "mbed.h" |
va009039 | 1:ea8e179320d7 | 4 | #include "USBMSD_Drop.h" |
va009039 | 1:ea8e179320d7 | 5 | |
va009039 | 1:ea8e179320d7 | 6 | Serial pc(USBTX, USBRX); |
va009039 | 1:ea8e179320d7 | 7 | USBMSD_Drop* host; |
va009039 | 1:ea8e179320d7 | 8 | |
va009039 | 1:ea8e179320d7 | 9 | void callback(const uint8_t* data, int len, int offset, int total) |
va009039 | 1:ea8e179320d7 | 10 | { |
va009039 | 1:ea8e179320d7 | 11 | for(int i = 0; i < len && (offset+i) < total; i++) { |
va009039 | 1:ea8e179320d7 | 12 | pc.putc(data[i]); |
va009039 | 1:ea8e179320d7 | 13 | } |
va009039 | 1:ea8e179320d7 | 14 | } |
va009039 | 1:ea8e179320d7 | 15 | |
va009039 | 1:ea8e179320d7 | 16 | int main() |
va009039 | 1:ea8e179320d7 | 17 | { |
va009039 | 1:ea8e179320d7 | 18 | pc.baud(921600); |
va009039 | 1:ea8e179320d7 | 19 | //pc.baud(9600); |
va009039 | 1:ea8e179320d7 | 20 | pc.printf("%s\n", __FILE__); |
va009039 | 1:ea8e179320d7 | 21 | |
va009039 | 1:ea8e179320d7 | 22 | host = new USBMSD_Drop(); |
va009039 | 1:ea8e179320d7 | 23 | host->attach(callback); |
va009039 | 1:ea8e179320d7 | 24 | while(1); // forever |
va009039 | 1:ea8e179320d7 | 25 | } |
va009039 | 1:ea8e179320d7 | 26 | #endif |