| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_hid.h
Go to the documentation of this file.
1 /*
2 * @brief Definition of USB ROM based HID class descriptors and their bit defines
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #include "usbd.h"
33
34 #ifndef __HID_H__
35 #define __HID_H__
36
47 #define HID_SUBCLASS_NONE 0x00
48
49 #define HID_SUBCLASS_BOOT 0x01
50
56 #define HID_PROTOCOL_NONE 0x00
57
58 #define HID_PROTOCOL_KEYBOARD 0x01
59
60 #define HID_PROTOCOL_MOUSE 0x02
61
69 #define HID_HID_DESCRIPTOR_TYPE 0x21
70
71 #define HID_REPORT_DESCRIPTOR_TYPE 0x22
72
73 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
74
83 PRE_PACK struct POST_PACK _HID_DESCRIPTOR {
84 uint8_t bLength;
85 uint8_t bDescriptorType;
86 uint16_t bcdHID;
87 uint8_t bCountryCode;
88 uint8_t bNumDescriptors;
90 PRE_PACK struct POST_PACK _HID_DESCRIPTOR_LIST {
91 uint8_t bDescriptorType;
92 uint16_t wDescriptorLength;
93 } DescriptorList[1];
94 } ;
96 typedef struct _HID_DESCRIPTOR HID_DESCRIPTOR;
97
98 #define HID_DESC_SIZE (sizeof(HID_DESCRIPTOR))
99
103 #define HID_REQUEST_GET_REPORT 0x01
104 #define HID_REQUEST_GET_IDLE 0x02
105 #define HID_REQUEST_GET_PROTOCOL 0x03
106 #define HID_REQUEST_SET_REPORT 0x09
107 #define HID_REQUEST_SET_IDLE 0x0A
108 #define HID_REQUEST_SET_PROTOCOL 0x0B
109
114 #define HID_REPORT_INPUT 0x01
115 #define HID_REPORT_OUTPUT 0x02
116 #define HID_REPORT_FEATURE 0x03
117
123 #define HID_USAGE_PAGE_UNDEFINED 0x00
124 #define HID_USAGE_PAGE_GENERIC 0x01
125 #define HID_USAGE_PAGE_SIMULATION 0x02
126 #define HID_USAGE_PAGE_VR 0x03
127 #define HID_USAGE_PAGE_SPORT 0x04
128 #define HID_USAGE_PAGE_GAME 0x05
129 #define HID_USAGE_PAGE_DEV_CONTROLS 0x06
130 #define HID_USAGE_PAGE_KEYBOARD 0x07
131 #define HID_USAGE_PAGE_LED 0x08
132 #define HID_USAGE_PAGE_BUTTON 0x09
133 #define HID_USAGE_PAGE_ORDINAL 0x0A
134 #define HID_USAGE_PAGE_TELEPHONY 0x0B
135 #define HID_USAGE_PAGE_CONSUMER 0x0C
136 #define HID_USAGE_PAGE_DIGITIZER 0x0D
137 #define HID_USAGE_PAGE_UNICODE 0x10
138 #define HID_USAGE_PAGE_ALPHANUMERIC 0x14
139
145 #define HID_USAGE_GENERIC_POINTER 0x01
146 #define HID_USAGE_GENERIC_MOUSE 0x02
147 #define HID_USAGE_GENERIC_JOYSTICK 0x04
148 #define HID_USAGE_GENERIC_GAMEPAD 0x05
149 #define HID_USAGE_GENERIC_KEYBOARD 0x06
150 #define HID_USAGE_GENERIC_KEYPAD 0x07
151 #define HID_USAGE_GENERIC_X 0x30
152 #define HID_USAGE_GENERIC_Y 0x31
153 #define HID_USAGE_GENERIC_Z 0x32
154 #define HID_USAGE_GENERIC_RX 0x33
155 #define HID_USAGE_GENERIC_RY 0x34
156 #define HID_USAGE_GENERIC_RZ 0x35
157 #define HID_USAGE_GENERIC_SLIDER 0x36
158 #define HID_USAGE_GENERIC_DIAL 0x37
159 #define HID_USAGE_GENERIC_WHEEL 0x38
160 #define HID_USAGE_GENERIC_HATSWITCH 0x39
161 #define HID_USAGE_GENERIC_COUNTED_BUFFER 0x3A
162 #define HID_USAGE_GENERIC_BYTE_COUNT 0x3B
163 #define HID_USAGE_GENERIC_MOTION_WAKEUP 0x3C
164 #define HID_USAGE_GENERIC_VX 0x40
165 #define HID_USAGE_GENERIC_VY 0x41
166 #define HID_USAGE_GENERIC_VZ 0x42
167 #define HID_USAGE_GENERIC_VBRX 0x43
168 #define HID_USAGE_GENERIC_VBRY 0x44
169 #define HID_USAGE_GENERIC_VBRZ 0x45
170 #define HID_USAGE_GENERIC_VNO 0x46
171 #define HID_USAGE_GENERIC_SYSTEM_CTL 0x80
172 #define HID_USAGE_GENERIC_SYSCTL_POWER 0x81
173 #define HID_USAGE_GENERIC_SYSCTL_SLEEP 0x82
174 #define HID_USAGE_GENERIC_SYSCTL_WAKE 0x83
175 #define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU 0x84
176 #define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU 0x85
177 #define HID_USAGE_GENERIC_SYSCTL_APP_MENU 0x86
178 #define HID_USAGE_GENERIC_SYSCTL_HELP_MENU 0x87
179 #define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT 0x88
180 #define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT 0x89
181 #define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT 0x8A
182 #define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT 0x8B
183 #define HID_USAGE_GENERIC_SYSCTL_MENU_UP 0x8C
184 #define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN 0x8D
185
190 #define HID_USAGE_SIMULATION_RUDDER 0xBA
191 #define HID_USAGE_SIMULATION_THROTTLE 0xBB
192
194 /* Virtual Reality Controls Page (0x03) */
195 /* ... */
196
197 /* Sport Controls Page (0x04) */
198 /* ... */
199
200 /* Game Controls Page (0x05) */
201 /* ... */
202
203 /* Generic Device Controls Page (0x06) */
204 /* ... */
205
210 #define HID_USAGE_KEYBOARD_NOEVENT 0x00
211 #define HID_USAGE_KEYBOARD_ROLLOVER 0x01
212 #define HID_USAGE_KEYBOARD_POSTFAIL 0x02
213 #define HID_USAGE_KEYBOARD_UNDEFINED 0x03
214
216 #define HID_USAGE_KEYBOARD_aA 0x04
217 #define HID_USAGE_KEYBOARD_zZ 0x1D
218
220 #define HID_USAGE_KEYBOARD_ONE 0x1E
221 #define HID_USAGE_KEYBOARD_ZERO 0x27
222
223 #define HID_USAGE_KEYBOARD_RETURN 0x28
224 #define HID_USAGE_KEYBOARD_ESCAPE 0x29
225 #define HID_USAGE_KEYBOARD_DELETE 0x2A
226
228 #define HID_USAGE_KEYBOARD_F1 0x3A
229 #define HID_USAGE_KEYBOARD_F12 0x45
230
231 #define HID_USAGE_KEYBOARD_PRINT_SCREEN 0x46
232
234 #define HID_USAGE_KEYBOARD_LCTRL 0xE0
235 #define HID_USAGE_KEYBOARD_LSHFT 0xE1
236 #define HID_USAGE_KEYBOARD_LALT 0xE2
237 #define HID_USAGE_KEYBOARD_LGUI 0xE3
238 #define HID_USAGE_KEYBOARD_RCTRL 0xE4
239 #define HID_USAGE_KEYBOARD_RSHFT 0xE5
240 #define HID_USAGE_KEYBOARD_RALT 0xE6
241 #define HID_USAGE_KEYBOARD_RGUI 0xE7
242 #define HID_USAGE_KEYBOARD_SCROLL_LOCK 0x47
243 #define HID_USAGE_KEYBOARD_NUM_LOCK 0x53
244 #define HID_USAGE_KEYBOARD_CAPS_LOCK 0x39
245
247 /* ... */
248
252 #define HID_USAGE_LED_NUM_LOCK 0x01
253 #define HID_USAGE_LED_CAPS_LOCK 0x02
254 #define HID_USAGE_LED_SCROLL_LOCK 0x03
255 #define HID_USAGE_LED_COMPOSE 0x04
256 #define HID_USAGE_LED_KANA 0x05
257 #define HID_USAGE_LED_POWER 0x06
258 #define HID_USAGE_LED_SHIFT 0x07
259 #define HID_USAGE_LED_DO_NOT_DISTURB 0x08
260 #define HID_USAGE_LED_MUTE 0x09
261 #define HID_USAGE_LED_TONE_ENABLE 0x0A
262 #define HID_USAGE_LED_HIGH_CUT_FILTER 0x0B
263 #define HID_USAGE_LED_LOW_CUT_FILTER 0x0C
264 #define HID_USAGE_LED_EQUALIZER_ENABLE 0x0D
265 #define HID_USAGE_LED_SOUND_FIELD_ON 0x0E
266 #define HID_USAGE_LED_SURROUND_FIELD_ON 0x0F
267 #define HID_USAGE_LED_REPEAT 0x10
268 #define HID_USAGE_LED_STEREO 0x11
269 #define HID_USAGE_LED_SAMPLING_RATE_DETECT 0x12
270 #define HID_USAGE_LED_SPINNING 0x13
271 #define HID_USAGE_LED_CAV 0x14
272 #define HID_USAGE_LED_CLV 0x15
273 #define HID_USAGE_LED_RECORDING_FORMAT_DET 0x16
274 #define HID_USAGE_LED_OFF_HOOK 0x17
275 #define HID_USAGE_LED_RING 0x18
276 #define HID_USAGE_LED_MESSAGE_WAITING 0x19
277 #define HID_USAGE_LED_DATA_MODE 0x1A
278 #define HID_USAGE_LED_BATTERY_OPERATION 0x1B
279 #define HID_USAGE_LED_BATTERY_OK 0x1C
280 #define HID_USAGE_LED_BATTERY_LOW 0x1D
281 #define HID_USAGE_LED_SPEAKER 0x1E
282 #define HID_USAGE_LED_HEAD_SET 0x1F
283 #define HID_USAGE_LED_HOLD 0x20
284 #define HID_USAGE_LED_MICROPHONE 0x21
285 #define HID_USAGE_LED_COVERAGE 0x22
286 #define HID_USAGE_LED_NIGHT_MODE 0x23
287 #define HID_USAGE_LED_SEND_CALLS 0x24
288 #define HID_USAGE_LED_CALL_PICKUP 0x25
289 #define HID_USAGE_LED_CONFERENCE 0x26
290 #define HID_USAGE_LED_STAND_BY 0x27
291 #define HID_USAGE_LED_CAMERA_ON 0x28
292 #define HID_USAGE_LED_CAMERA_OFF 0x29
293 #define HID_USAGE_LED_ON_LINE 0x2A
294 #define HID_USAGE_LED_OFF_LINE 0x2B
295 #define HID_USAGE_LED_BUSY 0x2C
296 #define HID_USAGE_LED_READY 0x2D
297 #define HID_USAGE_LED_PAPER_OUT 0x2E
298 #define HID_USAGE_LED_PAPER_JAM 0x2F
299 #define HID_USAGE_LED_REMOTE 0x30
300 #define HID_USAGE_LED_FORWARD 0x31
301 #define HID_USAGE_LED_REVERSE 0x32
302 #define HID_USAGE_LED_STOP 0x33
303 #define HID_USAGE_LED_REWIND 0x34
304 #define HID_USAGE_LED_FAST_FORWARD 0x35
305 #define HID_USAGE_LED_PLAY 0x36
306 #define HID_USAGE_LED_PAUSE 0x37
307 #define HID_USAGE_LED_RECORD 0x38
308 #define HID_USAGE_LED_ERROR 0x39
309 #define HID_USAGE_LED_SELECTED_INDICATOR 0x3A
310 #define HID_USAGE_LED_IN_USE_INDICATOR 0x3B
311 #define HID_USAGE_LED_MULTI_MODE_INDICATOR 0x3C
312 #define HID_USAGE_LED_INDICATOR_ON 0x3D
313 #define HID_USAGE_LED_INDICATOR_FLASH 0x3E
314 #define HID_USAGE_LED_INDICATOR_SLOW_BLINK 0x3F
315 #define HID_USAGE_LED_INDICATOR_FAST_BLINK 0x40
316 #define HID_USAGE_LED_INDICATOR_OFF 0x41
317 #define HID_USAGE_LED_FLASH_ON_TIME 0x42
318 #define HID_USAGE_LED_SLOW_BLINK_ON_TIME 0x43
319 #define HID_USAGE_LED_SLOW_BLINK_OFF_TIME 0x44
320 #define HID_USAGE_LED_FAST_BLINK_ON_TIME 0x45
321 #define HID_USAGE_LED_FAST_BLINK_OFF_TIME 0x46
322 #define HID_USAGE_LED_INDICATOR_COLOR 0x47
323 #define HID_USAGE_LED_RED 0x48
324 #define HID_USAGE_LED_GREEN 0x49
325 #define HID_USAGE_LED_AMBER 0x4A
326 #define HID_USAGE_LED_GENERIC_INDICATOR 0x4B
327
329 /* Button Page (0x09)
330 */
331 /* There is no need to label these usages. */
332
333 /* Ordinal Page (0x0A)
334 */
335 /* There is no need to label these usages. */
336
340 #define HID_USAGE_TELEPHONY_PHONE 0x01
341 #define HID_USAGE_TELEPHONY_ANSWERING_MACHINE 0x02
342 #define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS 0x03
343 #define HID_USAGE_TELEPHONY_HANDSET 0x04
344 #define HID_USAGE_TELEPHONY_HEADSET 0x05
345 #define HID_USAGE_TELEPHONY_KEYPAD 0x06
346 #define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON 0x07
347
348 /* ... */
349
353 #define HID_USAGE_CONSUMER_CONTROL 0x01
354 #define HID_USAGE_CONSUMER_FAST_FORWARD 0xB3
355 #define HID_USAGE_CONSUMER_REWIND 0xB4
356 #define HID_USAGE_CONSUMER_PLAY_PAUSE 0xCD
357 #define HID_USAGE_CONSUMER_VOLUME_INCREMENT 0xE9
358 #define HID_USAGE_CONSUMER_VOLUME_DECREMENT 0xEA
359
360 /* ... */
361
362 /* and others ... */
363
364
369 #define HID_Input(x) 0x81,x
370 #define HID_Output(x) 0x91,x
371 #define HID_Feature(x) 0xB1,x
372 #define HID_Collection(x) 0xA1,x
373 #define HID_EndCollection 0xC0
374
376 #define HID_Data 0<<0
377 #define HID_Constant 1<<0
378 #define HID_Array 0<<1
379 #define HID_Variable 1<<1
380 #define HID_Absolute 0<<2
381 #define HID_Relative 1<<2
382 #define HID_NoWrap 0<<3
383 #define HID_Wrap 1<<3
384 #define HID_Linear 0<<4
385 #define HID_NonLinear 1<<4
386 #define HID_PreferredState 0<<5
387 #define HID_NoPreferred 1<<5
388 #define HID_NoNullPosition 0<<6
389 #define HID_NullState 1<<6
390 #define HID_NonVolatile 0<<7
391 #define HID_Volatile 1<<7
392
394 #define HID_Physical 0x00
395 #define HID_Application 0x01
396 #define HID_Logical 0x02
397 #define HID_Report 0x03
398 #define HID_NamedArray 0x04
399 #define HID_UsageSwitch 0x05
400 #define HID_UsageModifier 0x06
401
403 #define HID_UsagePage(x) 0x05,x
404 #define HID_UsagePageVendor(x) 0x06,x,0xFF
405 #define HID_LogicalMin(x) 0x15,x
406 #define HID_LogicalMinS(x) 0x16,(x&0xFF),((x>>8)&0xFF)
407 #define HID_LogicalMinL(x) 0x17,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
408 #define HID_LogicalMax(x) 0x25,x
409 #define HID_LogicalMaxS(x) 0x26,(x&0xFF),((x>>8)&0xFF)
410 #define HID_LogicalMaxL(x) 0x27,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
411 #define HID_PhysicalMin(x) 0x35,x
412 #define HID_PhysicalMinS(x) 0x36,(x&0xFF),((x>>8)&0xFF)
413 #define HID_PhysicalMinL(x) 0x37,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
414 #define HID_PhysicalMax(x) 0x45,x
415 #define HID_PhysicalMaxS(x) 0x46,(x&0xFF),((x>>8)&0xFF)
416 #define HID_PhysicalMaxL(x) 0x47,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
417 #define HID_UnitExponent(x) 0x55,x
418 #define HID_Unit(x) 0x65,x
419 #define HID_UnitS(x) 0x66,(x&0xFF),((x>>8)&0xFF)
420 #define HID_UnitL(x) 0x67,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
421 #define HID_ReportSize(x) 0x75,x
422 #define HID_ReportID(x) 0x85,x
423 #define HID_ReportCount(x) 0x95,x
424 #define HID_Push 0xA0
425 #define HID_Pop 0xB0
426
428 #define HID_Usage(x) 0x09,x
429 #define HID_UsageMin(x) 0x19,x
430 #define HID_UsageMax(x) 0x29,x
431
432 uint32_t CALLBACK_UsbdHid_Register_InterfaceDescriptor(void);
433 uint32_t CALLBACK_UsbdHid_Register_ReportDescriptor(uint8_t **dest);
434 uint32_t CALLBACK_UsbdHid_Register_ReportInBuffer(uint8_t **dest);
435 void CALLBACK_UsbdHid_SetReport(uint8_t **reportoutbuffer, uint32_t reportoutsize);
436 void CALLBACK_UsbdHid_SetReportChange(bool newstate);
437 bool CALLBACK_UsbdHid_IsReportChanged(void);
438
441 #endif /* __HID_H__ */