aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-08-09 12:04:52 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-08-09 12:04:52 +0000
commiteb060db71b629d72107e67a5057bf70f7d53307d (patch)
treeba8722f487a1da31044cdf06caab6def812f6530 /Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
parent508e905d8d39c3968927aa2c1a45350f49452df1 (diff)
downloadlufa-eb060db71b629d72107e67a5057bf70f7d53307d.tar.gz
lufa-eb060db71b629d72107e67a5057bf70f7d53307d.tar.bz2
lufa-eb060db71b629d72107e67a5057bf70f7d53307d.zip
Tighten up the code in the delta movement detection code in the MouseHostWithParser and JoystickHostWithParser demos. Make the ClassDriver JoystickHostWithParser demo use the HID_ALIGN_DATA() macro instead of manual shifting and casting.
Diffstat (limited to 'Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c')
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
index 111bed48e..7482b01b0 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
@@ -159,14 +159,11 @@ int main(void)
{
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
- if (ReportItem->Attributes.Usage.Usage == USAGE_X)
+ if (DeltaMovement)
{
- if (DeltaMovement)
+ if (ReportItem->Attributes.Usage.Usage == USAGE_X)
LEDMask |= ((DeltaMovement > 0) ? LEDS_LED1 : LEDS_LED2);
- }
- else
- {
- if (DeltaMovement)
+ else
LEDMask |= ((DeltaMovement > 0) ? LEDS_LED3 : LEDS_LED4);
}
}