]> git.donarmstrong.com Git - qmk_firmware.git/blob - protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h
Change TOP_DIR to TMK_DIR in makefiles
[qmk_firmware.git] / protocol / lufa / LUFA-120730 / LUFA / Drivers / USB / Class / Common / HIDClassCommon.h
1 /*\r
2              LUFA Library\r
3      Copyright (C) Dean Camera, 2012.\r
4 \r
5   dean [at] fourwalledcubicle [dot] com\r
6            www.lufa-lib.org\r
7 */\r
8 \r
9 /*\r
10   Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
11 \r
12   Permission to use, copy, modify, distribute, and sell this\r
13   software and its documentation for any purpose is hereby granted\r
14   without fee, provided that the above copyright notice appear in\r
15   all copies and that both that the copyright notice and this\r
16   permission notice and warranty disclaimer appear in supporting\r
17   documentation, and that the name of the author not be used in\r
18   advertising or publicity pertaining to distribution of the\r
19   software without specific, written prior permission.\r
20 \r
21   The author disclaim all warranties with regard to this\r
22   software, including all implied warranties of merchantability\r
23   and fitness.  In no event shall the author be liable for any\r
24   special, indirect or consequential damages or any damages\r
25   whatsoever resulting from loss of use, data or profits, whether\r
26   in an action of contract, negligence or other tortious action,\r
27   arising out of or in connection with the use or performance of\r
28   this software.\r
29 */\r
30 \r
31 /** \file\r
32  *  \brief Common definitions and declarations for the library USB HID Class driver.\r
33  *\r
34  *  Common definitions and declarations for the library USB HID Class driver.\r
35  *\r
36  *  \note This file should not be included directly. It is automatically included as needed by the USB module driver\r
37  *        dispatch header located in LUFA/Drivers/USB.h.\r
38  */\r
39 \r
40 /** \ingroup Group_USBClassHID\r
41  *  \defgroup Group_USBClassHIDCommon  Common Class Definitions\r
42  *\r
43  *  \section Sec_ModDescription Module Description\r
44  *  Constants, Types and Enum definitions that are common to both Device and Host modes for the USB\r
45  *  HID Class.\r
46  *\r
47  *  @{\r
48  */\r
49 \r
50 #ifndef _HID_CLASS_COMMON_H_\r
51 #define _HID_CLASS_COMMON_H_\r
52 \r
53         /* Includes: */\r
54                 #include "../../Core/StdDescriptors.h"\r
55                 #include "HIDParser.h"\r
56 \r
57         /* Enable C linkage for C++ Compilers: */\r
58                 #if defined(__cplusplus)\r
59                         extern "C" {\r
60                 #endif\r
61 \r
62         /* Preprocessor Checks: */\r
63                 #if !defined(__INCLUDE_FROM_HID_DRIVER)\r
64                         #error Do not include this file directly. Include LUFA/Drivers/USB.h instead.\r
65                 #endif\r
66 \r
67         /* Macros: */\r
68                 /** \name Keyboard Standard Report Modifier Masks */\r
69                 //@{\r
70                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */\r
71                 #define HID_KEYBOARD_MODIFIER_LEFTCTRL                    (1 << 0)\r
72 \r
73                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */\r
74                 #define HID_KEYBOARD_MODIFIER_LEFTSHIFT                   (1 << 1)\r
75 \r
76                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */\r
77                 #define HID_KEYBOARD_MODIFIER_LEFTALT                     (1 << 2)\r
78 \r
79                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */\r
80                 #define HID_KEYBOARD_MODIFIER_LEFTGUI                     (1 << 3)\r
81 \r
82                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */\r
83                 #define HID_KEYBOARD_MODIFIER_RIGHTCTRL                   (1 << 4)\r
84 \r
85                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */\r
86                 #define HID_KEYBOARD_MODIFIER_RIGHTSHIFT                  (1 << 5)\r
87 \r
88                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */\r
89                 #define HID_KEYBOARD_MODIFIER_RIGHTALT                    (1 << 6)\r
90 \r
91                 /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */\r
92                 #define HID_KEYBOARD_MODIFIER_RIGHTGUI                    (1 << 7)\r
93                 //@}\r
94 \r
95                 /** \name Keyboard Standard Report LED Masks */\r
96                 //@{\r
97                 /** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */\r
98                 #define HID_KEYBOARD_LED_NUMLOCK                          (1 << 0)\r
99 \r
100                 /** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */\r
101                 #define HID_KEYBOARD_LED_CAPSLOCK                         (1 << 1)\r
102 \r
103                 /** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */\r
104                 #define HID_KEYBOARD_LED_SCROLLLOCK                       (1 << 2)\r
105 \r
106                 /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */\r
107                 #define HID_KEYBOARD_LED_KATANA                           (1 << 3)\r
108                 //@}\r
109 \r
110                 /** \name Keyboard Standard Report Key Scan-codes */\r
111                 //@{\r
112                 #define HID_KEYBOARD_SC_ERROR_ROLLOVER                    0x01\r
113                 #define HID_KEYBOARD_SC_POST_FAIL                         0x02\r
114                 #define HID_KEYBOARD_SC_ERROR_UNDEFINED                   0x03\r
115                 #define HID_KEYBOARD_SC_A                                 0x04\r
116                 #define HID_KEYBOARD_SC_B                                 0x05\r
117                 #define HID_KEYBOARD_SC_C                                 0x06\r
118                 #define HID_KEYBOARD_SC_D                                 0x07\r
119                 #define HID_KEYBOARD_SC_E                                 0x08\r
120                 #define HID_KEYBOARD_SC_F                                 0x09\r
121                 #define HID_KEYBOARD_SC_G                                 0x0A\r
122                 #define HID_KEYBOARD_SC_H                                 0x0B\r
123                 #define HID_KEYBOARD_SC_I                                 0x0C\r
124                 #define HID_KEYBOARD_SC_J                                 0x0D\r
125                 #define HID_KEYBOARD_SC_K                                 0x0E\r
126                 #define HID_KEYBOARD_SC_L                                 0x0F\r
127                 #define HID_KEYBOARD_SC_M                                 0x10\r
128                 #define HID_KEYBOARD_SC_N                                 0x11\r
129                 #define HID_KEYBOARD_SC_O                                 0x12\r
130                 #define HID_KEYBOARD_SC_P                                 0x13\r
131                 #define HID_KEYBOARD_SC_Q                                 0x14\r
132                 #define HID_KEYBOARD_SC_R                                 0x15\r
133                 #define HID_KEYBOARD_SC_S                                 0x16\r
134                 #define HID_KEYBOARD_SC_T                                 0x17\r
135                 #define HID_KEYBOARD_SC_U                                 0x18\r
136                 #define HID_KEYBOARD_SC_V                                 0x19\r
137                 #define HID_KEYBOARD_SC_W                                 0x1A\r
138                 #define HID_KEYBOARD_SC_X                                 0x1B\r
139                 #define HID_KEYBOARD_SC_Y                                 0x1C\r
140                 #define HID_KEYBOARD_SC_Z                                 0x1D\r
141                 #define HID_KEYBOARD_SC_1_AND_EXCLAMATION                 0x1E\r
142                 #define HID_KEYBOARD_SC_2_AND_AT                          0x1F\r
143                 #define HID_KEYBOARD_SC_3_AND_HASHMARK                    0x20\r
144                 #define HID_KEYBOARD_SC_4_AND_DOLLAR                      0x21\r
145                 #define HID_KEYBOARD_SC_5_AND_PERCENTAGE                  0x22\r
146                 #define HID_KEYBOARD_SC_6_AND_CARET                       0x23\r
147                 #define HID_KEYBOARD_SC_7_AND_AND_AMPERSAND               0x24\r
148                 #define HID_KEYBOARD_SC_8_AND_ASTERISK                    0x25\r
149                 #define HID_KEYBOARD_SC_9_AND_OPENING_PARENTHESIS         0x26\r
150                 #define HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS         0x27\r
151                 #define HID_KEYBOARD_SC_ENTER                             0x28\r
152                 #define HID_KEYBOARD_SC_ESCAPE                            0x29\r
153                 #define HID_KEYBOARD_SC_BACKSPACE                         0x2A\r
154                 #define HID_KEYBOARD_SC_TAB                               0x2B\r
155                 #define HID_KEYBOARD_SC_SPACE                             0x2C\r
156                 #define HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE              0x2D\r
157                 #define HID_KEYBOARD_SC_EQUAL_AND_PLUS                    0x2E\r
158                 #define HID_KEYBOARD_SC_OPENING_BRACKET_AND_OPENING_BRACE 0x2F\r
159                 #define HID_KEYBOARD_SC_CLOSING_BRACKET_AND_CLOSING_BRACE 0x30\r
160                 #define HID_KEYBOARD_SC_BACKSLASH_AND_PIPE                0x31\r
161                 #define HID_KEYBOARD_SC_NON_US_HASHMARK_AND_TILDE         0x32\r
162                 #define HID_KEYBOARD_SC_SEMICOLON_AND_COLON               0x33\r
163                 #define HID_KEYBOARD_SC_APOSTROPHE_AND_QUOTE              0x34\r
164                 #define HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE            0x35\r
165                 #define HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN          0x36\r
166                 #define HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN         0x37\r
167                 #define HID_KEYBOARD_SC_SLASH_AND_QUESTION_MARK           0x38\r
168                 #define HID_KEYBOARD_SC_CAPS_LOCK                         0x39\r
169                 #define HID_KEYBOARD_SC_F1                                0x3A\r
170                 #define HID_KEYBOARD_SC_F2                                0x3B\r
171                 #define HID_KEYBOARD_SC_F3                                0x3C\r
172                 #define HID_KEYBOARD_SC_F4                                0x3D\r
173                 #define HID_KEYBOARD_SC_F5                                0x3E\r
174                 #define HID_KEYBOARD_SC_F6                                0x3F\r
175                 #define HID_KEYBOARD_SC_F7                                0x40\r
176                 #define HID_KEYBOARD_SC_F8                                0x41\r
177                 #define HID_KEYBOARD_SC_F9                                0x42\r
178                 #define HID_KEYBOARD_SC_F10                               0x43\r
179                 #define HID_KEYBOARD_SC_F11                               0x44\r
180                 #define HID_KEYBOARD_SC_F12                               0x45\r
181                 #define HID_KEYBOARD_SC_PRINT_SCREEN                      0x46\r
182                 #define HID_KEYBOARD_SC_SCROLL_LOCK                       0x47\r
183                 #define HID_KEYBOARD_SC_PAUSE                             0x48\r
184                 #define HID_KEYBOARD_SC_INSERT                            0x49\r
185                 #define HID_KEYBOARD_SC_HOME                              0x4A\r
186                 #define HID_KEYBOARD_SC_PAGE_UP                           0x4B\r
187                 #define HID_KEYBOARD_SC_DELETE                            0x4C\r
188                 #define HID_KEYBOARD_SC_END                               0x4D\r
189                 #define HID_KEYBOARD_SC_PAGE_DOWN                         0x4E\r
190                 #define HID_KEYBOARD_SC_RIGHT_ARROW                       0x4F\r
191                 #define HID_KEYBOARD_SC_LEFT_ARROW                        0x50\r
192                 #define HID_KEYBOARD_SC_DOWN_ARROW                        0x51\r
193                 #define HID_KEYBOARD_SC_UP_ARROW                          0x52\r
194                 #define HID_KEYBOARD_SC_NUM_LOCK                          0x53\r
195                 #define HID_KEYBOARD_SC_KEYPAD_SLASH                      0x54\r
196                 #define HID_KEYBOARD_SC_KEYPAD_ASTERISK                   0x55\r
197                 #define HID_KEYBOARD_SC_KEYPAD_MINUS                      0x56\r
198                 #define HID_KEYBOARD_SC_KEYPAD_PLUS                       0x57\r
199                 #define HID_KEYBOARD_SC_KEYPAD_ENTER                      0x58\r
200                 #define HID_KEYBOARD_SC_KEYPAD_1_AND_END                  0x59\r
201                 #define HID_KEYBOARD_SC_KEYPAD_2_AND_DOWN_ARROW           0x5A\r
202                 #define HID_KEYBOARD_SC_KEYPAD_3_AND_PAGE_DOWN            0x5B\r
203                 #define HID_KEYBOARD_SC_KEYPAD_4_AND_LEFT_ARROW           0x5C\r
204                 #define HID_KEYBOARD_SC_KEYPAD_5                          0x5D\r
205                 #define HID_KEYBOARD_SC_KEYPAD_6_AND_RIGHT_ARROW          0x5E\r
206                 #define HID_KEYBOARD_SC_KEYPAD_7_AND_HOME                 0x5F\r
207                 #define HID_KEYBOARD_SC_KEYPAD_8_AND_UP_ARROW             0x60\r
208                 #define HID_KEYBOARD_SC_KEYPAD_9_AND_PAGE_UP              0x61\r
209                 #define HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT               0x62\r
210                 #define HID_KEYBOARD_SC_KEYPAD_DOT_AND_DELETE             0x63\r
211                 #define HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE         0x64\r
212                 #define HID_KEYBOARD_SC_POWER                             0x66\r
213                 #define HID_KEYBOARD_SC_EQUAL_SIGN                        0x67\r
214                 #define HID_KEYBOARD_SC_F13                               0x68\r
215                 #define HID_KEYBOARD_SC_F14                               0x69\r
216                 #define HID_KEYBOARD_SC_F15                               0x6A\r
217                 #define HID_KEYBOARD_SC_F16                               0x6B\r
218                 #define HID_KEYBOARD_SC_F17                               0x6C\r
219                 #define HID_KEYBOARD_SC_F18                               0x6D\r
220                 #define HID_KEYBOARD_SC_F19                               0x6E\r
221                 #define HID_KEYBOARD_SC_F20                               0x6F\r
222                 #define HID_KEYBOARD_SC_F21                               0x70\r
223                 #define HID_KEYBOARD_SC_F22                               0x71\r
224                 #define HID_KEYBOARD_SC_F23                               0x72\r
225                 #define HID_KEYBOARD_SC_F24                               0x73\r
226                 #define HID_KEYBOARD_SC_EXECUTE                           0x74\r
227                 #define HID_KEYBOARD_SC_HELP                              0x75\r
228                 #define HID_KEYBOARD_SC_MANU                              0x76\r
229                 #define HID_KEYBOARD_SC_SELECT                            0x77\r
230                 #define HID_KEYBOARD_SC_STOP                              0x78\r
231                 #define HID_KEYBOARD_SC_AGAIN                             0x79\r
232                 #define HID_KEYBOARD_SC_UNDO                              0x7A\r
233                 #define HID_KEYBOARD_SC_CUT                               0x7B\r
234                 #define HID_KEYBOARD_SC_COPY                              0x7C\r
235                 #define HID_KEYBOARD_SC_PASTE                             0x7D\r
236                 #define HID_KEYBOARD_SC_FIND                              0x7E\r
237                 #define HID_KEYBOARD_SC_MUTE                              0x7F\r
238                 #define HID_KEYBOARD_SC_VOLUME_UP                         0x80\r
239                 #define HID_KEYBOARD_SC_VOLUME_DOWN                       0x81\r
240                 #define HID_KEYBOARD_SC_LOCKING_CAPS_LOCK                 0x82\r
241                 #define HID_KEYBOARD_SC_LOCKING_NUM_LOCK                  0x83\r
242                 #define HID_KEYBOARD_SC_LOCKING_SCROLL_LOCK               0x84\r
243                 #define HID_KEYBOARD_SC_KEYPAD_COMMA                      0x85\r
244                 #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN                 0x86\r
245                 #define HID_KEYBOARD_SC_INTERNATIONAL1                    0x87\r
246                 #define HID_KEYBOARD_SC_INTERNATIONAL2                    0x88\r
247                 #define HID_KEYBOARD_SC_INTERNATIONAL3                    0x89\r
248                 #define HID_KEYBOARD_SC_INTERNATIONAL4                    0x8A\r
249                 #define HID_KEYBOARD_SC_INTERNATIONAL5                    0x8B\r
250                 #define HID_KEYBOARD_SC_INTERNATIONAL6                    0x8C\r
251                 #define HID_KEYBOARD_SC_INTERNATIONAL7                    0x8D\r
252                 #define HID_KEYBOARD_SC_INTERNATIONAL8                    0x8E\r
253                 #define HID_KEYBOARD_SC_INTERNATIONAL9                    0x8F\r
254                 #define HID_KEYBOARD_SC_LANG1                             0x90\r
255                 #define HID_KEYBOARD_SC_LANG2                             0x91\r
256                 #define HID_KEYBOARD_SC_LANG3                             0x92\r
257                 #define HID_KEYBOARD_SC_LANG4                             0x93\r
258                 #define HID_KEYBOARD_SC_LANG5                             0x94\r
259                 #define HID_KEYBOARD_SC_LANG6                             0x95\r
260                 #define HID_KEYBOARD_SC_LANG7                             0x96\r
261                 #define HID_KEYBOARD_SC_LANG8                             0x97\r
262                 #define HID_KEYBOARD_SC_LANG9                             0x98\r
263                 #define HID_KEYBOARD_SC_ALTERNATE_ERASE                   0x99\r
264                 #define HID_KEYBOARD_SC_SISREQ                            0x9A\r
265                 #define HID_KEYBOARD_SC_CANCEL                            0x9B\r
266                 #define HID_KEYBOARD_SC_CLEAR                             0x9C\r
267                 #define HID_KEYBOARD_SC_PRIOR                             0x9D\r
268                 #define HID_KEYBOARD_SC_RETURN                            0x9E\r
269                 #define HID_KEYBOARD_SC_SEPARATOR                         0x9F\r
270                 #define HID_KEYBOARD_SC_OUT                               0xA0\r
271                 #define HID_KEYBOARD_SC_OPER                              0xA1\r
272                 #define HID_KEYBOARD_SC_CLEAR_AND_AGAIN                   0xA2\r
273                 #define HID_KEYBOARD_SC_CRSEL_ANDPROPS                    0xA3\r
274                 #define HID_KEYBOARD_SC_EXSEL                             0xA4\r
275                 #define HID_KEYBOARD_SC_KEYPAD_00                         0xB0\r
276                 #define HID_KEYBOARD_SC_KEYPAD_000                        0xB1\r
277                 #define HID_KEYBOARD_SC_THOUSANDS_SEPARATOR               0xB2\r
278                 #define HID_KEYBOARD_SC_DECIMAL_SEPARATOR                 0xB3\r
279                 #define HID_KEYBOARD_SC_CURRENCY_UNIT                     0xB4\r
280                 #define HID_KEYBOARD_SC_CURRENCY_SUB_UNIT                 0xB5\r
281                 #define HID_KEYBOARD_SC_KEYPAD_OPENING_PARENTHESIS        0xB6\r
282                 #define HID_KEYBOARD_SC_KEYPAD_CLOSING_PARENTHESIS        0xB7\r
283                 #define HID_KEYBOARD_SC_KEYPAD_OPENING_BRACE              0xB8\r
284                 #define HID_KEYBOARD_SC_KEYPAD_CLOSING_BRACE              0xB9\r
285                 #define HID_KEYBOARD_SC_KEYPAD_TAB                        0xBA\r
286                 #define HID_KEYBOARD_SC_KEYPAD_BACKSPACE                  0xBB\r
287                 #define HID_KEYBOARD_SC_KEYPAD_A                          0xBC\r
288                 #define HID_KEYBOARD_SC_KEYPAD_B                          0xBD\r
289                 #define HID_KEYBOARD_SC_KEYPAD_C                          0xBE\r
290                 #define HID_KEYBOARD_SC_KEYPAD_D                          0xBF\r
291                 #define HID_KEYBOARD_SC_KEYPAD_E                          0xC0\r
292                 #define HID_KEYBOARD_SC_KEYPAD_F                          0xC1\r
293                 #define HID_KEYBOARD_SC_KEYPAD_XOR                        0xC2\r
294                 #define HID_KEYBOARD_SC_KEYPAD_CARET                      0xC3\r
295                 #define HID_KEYBOARD_SC_KEYPAD_PERCENTAGE                 0xC4\r
296                 #define HID_KEYBOARD_SC_KEYPAD_LESS_THAN_SIGN             0xC5\r
297                 #define HID_KEYBOARD_SC_KEYPAD_GREATER_THAN_SIGN          0xC6\r
298                 #define HID_KEYBOARD_SC_KEYPAD_AMP                        0xC7\r
299                 #define HID_KEYBOARD_SC_KEYPAD_AMP_AMP                    0xC8\r
300                 #define HID_KEYBOARD_SC_KEYPAD_PIPE                       0xC9\r
301                 #define HID_KEYBOARD_SC_KEYPAD_PIPE_PIPE                  0xCA\r
302                 #define HID_KEYBOARD_SC_KEYPAD_COLON                      0xCB\r
303                 #define HID_KEYBOARD_SC_KEYPAD_HASHMARK                   0xCC\r
304                 #define HID_KEYBOARD_SC_KEYPAD_SPACE                      0xCD\r
305                 #define HID_KEYBOARD_SC_KEYPAD_AT                         0xCE\r
306                 #define HID_KEYBOARD_SC_KEYPAD_EXCLAMATION_SIGN           0xCF\r
307                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_STORE               0xD0\r
308                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_RECALL              0xD1\r
309                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_CLEAR               0xD2\r
310                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_ADD                 0xD3\r
311                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_SUBTRACT            0xD4\r
312                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_MULTIPLY            0xD5\r
313                 #define HID_KEYBOARD_SC_KEYPAD_MEMORY_DIVIDE              0xD6\r
314                 #define HID_KEYBOARD_SC_KEYPAD_PLUS_AND_MINUS             0xD7\r
315                 #define HID_KEYBOARD_SC_KEYPAD_CLEAR                      0xD8\r
316                 #define HID_KEYBOARD_SC_KEYPAD_CLEAR_ENTRY                0xD9\r
317                 #define HID_KEYBOARD_SC_KEYPAD_BINARY                     0xDA\r
318                 #define HID_KEYBOARD_SC_KEYPAD_OCTAL                      0xDB\r
319                 #define HID_KEYBOARD_SC_KEYPAD_DECIMAL                    0xDC\r
320                 #define HID_KEYBOARD_SC_KEYPAD_HEXADECIMAL                0xDD\r
321                 #define HID_KEYBOARD_SC_LEFT_CONTROL                      0xE0\r
322                 #define HID_KEYBOARD_SC_LEFT_SHIFT                        0xE1\r
323                 #define HID_KEYBOARD_SC_LEFT_ALT                          0xE2\r
324                 #define HID_KEYBOARD_SC_LEFT_GUI                          0xE3\r
325                 #define HID_KEYBOARD_SC_RIGHT_CONTROL                     0xE4\r
326                 #define HID_KEYBOARD_SC_RIGHT_SHIFT                       0xE5\r
327                 #define HID_KEYBOARD_SC_RIGHT_ALT                         0xE6\r
328                 #define HID_KEYBOARD_SC_RIGHT_GUI                         0xE7\r
329                 //@}\r
330 \r
331                 /** \name Common HID Device Report Descriptors */\r
332                 //@{\r
333                 /** \hideinitializer\r
334                  *  A list of HID report item array elements that describe a typical HID USB Joystick. The resulting report\r
335                  *  descriptor is structured according to the following layout:\r
336                  *\r
337                  *  \code\r
338                  *  struct\r
339                  *  {\r
340                  *      intA_t X; // Signed X axis value\r
341                  *      intA_t Y; // Signed Y axis value\r
342                  *      intA_t Z; // Signed Z axis value\r
343                  *      uintB_t Buttons; // Pressed buttons bitmask\r
344                  *  } Joystick_Report;\r
345                  *  \endcode\r
346                  *\r
347                  *  Where \c uintA_t is a type large enough to hold the ranges of the signed \c MinAxisVal and \c MaxAxisVal values,\r
348                  *  and \c intB_t is a type large enough to hold one bit per button.\r
349                  *\r
350                  *  \param[in] MinAxisVal      Minimum logical axis value (16-bit).\r
351                  *  \param[in] MaxAxisVal      Maximum logical axis value (16-bit).\r
352                  *  \param[in] MinPhysicalVal  Minimum physical axis value, for movement resolution calculations (16-bit).\r
353                  *  \param[in] MaxPhysicalVal  Maximum physical axis value, for movement resolution calculations (16-bit).\r
354                  *  \param[in] Buttons         Total number of buttons in the device (8-bit).\r
355                  */\r
356                 #define HID_DESCRIPTOR_JOYSTICK(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \\r
357                         HID_RI_USAGE_PAGE(8, 0x01),                     \\r
358                         HID_RI_USAGE(8, 0x04),                          \\r
359                         HID_RI_COLLECTION(8, 0x01),                     \\r
360                                 HID_RI_USAGE(8, 0x01),                      \\r
361                                 HID_RI_COLLECTION(8, 0x00),                 \\r
362                                         HID_RI_USAGE(8, 0x30),                  \\r
363                                         HID_RI_USAGE(8, 0x31),                  \\r
364                                         HID_RI_USAGE(8, 0x32),                  \\r
365                                         HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \\r
366                                         HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \\r
367                                         HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \\r
368                                         HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \\r
369                                         HID_RI_REPORT_COUNT(8, 3),              \\r
370                                         HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \\r
371                                         HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \\r
372                                 HID_RI_END_COLLECTION(0),                   \\r
373                                 HID_RI_USAGE_PAGE(8, 0x09),                 \\r
374                                 HID_RI_USAGE_MINIMUM(8, 0x01),              \\r
375                                 HID_RI_USAGE_MAXIMUM(8, Buttons),           \\r
376                                 HID_RI_LOGICAL_MINIMUM(8, 0x00),            \\r
377                                 HID_RI_LOGICAL_MAXIMUM(8, 0x01),            \\r
378                                 HID_RI_REPORT_SIZE(8, 0x01),                \\r
379                                 HID_RI_REPORT_COUNT(8, Buttons),            \\r
380                                 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \\r
381                                 HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \\r
382                                 HID_RI_REPORT_COUNT(8, 0x01),               \\r
383                                 HID_RI_INPUT(8, HID_IOF_CONSTANT),          \\r
384                         HID_RI_END_COLLECTION(0)\r
385 \r
386                 /** \hideinitializer\r
387                  *  A list of HID report item array elements that describe a typical HID USB keyboard. The resulting report descriptor\r
388                  *  is compatible with \ref USB_KeyboardReport_Data_t when \c MaxKeys is equal to 6. For other values, the report will\r
389                  *  be structured according to the following layout:\r
390                  *\r
391                  *  \code\r
392                  *  struct\r
393                  *  {\r
394                  *      uint8_t Modifier; // Keyboard modifier byte indicating pressed modifier keys (\c HID_KEYBOARD_MODIFER_* masks)\r
395                  *      uint8_t Reserved; // Reserved for OEM use, always set to 0.\r
396                  *      uint8_t KeyCode[MaxKeys]; // Length determined by the number of keys that can be reported\r
397                  *  } Keyboard_Report;\r
398                  *  \endcode\r
399                  *\r
400                  *  \param[in] MaxKeys  Number of simultaneous keys that can be reported at the one time (8-bit).\r
401                  */\r
402                 #define HID_DESCRIPTOR_KEYBOARD(MaxKeys)            \\r
403                         HID_RI_USAGE_PAGE(8, 0x01),                     \\r
404                         HID_RI_USAGE(8, 0x06),                          \\r
405                         HID_RI_COLLECTION(8, 0x01),                     \\r
406                                 HID_RI_USAGE_PAGE(8, 0x07),                 \\r
407                                 HID_RI_USAGE_MINIMUM(8, 0xE0),              \\r
408                                 HID_RI_USAGE_MAXIMUM(8, 0xE7),              \\r
409                                 HID_RI_LOGICAL_MINIMUM(8, 0x00),            \\r
410                                 HID_RI_LOGICAL_MAXIMUM(8, 0x01),            \\r
411                                 HID_RI_REPORT_SIZE(8, 0x01),                \\r
412                                 HID_RI_REPORT_COUNT(8, 0x08),               \\r
413                                 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \\r
414                                 HID_RI_REPORT_COUNT(8, 0x01),               \\r
415                                 HID_RI_REPORT_SIZE(8, 0x08),                \\r
416                                 HID_RI_INPUT(8, HID_IOF_CONSTANT),          \\r
417                                 HID_RI_USAGE_PAGE(8, 0x08),                 \\r
418                                 HID_RI_USAGE_MINIMUM(8, 0x01),              \\r
419                                 HID_RI_USAGE_MAXIMUM(8, 0x05),              \\r
420                                 HID_RI_REPORT_COUNT(8, 0x05),               \\r
421                                 HID_RI_REPORT_SIZE(8, 0x01),                \\r
422                                 HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \\r
423                                 HID_RI_REPORT_COUNT(8, 0x01),               \\r
424                                 HID_RI_REPORT_SIZE(8, 0x03),                \\r
425                                 HID_RI_OUTPUT(8, HID_IOF_CONSTANT),         \\r
426                                 HID_RI_LOGICAL_MINIMUM(8, 0x00),            \\r
427                                 HID_RI_LOGICAL_MAXIMUM(8, 0x65),            \\r
428                                 HID_RI_USAGE_PAGE(8, 0x07),                 \\r
429                                 HID_RI_USAGE_MINIMUM(8, 0x00),              \\r
430                                 HID_RI_USAGE_MAXIMUM(8, 0x65),              \\r
431                                 HID_RI_REPORT_COUNT(8, MaxKeys),            \\r
432                                 HID_RI_REPORT_SIZE(8, 0x08),                \\r
433                                 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), \\r
434                         HID_RI_END_COLLECTION(0)\r
435 \r
436                 /** \hideinitializer\r
437                  *  A list of HID report item array elements that describe a typical HID USB mouse. The resulting report descriptor\r
438                  *  is compatible with \ref USB_MouseReport_Data_t if the \c MinAxisVal and \c MaxAxisVal values fit within a \c int8_t range\r
439                  *  and the number of Buttons is less than 8. For other values, the report is structured according to the following layout:\r
440                  *\r
441                  *  \code\r
442                  *  struct\r
443                  *  {\r
444                  *      uintA_t Buttons; // Pressed buttons bitmask\r
445                  *      intB_t X; // X axis value\r
446                  *      intB_t Y; // Y axis value\r
447                  *  } Mouse_Report;\r
448                  *  \endcode\r
449                  *\r
450                  *  Where \c intA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the\r
451                  *  ranges of the signed \c MinAxisVal and \c MaxAxisVal values.\r
452                  *\r
453                  *  \param[in] MinAxisVal      Minimum X/Y logical axis value (16-bit).\r
454                  *  \param[in] MaxAxisVal      Maximum X/Y logical axis value (16-bit).\r
455                  *  \param[in] MinPhysicalVal  Minimum X/Y physical axis value, for movement resolution calculations (16-bit).\r
456                  *  \param[in] MaxPhysicalVal  Maximum X/Y physical axis value, for movement resolution calculations (16-bit).\r
457                  *  \param[in] Buttons         Total number of buttons in the device (8-bit).\r
458                  *  \param[in] AbsoluteCoords  Boolean \c true to use absolute X/Y coordinates (e.g. touchscreen).\r
459                  */\r
460                 #define HID_DESCRIPTOR_MOUSE(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, AbsoluteCoords) \\r
461                         HID_RI_USAGE_PAGE(8, 0x01),                     \\r
462                         HID_RI_USAGE(8, 0x02),                          \\r
463                         HID_RI_COLLECTION(8, 0x01),                     \\r
464                                 HID_RI_USAGE(8, 0x01),                      \\r
465                                 HID_RI_COLLECTION(8, 0x00),                 \\r
466                                         HID_RI_USAGE_PAGE(8, 0x09),             \\r
467                                         HID_RI_USAGE_MINIMUM(8, 0x01),          \\r
468                                         HID_RI_USAGE_MAXIMUM(8, Buttons),       \\r
469                                         HID_RI_LOGICAL_MINIMUM(8, 0x00),        \\r
470                                         HID_RI_LOGICAL_MAXIMUM(8, 0x01),        \\r
471                                         HID_RI_REPORT_COUNT(8, Buttons),        \\r
472                                         HID_RI_REPORT_SIZE(8, 0x01),            \\r
473                                         HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \\r
474                                         HID_RI_REPORT_COUNT(8, 0x01),           \\r
475                                         HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \\r
476                                         HID_RI_INPUT(8, HID_IOF_CONSTANT),      \\r
477                                         HID_RI_USAGE_PAGE(8, 0x01),             \\r
478                                         HID_RI_USAGE(8, 0x30),                  \\r
479                                         HID_RI_USAGE(8, 0x31),                  \\r
480                                         HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \\r
481                                         HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \\r
482                                         HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \\r
483                                         HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \\r
484                                         HID_RI_REPORT_COUNT(8, 0x02),           \\r
485                                         HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \\r
486                                         HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE)), \\r
487                                 HID_RI_END_COLLECTION(0),                   \\r
488                         HID_RI_END_COLLECTION(0)\r
489 \r
490                 /** \hideinitializer\r
491                  *  A list of HID report item array elements that describe a typical Vendor Defined byte array HID report descriptor,\r
492                  *  used for transporting arbitrary data between the USB host and device via HID reports. The resulting report should be\r
493                  *  a \c uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions.\r
494                  *\r
495                  *  \param[in] VendorPageNum    Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF.\r
496                  *  \param[in] CollectionUsage  Vendor Usage for the encompassing report IN and OUT collection, ranging from 0x00 to 0xFF.\r
497                  *  \param[in] DataINUsage      Vendor Usage for the IN report data, ranging from 0x00 to 0xFF.\r
498                  *  \param[in] DataOUTUsage     Vendor Usage for the OUT report data, ranging from 0x00 to 0xFF.\r
499                  *  \param[in] NumBytes         Length of the data IN and OUT reports.\r
500                  */\r
501                 #define HID_DESCRIPTOR_VENDOR(VendorPageNum, CollectionUsage, DataINUsage, DataOUTUsage, NumBytes) \\r
502                         HID_RI_USAGE_PAGE(16, (0xFF00 | VendorPageNum)), \\r
503                         HID_RI_USAGE(8, CollectionUsage),           \\r
504                         HID_RI_COLLECTION(8, 0x01),                 \\r
505                                 HID_RI_USAGE(8, DataINUsage),           \\r
506                                 HID_RI_LOGICAL_MINIMUM(8, 0x00),        \\r
507                                 HID_RI_LOGICAL_MAXIMUM(8, 0xFF),        \\r
508                                 HID_RI_REPORT_SIZE(8, 0x08),            \\r
509                                 HID_RI_REPORT_COUNT(8, NumBytes),       \\r
510                                 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \\r
511                                 HID_RI_USAGE(8, DataOUTUsage),          \\r
512                                 HID_RI_LOGICAL_MINIMUM(8, 0x00),        \\r
513                                 HID_RI_LOGICAL_MAXIMUM(8, 0xFF),        \\r
514                                 HID_RI_REPORT_SIZE(8, 0x08),            \\r
515                                 HID_RI_REPORT_COUNT(8, NumBytes),       \\r
516                                 HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \\r
517                         HID_RI_END_COLLECTION(0)\r
518                 //@}\r
519 \r
520         /* Type Defines: */\r
521                 /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the HID\r
522                  *  device class.\r
523                  */\r
524                 enum HID_Descriptor_ClassSubclassProtocol_t\r
525                 {\r
526                         HID_CSCP_HIDClass             = 0x03, /**< Descriptor Class value indicating that the device or interface\r
527                                                                *   belongs to the HID class.\r
528                                                                */\r
529                         HID_CSCP_NonBootSubclass      = 0x00, /**< Descriptor Subclass value indicating that the device or interface\r
530                                                                *   does not implement a HID boot protocol.\r
531                                                                */\r
532                         HID_CSCP_BootSubclass         = 0x01, /**< Descriptor Subclass value indicating that the device or interface\r
533                                                                *   implements a HID boot protocol.\r
534                                                                */\r
535                         HID_CSCP_NonBootProtocol      = 0x00, /**< Descriptor Protocol value indicating that the device or interface\r
536                                                                *   does not belong to a HID boot protocol.\r
537                                                                */\r
538                         HID_CSCP_KeyboardBootProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface\r
539                                                                *   belongs to the Keyboard HID boot protocol.\r
540                                                                */\r
541                         HID_CSCP_MouseBootProtocol    = 0x02, /**< Descriptor Protocol value indicating that the device or interface\r
542                                                                *   belongs to the Mouse HID boot protocol.\r
543                                                                */\r
544                 };\r
545 \r
546                 /** Enum for the HID class specific control requests that can be issued by the USB bus host. */\r
547                 enum HID_ClassRequests_t\r
548                 {\r
549                         HID_REQ_GetReport       = 0x01, /**< HID class-specific Request to get the current HID report from the device. */\r
550                         HID_REQ_GetIdle         = 0x02, /**< HID class-specific Request to get the current device idle count. */\r
551                         HID_REQ_GetProtocol     = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */\r
552                         HID_REQ_SetReport       = 0x09, /**< HID class-specific Request to set the current HID report to the device. */\r
553                         HID_REQ_SetIdle         = 0x0A, /**< HID class-specific Request to set the device's idle count. */\r
554                         HID_REQ_SetProtocol     = 0x0B, /**< HID class-specific Request to set the current HID report protocol mode. */\r
555                 };\r
556 \r
557                 /** Enum for the HID class specific descriptor types. */\r
558                 enum HID_DescriptorTypes_t\r
559                 {\r
560                         HID_DTYPE_HID           = 0x21, /**< Descriptor header type value, to indicate a HID class HID descriptor. */\r
561                         HID_DTYPE_Report        = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */\r
562                 };\r
563 \r
564                 /** Enum for the different types of HID reports. */\r
565                 enum HID_ReportItemTypes_t\r
566                 {\r
567                         HID_REPORT_ITEM_In      = 0, /**< Indicates that the item is an IN report type. */\r
568                         HID_REPORT_ITEM_Out     = 1, /**< Indicates that the item is an OUT report type. */\r
569                         HID_REPORT_ITEM_Feature = 2, /**< Indicates that the item is a FEATURE report type. */\r
570                 };\r
571 \r
572                 /** \brief HID class-specific HID Descriptor (LUFA naming conventions).\r
573                  *\r
574                  *  Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID\r
575                  *  specification for details on the structure elements.\r
576                  *\r
577                  *  \see \ref USB_HID_StdDescriptor_HID_t for the version of this type with standard element names.\r
578                  *\r
579                  *  \note Regardless of CPU architecture, these values should be stored as little endian.\r
580                  */\r
581                 typedef struct\r
582                 {\r
583                         USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */\r
584 \r
585                         uint16_t                HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */\r
586                         uint8_t                 CountryCode; /**< Country code of the localized device, or zero if universal. */\r
587 \r
588                         uint8_t                 TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */\r
589 \r
590                         uint8_t                 HIDReportType; /**< Type of HID report, set to \ref HID_DTYPE_Report. */\r
591                         uint16_t                HIDReportLength; /**< Length of the associated HID report descriptor, in bytes. */\r
592                 } ATTR_PACKED USB_HID_Descriptor_HID_t;\r
593 \r
594                 /** \brief HID class-specific HID Descriptor (USB-IF naming conventions).\r
595                  *\r
596                  *  Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID\r
597                  *  specification for details on the structure elements.\r
598                  *\r
599                  *  \see \ref USB_HID_Descriptor_HID_t for the version of this type with non-standard LUFA specific\r
600                  *       element names.\r
601                  *\r
602                  *  \note Regardless of CPU architecture, these values should be stored as little endian.\r
603                  */\r
604                 typedef struct\r
605                 {\r
606                         uint8_t  bLength; /**< Size of the descriptor, in bytes. */\r
607                         uint8_t  bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value\r
608                                                    *   given by the specific class.\r
609                                                    */\r
610 \r
611                         uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */\r
612                         uint8_t  bCountryCode; /**< Country code of the localized device, or zero if universal. */\r
613 \r
614                         uint8_t  bNumDescriptors; /**< Total number of HID report descriptors for the interface. */\r
615 \r
616                         uint8_t  bDescriptorType2; /**< Type of HID report, set to \ref HID_DTYPE_Report. */\r
617                         uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */\r
618                 } ATTR_PACKED USB_HID_StdDescriptor_HID_t;\r
619 \r
620                 /** \brief Standard HID Boot Protocol Mouse Report.\r
621                  *\r
622                  *  Type define for a standard Boot Protocol Mouse report\r
623                  */\r
624                 typedef struct\r
625                 {\r
626                         uint8_t Button; /**< Button mask for currently pressed buttons in the mouse. */\r
627                         int8_t  X; /**< Current delta X movement of the mouse. */\r
628                         int8_t  Y; /**< Current delta Y movement on the mouse. */\r
629                 } ATTR_PACKED USB_MouseReport_Data_t;\r
630 \r
631                 /** \brief Standard HID Boot Protocol Keyboard Report.\r
632                  *\r
633                  *  Type define for a standard Boot Protocol Keyboard report\r
634                  */\r
635                 typedef struct\r
636                 {\r
637                         uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of\r
638                                            *   \c HID_KEYBOARD_MODIFER_* masks).\r
639                                            */\r
640                         uint8_t Reserved; /**< Reserved for OEM use, always set to 0. */\r
641                         uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys. */\r
642                 } ATTR_PACKED USB_KeyboardReport_Data_t;\r
643 \r
644                 /** Type define for the data type used to store HID report descriptor elements. */\r
645                 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;\r
646 \r
647         /* Disable C linkage for C++ Compilers: */\r
648                 #if defined(__cplusplus)\r
649                         }\r
650                 #endif\r
651 \r
652 #endif\r
653 \r
654 /** @} */\r
655 \r