X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/6bda628718f67c04ed43e8328f55bdce5319c504..b3c6599bb7ab8518c3a457579c538c6520e85b01:/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index 1b9c12aa9..38e4b2564 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -299,19 +299,15 @@ void ProcessMouseReport(uint8_t* MouseReport) 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) + /* Check to see if a (non-zero) delta movement has been indicated */ + if (DeltaMovement) { - /* Turn on the appropriate LED according to direction if the delta is non-zero */ - if (DeltaMovement) + /* Determine if the report is for the X or Y delta movement, light LEDs as appropriate */ + if (ReportItem->Attributes.Usage.Usage == USAGE_X) LEDMask |= ((DeltaMovement > 0) ? LEDS_LED1 : LEDS_LED2); - } - else - { - /* Turn on the appropriate LED according to direction if the delta is non-zero */ - if (DeltaMovement) + else LEDMask |= ((DeltaMovement > 0) ? LEDS_LED3 : LEDS_LED4); } }