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 F401RE-USBHost by
Diff: USBHost/USBHALHost.cpp
- Revision:
- 9:7f9f64cf5ded
- Parent:
- 8:6463cd1964c0
- Child:
- 10:40c7f6788902
--- a/USBHost/USBHALHost.cpp Fri Jan 31 13:45:07 2014 +0000
+++ b/USBHost/USBHALHost.cpp Mon Feb 03 13:00:16 2014 +0000
@@ -23,6 +23,8 @@
#define USB_TEST_ASSERT_FALSE(A) while(0)
#endif
+#define USB_INFO(...) do{fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\n");}while(0);
+
#define BD_OWN_MASK (1<<7)
#define BD_DATA01_MASK (1<<6)
#define BD_KEEP_MASK (1<<5)
@@ -138,7 +140,15 @@
bool USBHALHost::wait_attach() {
attach_done = false;
USB0->INTEN = USB_INTEN_ATTACHEN_MASK;
- while(!attach_done);
+ Timer t;
+ t.reset();
+ t.start();
+ while(!attach_done) {
+ if (t.read_ms() > 5*1000) {
+ t.reset();
+ USB_INFO("Please attach USB device.");
+ }
+ }
wait_ms(100);
USB_TEST_ASSERT_FALSE(USB0->CTL & USB_CTL_SE0_MASK);
root_lowSpeed = (USB0->CTL & USB_CTL_JSTATE_MASK) ? false : true;
