mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5800 from abougouffa/feature_unsupported_usbhost
Some enhancements for the USBHost feature and small bug fixpull/5898/head
commit
5af1d8fca6
|
|
@ -106,7 +106,7 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void onDisconnect(uint8_t intf_nb, T* tptr, void (T::*mptr)(void)) {
|
inline void onDisconnect(uint8_t intf_nb, T* tptr, void (T::*mptr)(void)) {
|
||||||
if ((mptr != NULL) && (tptr != NULL)) {
|
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)) {
|
inline void onDisconnect(uint8_t intf_nb, void (*fn)(void)) {
|
||||||
if (fn != NULL) {
|
if (fn != NULL) {
|
||||||
intf[intf_nb].detach.attach(fn);
|
intf[intf_nb].detach = fn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void attach(T* tptr, void (T::*mptr)(void)) {
|
inline void attach(T* tptr, void (T::*mptr)(void)) {
|
||||||
if((mptr != NULL) && (tptr != NULL)) {
|
if((mptr != NULL) && (tptr != NULL)) {
|
||||||
rx.attach(tptr, mptr);
|
rx = callback(tptr, mptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ public:
|
||||||
*/
|
*/
|
||||||
inline void attach(void (*fptr)(void)) {
|
inline void attach(void (*fptr)(void)) {
|
||||||
if(fptr != NULL) {
|
if(fptr != NULL) {
|
||||||
rx.attach(fptr);
|
rx = fptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,14 @@ void USBHost::usb_process()
|
||||||
/* check that hub is connected to root port */
|
/* check that hub is connected to root port */
|
||||||
if (usb_msg->hub_parent) {
|
if (usb_msg->hub_parent) {
|
||||||
/* a hub device must be present */
|
/* a hub device must be present */
|
||||||
|
#if MAX_HUB_NB
|
||||||
|
|
||||||
for (k = 0; k < MAX_HUB_NB; k++) {
|
for (k = 0; k < MAX_HUB_NB; k++) {
|
||||||
if ((&hubs[k] == usb_msg->hub_parent) && (hub_in_use[k])) {
|
if ((&hubs[k] == usb_msg->hub_parent) && (hub_in_use[k])) {
|
||||||
hub_unplugged=false;
|
hub_unplugged=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
hub_unplugged = false;
|
hub_unplugged = false;
|
||||||
}
|
}
|
||||||
|
|
@ -312,7 +315,7 @@ USBHost::USBHost() : usbThread(osPriorityNormal, USB_THREAD_STACK)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
usbThread.start(this, &USBHost::usb_process);
|
usbThread.start(callback(this, &USBHost::usb_process));
|
||||||
}
|
}
|
||||||
|
|
||||||
USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)
|
USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue