USB device stack

Fork of USBDevice by mbed official

Revision:
15:fadcd049598d
Parent:
11:eeb3cbbaa996
--- a/USBDevice/USBDevice.cpp	Thu Sep 12 14:45:27 2013 +0100
+++ b/USBDevice/USBDevice.cpp	Mon Mar 31 20:41:48 2014 +0000
@@ -711,6 +711,22 @@
     while (!configured());
 }
 
+bool USBDevice::connect(int timeout)
+{
+    /* Connect device */
+    USBHAL::connect();
+    /* Block if not configured */
+    while (!configured() && timeout>0)
+    {
+        wait_ms(100);
+        timeout -= 100;
+    }
+    if(!configured())
+        return false;
+    else
+        return true;
+}
+
 void USBDevice::disconnect(void)
 {
     /* Disconnect device */