Merge pull request #5800 from abougouffa/feature_unsupported_usbhost

Some enhancements for the USBHost feature and small bug fix
pull/5898/head
Cruz Monrreal 2018-01-22 10:26:07 -06:00 committed by GitHub
commit 5af1d8fca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -106,7 +106,7 @@ public:
template<typename T>
inline void onDisconnect(uint8_t intf_nb, T* tptr, void (T::*mptr)(void)) {
if ((mptr != NULL) && (tptr != NULL)) {
intf[intf_nb].detach.attach(tptr, mptr);
intf[intf_nb].detach = callback(tptr, mptr);
}
}
@ -118,7 +118,7 @@ public:
*/
inline void onDisconnect(uint8_t intf_nb, void (*fn)(void)) {
if (fn != NULL) {
intf[intf_nb].detach.attach(fn);
intf[intf_nb].detach = fn;
}
}

View File

@ -89,7 +89,7 @@ public:
template<typename T>
inline void attach(T* tptr, void (T::*mptr)(void)) {
if((mptr != NULL) && (tptr != NULL)) {
rx.attach(tptr, mptr);
rx = callback(tptr, mptr);
}
}
@ -100,7 +100,7 @@ public:
*/
inline void attach(void (*fptr)(void)) {
if(fptr != NULL) {
rx.attach(fptr);
rx = fptr;
}
}

View File

@ -88,11 +88,14 @@ void USBHost::usb_process()
/* check that hub is connected to root port */
if (usb_msg->hub_parent) {
/* a hub device must be present */
#if MAX_HUB_NB
for (k = 0; k < MAX_HUB_NB; k++) {
if ((&hubs[k] == usb_msg->hub_parent) && (hub_in_use[k])) {
hub_unplugged=false;
}
}
#endif
} else {
hub_unplugged = false;
}
@ -312,7 +315,7 @@ USBHost::USBHost() : usbThread(osPriorityNormal, USB_THREAD_STACK)
}
#endif
usbThread.start(this, &USBHost::usb_process);
usbThread.start(callback(this, &USBHost::usb_process));
}
USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)