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