Simple USBHost library for STM32F746NG Discovery board. Only either the Fastspeed or the Highspeed port can be used( not both together)
Dependents: DISCO-F746NG_USB_Host
Fork of KL46Z-USBHost by
Diff: USBHost/USBHost.cpp
- Revision:
- 24:5396b6a93262
- Parent:
- 18:61554f238584
- Child:
- 25:7d6d9fc471bf
--- a/USBHost/USBHost.cpp Sun May 01 03:18:11 2016 +0000 +++ b/USBHost/USBHost.cpp Mon Jun 13 17:21:07 2016 +0000 @@ -23,9 +23,13 @@ USBHost* USBHost::inst = NULL; -USBHost* USBHost::getHostInst() { +USBHost* USBHost::getHostInst(int IF_Number) { if (inst == NULL) { - inst = new USBHost(); + inst = new USBHost(IF_Number); + inst->init(); + } + if(inst->IF_N!=IF_Number) { + inst = new USBHost(IF_Number); inst->init(); } return inst; @@ -38,7 +42,8 @@ } } -USBHost::USBHost() { +USBHost::USBHost(int InterfaceNumber):USBHALHost(InterfaceNumber) { + } /* virtual */ bool USBHost::addDevice(USBDeviceConnected* parent, int port, bool lowSpeed) { @@ -148,6 +153,7 @@ bool parsing_intf = false; uint8_t current_intf = 0; EndpointDescriptor* ep_desc; + int epsetup; while (index < len) { len_desc = conf_descr[index]; @@ -179,6 +185,7 @@ ep->init(type, dir, ep_desc->wMaxPacketSize, ep_desc->bEndpointAddress); USB_DBG("ADD USBEndpoint %p, on interf %d on device %p", ep, current_intf, dev); dev->addEndpoint(current_intf, ep); + epsetup=epint_setup(ep); } } break;