USB CDC (serial) and USB MSC (strage) Composite Device. http://mbed.org/users/okini3939/notebook/USB_Device/
Dependencies: ChaNFSSD mbed ChaNFS
Diff: USBCDCMSC/USBCDCMSC.cpp
- Revision:
- 2:5db90410bb90
- Parent:
- 1:bb08a84162b7
diff -r bb08a84162b7 -r 5db90410bb90 USBCDCMSC/USBCDCMSC.cpp --- a/USBCDCMSC/USBCDCMSC.cpp Fri Dec 23 15:39:13 2011 +0000 +++ b/USBCDCMSC/USBCDCMSC.cpp Fri Dec 23 16:37:58 2011 +0000 @@ -27,6 +27,7 @@ #define CDC_SET_LINE_CODING 0x20 #define CDC_GET_LINE_CODING 0x21 #define CDC_SET_CONTROL_LINE_STATE 0x22 +#define CDC_SEND_BREAK 0x23 #define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK @@ -77,9 +78,11 @@ USBCDCMSC::USBCDCMSC(SDFileSystem *sd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release), cdcbuf(128), _sd(sd) { + cdcbreak = 0; _status = NO_INIT; connect(); - USBDevice::connect(); +// USBDevice::connect(); + USBHAL::connect(); } bool USBCDCMSC::USBCallback_request(void) { @@ -106,6 +109,10 @@ case CDC_SET_CONTROL_LINE_STATE: success = true; break; + case CDC_SEND_BREAK: + cdcbreak = 1; + success = true; + break; case MSC_REQUEST_RESET: reset(); success = true; @@ -411,7 +418,7 @@ } //connect the device - USBDevice::connect(); +// USBDevice::connect(); return true; } @@ -838,6 +845,12 @@ return true; } +int USBCDCMSC::isBreak () { + int ret = cdcbreak; + cdcbreak = 0; + return ret; +} + int USBCDCMSC::disk_initialize() { if (_sd->disk_initialize()) { _status |= NO_DISK;