/*
LUFA Library
- Copyright (C) Dean Camera, 2012.
+ Copyright (C) Dean Camera, 2018.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
- The author disclaim all warranties with regard to this
+ The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
/** \ingroup Group_USBClassHID
* \defgroup Group_USBClassHIDCommon Common Class Definitions
*
- * \section Sec_ModDescription Module Description
+ * \section Sec_USBClassHIDCommon_ModDescription Module Description
* Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
* HID Class.
*
/** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */
#define HID_KEYBOARD_LED_SCROLLLOCK (1 << 2)
- /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
- #define HID_KEYBOARD_LED_KATANA (1 << 3)
+ /** Constant for a keyboard output report LED byte, indicating that the host's COMPOSE mode is currently set. */
+ #define HID_KEYBOARD_LED_COMPOSE (1 << 3)
+
+ /** Constant for a keyboard output report LED byte, indicating that the host's KANA mode is currently set. */
+ #define HID_KEYBOARD_LED_KANA (1 << 4)
//@}
/** \name Keyboard Standard Report Key Scan-codes */
//@{
+ #define HID_KEYBOARD_SC_RESERVED 0x00
#define HID_KEYBOARD_SC_ERROR_ROLLOVER 0x01
#define HID_KEYBOARD_SC_POST_FAIL 0x02
#define HID_KEYBOARD_SC_ERROR_UNDEFINED 0x03
#define HID_KEYBOARD_SC_4_AND_DOLLAR 0x21
#define HID_KEYBOARD_SC_5_AND_PERCENTAGE 0x22
#define HID_KEYBOARD_SC_6_AND_CARET 0x23
- #define HID_KEYBOARD_SC_7_AND_AND_AMPERSAND 0x24
+ #define HID_KEYBOARD_SC_7_AND_AMPERSAND 0x24
#define HID_KEYBOARD_SC_8_AND_ASTERISK 0x25
#define HID_KEYBOARD_SC_9_AND_OPENING_PARENTHESIS 0x26
#define HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS 0x27
#define HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT 0x62
#define HID_KEYBOARD_SC_KEYPAD_DOT_AND_DELETE 0x63
#define HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE 0x64
+ #define HID_KEYBOARD_SC_APPLICATION 0x65
#define HID_KEYBOARD_SC_POWER 0x66
- #define HID_KEYBOARD_SC_EQUAL_SIGN 0x67
+ #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN 0x67
#define HID_KEYBOARD_SC_F13 0x68
#define HID_KEYBOARD_SC_F14 0x69
#define HID_KEYBOARD_SC_F15 0x6A
#define HID_KEYBOARD_SC_F24 0x73
#define HID_KEYBOARD_SC_EXECUTE 0x74
#define HID_KEYBOARD_SC_HELP 0x75
- #define HID_KEYBOARD_SC_MANU 0x76
+ #define HID_KEYBOARD_SC_MENU 0x76
#define HID_KEYBOARD_SC_SELECT 0x77
#define HID_KEYBOARD_SC_STOP 0x78
#define HID_KEYBOARD_SC_AGAIN 0x79
#define HID_KEYBOARD_SC_LOCKING_NUM_LOCK 0x83
#define HID_KEYBOARD_SC_LOCKING_SCROLL_LOCK 0x84
#define HID_KEYBOARD_SC_KEYPAD_COMMA 0x85
- #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN 0x86
+ #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN_AS400 0x86
#define HID_KEYBOARD_SC_INTERNATIONAL1 0x87
#define HID_KEYBOARD_SC_INTERNATIONAL2 0x88
#define HID_KEYBOARD_SC_INTERNATIONAL3 0x89
#define HID_KEYBOARD_SC_LANG8 0x97
#define HID_KEYBOARD_SC_LANG9 0x98
#define HID_KEYBOARD_SC_ALTERNATE_ERASE 0x99
- #define HID_KEYBOARD_SC_SISREQ 0x9A
+ #define HID_KEYBOARD_SC_SYSREQ 0x9A
#define HID_KEYBOARD_SC_CANCEL 0x9B
#define HID_KEYBOARD_SC_CLEAR 0x9C
#define HID_KEYBOARD_SC_PRIOR 0x9D
#define HID_KEYBOARD_SC_OUT 0xA0
#define HID_KEYBOARD_SC_OPER 0xA1
#define HID_KEYBOARD_SC_CLEAR_AND_AGAIN 0xA2
- #define HID_KEYBOARD_SC_CRSEL_ANDPROPS 0xA3
+ #define HID_KEYBOARD_SC_CRSEL_AND_PROPS 0xA3
#define HID_KEYBOARD_SC_EXSEL 0xA4
#define HID_KEYBOARD_SC_KEYPAD_00 0xB0
#define HID_KEYBOARD_SC_KEYPAD_000 0xB1
#define HID_KEYBOARD_SC_RIGHT_SHIFT 0xE5
#define HID_KEYBOARD_SC_RIGHT_ALT 0xE6
#define HID_KEYBOARD_SC_RIGHT_GUI 0xE7
+ #define HID_KEYBOARD_SC_MEDIA_PLAY 0xE8
+ #define HID_KEYBOARD_SC_MEDIA_STOP 0xE9
+ #define HID_KEYBOARD_SC_MEDIA_PREVIOUS_TRACK 0xEA
+ #define HID_KEYBOARD_SC_MEDIA_NEXT_TRACK 0xEB
+ #define HID_KEYBOARD_SC_MEDIA_EJECT 0xEC
+ #define HID_KEYBOARD_SC_MEDIA_VOLUME_UP 0xED
+ #define HID_KEYBOARD_SC_MEDIA_VOLUME_DOWN 0xEE
+ #define HID_KEYBOARD_SC_MEDIA_MUTE 0xEF
+ #define HID_KEYBOARD_SC_MEDIA_WWW 0xF0
+ #define HID_KEYBOARD_SC_MEDIA_BACKWARD 0xF1
+ #define HID_KEYBOARD_SC_MEDIA_FORWARD 0xF2
+ #define HID_KEYBOARD_SC_MEDIA_CANCEL 0xF3
+ #define HID_KEYBOARD_SC_MEDIA_SEARCH 0xF4
+ #define HID_KEYBOARD_SC_MEDIA_SLEEP 0xF8
+ #define HID_KEYBOARD_SC_MEDIA_LOCK 0xF9
+ #define HID_KEYBOARD_SC_MEDIA_RELOAD 0xFA
+ #define HID_KEYBOARD_SC_MEDIA_CALCULATOR 0xFB
//@}
/** \name Common HID Device Report Descriptors */
* \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_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \
+ HID_RI_REPORT_COUNT(8, 3), \
+ HID_RI_REPORT_SIZE(8, (((MinAxisVal >= -128) && (MaxAxisVal <= 127)) ? 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_REPORT_SIZE(8, 0x01), \
HID_RI_REPORT_COUNT(8, Buttons), \
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
- HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \
+ HID_RI_REPORT_SIZE(8, (Buttons % 8) ? (8 - (Buttons % 8)) : 0), \
HID_RI_REPORT_COUNT(8, 0x01), \
HID_RI_INPUT(8, HID_IOF_CONSTANT), \
HID_RI_END_COLLECTION(0)
HID_RI_REPORT_SIZE(8, 0x03), \
HID_RI_OUTPUT(8, HID_IOF_CONSTANT), \
HID_RI_LOGICAL_MINIMUM(8, 0x00), \
- HID_RI_LOGICAL_MAXIMUM(8, 0x65), \
+ HID_RI_LOGICAL_MAXIMUM(16, 0xFF), \
HID_RI_USAGE_PAGE(8, 0x07), \
HID_RI_USAGE_MINIMUM(8, 0x00), \
- HID_RI_USAGE_MAXIMUM(8, 0x65), \
+ HID_RI_USAGE_MAXIMUM(8, 0xFF), \
HID_RI_REPORT_COUNT(8, MaxKeys), \
HID_RI_REPORT_SIZE(8, 0x08), \
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), \
* \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations (16-bit).
* \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations (16-bit).
* \param[in] Buttons Total number of buttons in the device (8-bit).
- * \param[in] AbsoluteCoords Boolean true to use absolute X/Y coordinates (e.g. touchscreen).
+ * \param[in] AbsoluteCoords Boolean \c true to use absolute X/Y coordinates (e.g. touchscreen).
*/
#define HID_DESCRIPTOR_MOUSE(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, AbsoluteCoords) \
HID_RI_USAGE_PAGE(8, 0x01), \
HID_RI_REPORT_SIZE(8, 0x01), \
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \
HID_RI_REPORT_COUNT(8, 0x01), \
- HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \
+ HID_RI_REPORT_SIZE(8, (Buttons % 8) ? (8 - (Buttons % 8)) : 0), \
HID_RI_INPUT(8, HID_IOF_CONSTANT), \
HID_RI_USAGE_PAGE(8, 0x01), \
HID_RI_USAGE(8, 0x30), \
HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \
HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \
HID_RI_REPORT_COUNT(8, 0x02), \
- HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \
+ HID_RI_REPORT_SIZE(8, (((MinAxisVal >= -128) && (MaxAxisVal <= 127)) ? 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)
/** \hideinitializer
* A list of HID report item array elements that describe a typical Vendor Defined byte array HID report descriptor,
* used for transporting arbitrary data between the USB host and device via HID reports. The resulting report should be
- * a uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions.
+ * a \c uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions.
*
* \param[in] VendorPageNum Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF.
* \param[in] CollectionUsage Vendor Usage for the encompassing report IN and OUT collection, ranging from 0x00 to 0xFF.
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
- uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */
+ uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to.
+ *
+ * \see \ref VERSION_BCD() utility macro.
+ */
uint8_t CountryCode; /**< Country code of the localized device, or zero if universal. */
uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */
* given by the specific class.
*/
- uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */
+ uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to.
+ *
+ * \see \ref VERSION_BCD() utility macro.
+ */
uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */
uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */
#endif
/** @} */
-