//***************************************************************************** // //! This function is used to initialize a mouse interface after a mouse has //! been detected. //! //! \param ulInstance is the instance value for this mouse. //! //! This function should be called after receiving a \b USB_EVENT_CONNECTED //! event in the callback function provided by USBHMouseOpen(), however it //! should only be called outside of the callback function. This will //! initialize the mouse interface and determine how it reports events to the //! USB host controller. The \e ulInstance value is the value that was //! returned when the application called USBHMouseOpen(). This function only //! needs to be called once per connection event but it should be called every //! time a \b USB_EVENT_CONNECTED event occurs. //! //! \return Non-zero values should be assumed to indicate an error condition. // //***************************************************************************** unsigned long USBHMouseInit(unsigned long ulInstance) { tUSBHMouse *pUSBHMouse; // // Recover the pointer to the instance data. // pUSBHMouse = (tUSBHMouse *)ulInstance; // // Set the initial rate to only update on mouse state changes. // USBHHIDSetIdle(pUSBHMouse->ulMouseInstance, 0, 0); // // Read out the Report Descriptor from the mouse and parse it for // the format of the reports coming back from the mouse. // USBHHIDGetReportDescriptor(pUSBHMouse->ulMouseInstance, pUSBHMouse->pucHeap, pUSBHMouse->ulHeapSize); // // Set the mouse to boot protocol. // USBHHIDSetProtocol(pUSBHMouse->ulMouseInstance, 1); return(0); }
//***************************************************************************** // //! This function is used to initialize a mouse interface after a mouse has //! been detected. //! //! \param psMsInstance is the instance value for this mouse. //! //! This function should be called after receiving a \b USB_EVENT_CONNECTED //! event in the callback function provided by USBHMouseOpen(), however it //! should only be called outside of the callback function. This will //! initialize the mouse interface and determine how it reports events to the //! USB host controller. The \e psMsInstance value is the value that was //! returned when the application called USBHMouseOpen(). This function only //! needs to be called once per connection event but it should be called every //! time a \b USB_EVENT_CONNECTED event occurs. //! //! \return Non-zero values should be assumed to indicate an error condition. // //***************************************************************************** uint32_t USBHMouseInit(tUSBHMouse *psMsInstance) { // // Set the initial rate to only update on mouse state changes. // USBHHIDSetIdle(psMsInstance->psHIDInstance, 0, 0); // // Read out the Report Descriptor from the mouse and parse it for // the format of the reports coming back from the mouse. // USBHHIDGetReportDescriptor(psMsInstance->psHIDInstance, psMsInstance->pui8Heap, psMsInstance->ui32HeapSize); // // Set the mouse to boot protocol. // USBHHIDSetProtocol(psMsInstance->psHIDInstance, 1); return(0); }