diff options
Diffstat (limited to 'Demos/Host/ClassDriver')
-rw-r--r-- | Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c | 11 | ||||
-rw-r--r-- | Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c | 9 |
2 files changed, 7 insertions, 13 deletions
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c index f1b4cac7b..8420d05ab 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c @@ -148,16 +148,13 @@ int main(void) (ReportItem->Attributes.Usage.Usage == USAGE_Y)) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); + 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); } } 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); } } |