diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-08-09 12:04:52 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-08-09 12:04:52 +0000 |
commit | eb060db71b629d72107e67a5057bf70f7d53307d (patch) | |
tree | ba8722f487a1da31044cdf06caab6def812f6530 /Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c | |
parent | 508e905d8d39c3968927aa2c1a45350f49452df1 (diff) | |
download | lufa-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/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c')
-rw-r--r-- | Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c index 91bd28829..e92c242d2 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c @@ -285,17 +285,13 @@ void ProcessJoystickReport(uint8_t* JoystickReport) 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); } } |