USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Thu Feb 20 11:15:58 2014 +0000
Parent:
18:78bdbce94509
Child:
20:d38b72fed893
Commit message:
Synchronized with git revision 87193889326571b560379153239787775654be59

Full URL: https://github.com/mbedmicro/mbed/commit/87193889326571b560379153239787775654be59/

libraries/USBSerial: Allow the USB connection to be non-blocking

Changed in this revision

USBSerial/USBCDC.cpp Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBCDC.h Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBSerial.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBSerial/USBCDC.cpp	Tue Feb 18 11:00:19 2014 +0000
+++ b/USBSerial/USBCDC.cpp	Thu Feb 20 11:15:58 2014 +0000
@@ -29,9 +29,9 @@
 
 #define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK
 
-USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) {
+USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking): USBDevice(vendor_id, product_id, product_release) {
     terminal_connected = false;
-    USBDevice::connect();
+    USBDevice::connect(connect_blocking);
 }
 
 bool USBCDC::USBCallback_request(void) {
--- a/USBSerial/USBCDC.h	Tue Feb 18 11:00:19 2014 +0000
+++ b/USBSerial/USBCDC.h	Thu Feb 20 11:15:58 2014 +0000
@@ -35,8 +35,9 @@
     * @param vendor_id Your vendor_id
     * @param product_id Your product_id
     * @param product_release Your preoduct_release
+    * @param connect_blocking define if the connection must be blocked if USB not plugged in
     */
-    USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
+    USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking);
 
 protected:
     
--- a/USBSerial/USBSerial.h	Tue Feb 18 11:00:19 2014 +0000
+++ b/USBSerial/USBSerial.h	Thu Feb 20 11:15:58 2014 +0000
@@ -53,9 +53,10 @@
     * @param vendor_id Your vendor_id (default: 0x1f00)
     * @param product_id Your product_id (default: 0x2012)
     * @param product_release Your preoduct_release (default: 0x0001)
+    * @param connect_blocking define if the connection must be blocked if USB not plugged in
     *
     */
-    USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001): USBCDC(vendor_id, product_id, product_release), buf(128){
+    USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001, bool connect_blocking = true): USBCDC(vendor_id, product_id, product_release, connect_blocking), buf(128){
         settingsChangedCallback = 0;
     };