Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBDevice_STM32F103 by
Revision 18:78bdbce94509, committed 2014-02-18
- Comitter:
- mbed_official
- Date:
- Tue Feb 18 11:00:19 2014 +0000
- Parent:
- 17:bbd6dac92961
- Child:
- 19:fcb63a105965
- Commit message:
- Synchronized with git revision 3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400
Full URL: https://github.com/mbedmicro/mbed/commit/3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400/
Allow USBDevice::connect() to be non-blocking
Changed in this revision
--- a/USBDevice/USBDevice.cpp Thu Jan 23 17:30:20 2014 +0000
+++ b/USBDevice/USBDevice.cpp Tue Feb 18 11:00:19 2014 +0000
@@ -703,12 +703,15 @@
return (device.state == CONFIGURED);
}
-void USBDevice::connect(void)
+void USBDevice::connect(bool blocking)
{
/* Connect device */
USBHAL::connect();
- /* Block if not configured */
- while (!configured());
+
+ if (blocking) {
+ /* Block if not configured */
+ while (!configured());
+ }
}
void USBDevice::disconnect(void)
--- a/USBDevice/USBDevice.h Thu Jan 23 17:30:20 2014 +0000
+++ b/USBDevice/USBDevice.h Tue Feb 18 11:00:19 2014 +0000
@@ -37,8 +37,10 @@
/*
* Connect a device
+ *
+ * @param blocking: block if not configured
*/
- void connect(void);
+ void connect(bool blocking = true);
/*
* Disconnect a device
--- a/USBMSD/USBMSD.cpp Thu Jan 23 17:30:20 2014 +0000
+++ b/USBMSD/USBMSD.cpp Tue Feb 18 11:00:19 2014 +0000
@@ -103,8 +103,7 @@
}
-bool USBMSD::connect() {
-
+bool USBMSD::connect(bool blocking) {
//disk initialization
if (disk_status() & NO_INIT) {
if (disk_initialize()) {
@@ -131,7 +130,7 @@
}
//connect the device
- USBDevice::connect();
+ USBDevice::connect(blocking);
return true;
}
--- a/USBMSD/USBMSD.h Thu Jan 23 17:30:20 2014 +0000
+++ b/USBMSD/USBMSD.h Tue Feb 18 11:00:19 2014 +0000
@@ -70,9 +70,10 @@
/**
* Connect the USB MSD device. Establish disk initialization before really connect the device.
*
+ * @param blocking if not configured
* @returns true if successful
*/
- bool connect();
+ bool connect(bool blocking = true);
/**
* Disconnect the USB MSD device.
