Removed variable axis support from the HID_DESCRIPTOR_JOYSTICK() macro due to OS incompatibilities, replaced with fixed 3-axis joystick report structure.

This commit is contained in:
Dean Camera 2012-03-29 19:41:05 +00:00
parent 7cac5e22d7
commit b3aaffb792
7 changed files with 25 additions and 20 deletions

View file

@ -337,37 +337,36 @@
* \code
* struct
* {
* intB_t X; // Signed X axis value
* intB_t Y; // Signed Y axis value
* int8_t Z; // Signed Z axis value
* // Additional axis elements here
* uintA_t Buttons; // Pressed buttons bitmask
* intA_t X; // Signed X axis value
* intA_t Y; // Signed Y axis value
* intA_t Z; // Signed Z axis value
* uintB_t Buttons; // Pressed buttons bitmask
* } Joystick_Report;
* \endcode
*
* Where \c uintA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the
* ranges of the signed \c MinAxisVal and \c MaxAxisVal values.
* Where \c uintA_t is a type large enough to hold the ranges of the signed \c MinAxisVal and \c MaxAxisVal values,
* and \c intB_t is a type large enough to hold one bit per button.
*
* \param[in] NumAxis Number of axis in the joystick (8-bit)
* \param[in] MinAxisVal Minimum logical axis value (16-bit).
* \param[in] MaxAxisVal Maximum logical axis value (16-bit).
* \param[in] MinPhysicalVal Minimum physical axis value, for movement resolution calculations (16-bit).
* \param[in] MaxPhysicalVal Maximum physical axis value, for movement resolution calculations (16-bit).
* \param[in] Buttons Total number of buttons in the device (8-bit).
*/
#define HID_DESCRIPTOR_JOYSTICK(NumAxis, MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \
#define HID_DESCRIPTOR_JOYSTICK(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \
HID_RI_USAGE_PAGE(8, 0x01), \
HID_RI_USAGE(8, 0x04), \
HID_RI_COLLECTION(8, 0x01), \
HID_RI_USAGE(8, 0x01), \
HID_RI_COLLECTION(8, 0x00), \
HID_RI_USAGE_MINIMUM(8, 0x30), \
HID_RI_USAGE_MAXIMUM(8, (0x30 + (NumAxis - 1))), \
HID_RI_USAGE_(8, 0x30), \
HID_RI_USAGE_(8, 0x31), \
HID_RI_USAGE_(8, 0x32), \
HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \
HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \
HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
HID_RI_REPORT_COUNT(8, NumAxis), \
HID_RI_REPORT_COUNT(8, 3), \
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), \