X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/242303c1607fca405d9407b9fab6fb78cae676e2..cf610c5c91c3eee02dec7ca848acc8da831ad98a:/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c index c33b2ebde..6218f4cfb 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c @@ -58,7 +58,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface = /** Main program entry point. This routine configures the hardware required by the application, then - * starts the scheduler to run the application tasks. + * enters a loop to run the application tasks in sequence. */ int main(void) { @@ -104,9 +104,9 @@ int main(void) break; } - if (USB_HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0) + if (HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0) { - printf("Could not Set Report Protocol Mode.\r\n"); + printf("Error Setting Report Protocol Mode or Not a Valid Mouse.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -114,13 +114,13 @@ int main(void) LEDs_SetAllLEDs(LEDS_NO_LEDS); - printf("HID Device Enumerated.\r\n"); + printf("Mouse Enumerated.\r\n"); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) { - uint8_t MouseReport[Keyboard_HID_Interface.State.LargestReportSize]; + uint8_t MouseReport[Mouse_HID_Interface.State.LargestReportSize]; HID_Host_ReceiveReport(&Mouse_HID_Interface, &MouseReport); uint8_t LEDMask = LEDS_NO_LEDS; @@ -250,21 +250,16 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8 * we aren't interested in (preventing us from being able to extract them later on, but saving on the RAM they would * have occupied). * - * \param CurrentItemAttributes Pointer to the attrbutes of the item the HID report parser is currently working with + * \param[in] CurrentItemAttributes Pointer to the attrbutes of the item the HID report parser is currently working with * * \return Boolean true if the item should be stored into the HID report structure, false if it should be discarded */ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_Attributes_t* CurrentItemAttributes) { - /* Check the attributes of the current item - see if we are interested in it or not */ - if ((CurrentItemAttributes->Usage.Page == USAGE_PAGE_BUTTON) || - (CurrentItemAttributes->Usage.Page == USAGE_PAGE_GENERIC_DCTRL)) - { - /* Only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report structure to save RAM */ - return true; - } - else - { - return false; - } + /* Check the attributes of the current item - see if we are interested in it or not; + * only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report + * structure to save RAM and ignore the rest + */ + return ((CurrentItemAttributes->Usage.Page == USAGE_PAGE_BUTTON) || + (CurrentItemAttributes->Usage.Page == USAGE_PAGE_GENERIC_DCTRL)); }