X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f1199200e167a737a4676378da184387e543830c..cf610c5c91c3eee02dec7ca848acc8da831ad98a:/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c diff --git a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c index 4d895908e..4d13ce519 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c @@ -69,3 +69,22 @@ uint8_t GetHIDReportData(void) return ParseSuccessful; } + +/** Callback for the HID Report Parser. This function is called each time the HID report parser is about to store + * an IN, OUT or FEATURE item into the HIDReportInfo structure. To save on RAM, we are able to filter out items + * 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[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; + * 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)); +}