Fix corner case in the HID report descriptor Mouse/Joystick tempates at the 8/16...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Mar 2011 09:25:13 +0000 (09:25 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 23 Mar 2011 09:25:13 +0000 (09:25 +0000)
LUFA/CodeTemplates/makefile_template
LUFA/Drivers/USB/Class/Common/HID.h

index adf5e54..d893b4d 100644 (file)
@@ -88,7 +88,7 @@ F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ###
 \r
 \r
 # Input clock frequency.\r
 \r
 \r
 # Input clock frequency.\r
-#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     This will define a symbol, F_USB, in all source code files equal to the \r
 #     input clock frequency (before any prescaling is performed) in Hz. This value may\r
 #     differ from F_CPU if prescaling is used on the latter, and is required as the\r
 #     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
 #     input clock frequency (before any prescaling is performed) in Hz. This value may\r
 #     differ from F_CPU if prescaling is used on the latter, and is required as the\r
 #     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
@@ -98,7 +98,7 @@ F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ###
 #\r
 #     If no clock division is performed on the input clock inside the AVR (via the\r
 #     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
 #\r
 #     If no clock division is performed on the input clock inside the AVR (via the\r
 #     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
-F_CLOCK = ### INSERT RAW INPUT CLOCK SPEED HERE, IN HZ ###\r
+F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ###\r
 \r
 \r
 # Output format. (can be srec, ihex, binary)\r
 \r
 \r
 # Output format. (can be srec, ihex, binary)\r
index 968b265..f02e709 100644 (file)
                                        HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
                                        HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
                                        HID_RI_REPORT_COUNT(8, 0x02),           \
                                        HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
                                        HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
                                        HID_RI_REPORT_COUNT(8, 0x02),           \
-                                       HID_RI_REPORT_SIZE(8, (((((uint16_t)MinAxisVal > 0xFF) && ((uint16_t)MaxAxisVal < 0xFF)) ? 8 : 16))), \
+                                       HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \
                                        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
                                HID_RI_END_COLLECTION(0),                   \
                                HID_RI_USAGE_PAGE(8, 0x09),                 \
                                        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
                                HID_RI_END_COLLECTION(0),                   \
                                HID_RI_USAGE_PAGE(8, 0x09),                 \
                                        HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
                                        HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
                                        HID_RI_REPORT_COUNT(8, 0x02),           \
                                        HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
                                        HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
                                        HID_RI_REPORT_COUNT(8, 0x02),           \
-                                       HID_RI_REPORT_SIZE(8, (((((uint16_t)MinAxisVal > 0xFF) && ((uint16_t)MaxAxisVal < 0xFF)) ? 8 : 16))), \
+                                       HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \
                                        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE)), \
                                HID_RI_END_COLLECTION(0),                   \
                        HID_RI_END_COLLECTION(0)
                                        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE)), \
                                HID_RI_END_COLLECTION(0),                   \
                        HID_RI_END_COLLECTION(0)