Adaptation of the official mbed USBHost repository to work with the LPC4088 Display Module
Dependents: DMSupport DMSupport DMSupport DMSupport
Fork of DM_USBHost by
Revision 30:ffec1f271b7c, committed 2015-01-20
- Comitter:
- embeddedartists
- Date:
- Tue Jan 20 09:09:10 2015 +0100
- Parent:
- 29:dc8179214fd7
- Child:
- 31:9a462d032742
- Commit message:
- Added notification upon connect/disconnect so that the user knows when it is
time to scan for disconnected devices and/or attempt to connect to new devices.
Changed in this revision
USBHost/USBHost.cpp | Show annotated file Show diff for this revision Revisions of this file |
USBHost/USBHost.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHost/USBHost.cpp Mon Dec 08 12:46:05 2014 +0000 +++ b/USBHost/USBHost.cpp Tue Jan 20 09:09:10 2015 +0100 @@ -186,6 +186,10 @@ } } while(0); + + if (listener != 0) { + osSignalSet(listener, listenerSignal); + } break; @@ -211,6 +215,10 @@ } while(0); + if (listener != 0) { + osSignalSet(listener, listenerSignal); + } + break; // a td has been processed @@ -283,6 +291,9 @@ hub_in_use[i] = false; } #endif + + listener = NULL; + listenerSignal = 0; } USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)
--- a/USBHost/USBHost.h Mon Dec 08 12:46:05 2014 +0000 +++ b/USBHost/USBHost.h Tue Jan 20 09:09:10 2015 +0100 @@ -186,6 +186,8 @@ dev->onDisconnect(intf, fn); } } + + void signalOnConnections(osThreadId threadId, uint32_t signal) { listener = threadId; listenerSignal = signal; } /** * Instantiate to protect USB thread from accessing shared objects (USBConnectedDevices and Interfaces) @@ -283,6 +285,9 @@ Mail<message_t, 10> mail_usb_event; Mutex usb_mutex; Mutex td_mutex; + + osThreadId listener; + uint32_t listenerSignal; // buffer for conf descriptor #define SAFE_USB_HOST_DATA_BUFF_SIZE (415)