From 2919aeeaaba0d1d54e03f9132269c5277d414543 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 4 Dec 2009 01:06:26 +0000 Subject: Fixed HID Parser not distributing the Usage Min and Usage Max values across an array of report items. Added new HID_ALIGN_DATA() macro to return the pre-retrieved value of a HID report item, left-aligned to a given datatype. Added new PreviousValue to the HID Report Parser report item structure, for easy monitoring of previous report item values. --- Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c | 2 +- Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Demos') diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c index eee9343d3..04f4d2476 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c @@ -282,7 +282,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport) if (!(FoundData)) continue; - int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); + int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t); /* Determine if the report is for the X or Y delta movement */ if (ReportItem->Attributes.Usage.Usage == USAGE_X) diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index d84e2d3ce..c29d4debd 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -280,7 +280,7 @@ void ProcessMouseReport(uint8_t* MouseReport) if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem))) continue; - int16_t WheelDelta = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); + int16_t WheelDelta = HID_ALIGN_DATA(ReportItem, int16_t); if (WheelDelta) LEDMask = (LEDS_LED1 | LEDS_LED2 | ((WheelDelta > 0) ? LEDS_LED3 : LEDS_LED4)); -- cgit v1.2.3