Line data Source code
1 1 : /*
2 : * Copyright (c) 2018 Intel Corporation
3 : * Copyright (c) 2018,2021 Nordic Semiconductor ASA
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 :
8 : /**
9 : * @file
10 : * @brief USB Human Interface Device (HID) common definitions header
11 : *
12 : * Header follows Device Class Definition for Human Interface Devices (HID)
13 : * Version 1.11 document (HID1_11-1.pdf).
14 : */
15 :
16 : #ifndef ZEPHYR_INCLUDE_USB_CLASS_HID_H_
17 : #define ZEPHYR_INCLUDE_USB_CLASS_HID_H_
18 :
19 : #ifdef __cplusplus
20 : extern "C" {
21 : #endif
22 :
23 : /**
24 : * @brief hid.h API
25 : * @defgroup usb_hid_definitions USB HID common definitions
26 : * @ingroup usb
27 : * @since 1.11
28 : * @version 1.0.0
29 : * @{
30 : */
31 :
32 : /**
33 : * @name USB HID types and values
34 : * @{
35 : */
36 :
37 : /** HID Specification release v1.11 */
38 1 : #define USB_HID_VERSION 0x0111
39 :
40 : /** USB HID Class HID descriptor type */
41 1 : #define USB_DESC_HID 0x21
42 : /** USB HID Class Report descriptor type */
43 1 : #define USB_DESC_HID_REPORT 0x22
44 : /** USB HID Class physical descriptor type */
45 1 : #define USB_DESC_HID_PHYSICAL 0x23
46 :
47 : /** USB HID Class GetReport bRequest value */
48 1 : #define USB_HID_GET_REPORT 0x01
49 : /** USB HID Class GetIdle bRequest value */
50 1 : #define USB_HID_GET_IDLE 0x02
51 : /** USB HID Class GetProtocol bRequest value */
52 1 : #define USB_HID_GET_PROTOCOL 0x03
53 : /** USB HID Class SetReport bRequest value */
54 1 : #define USB_HID_SET_REPORT 0x09
55 : /** USB HID Class SetIdle bRequest value */
56 1 : #define USB_HID_SET_IDLE 0x0A
57 : /** USB HID Class SetProtocol bRequest value */
58 1 : #define USB_HID_SET_PROTOCOL 0x0B
59 :
60 : /** USB HID Boot Interface Protocol (bInterfaceProtocol) Code None */
61 1 : #define HID_BOOT_IFACE_CODE_NONE 0
62 : /** USB HID Boot Interface Protocol (bInterfaceProtocol) Code Keyboard */
63 1 : #define HID_BOOT_IFACE_CODE_KEYBOARD 1
64 : /** USB HID Boot Interface Protocol (bInterfaceProtocol) Code Mouse */
65 1 : #define HID_BOOT_IFACE_CODE_MOUSE 2
66 :
67 : /** USB HID Class Boot protocol code */
68 1 : #define HID_PROTOCOL_BOOT 0
69 : /** USB HID Class Report protocol code */
70 1 : #define HID_PROTOCOL_REPORT 1
71 :
72 : /** HID Main item type */
73 1 : #define HID_ITEM_TYPE_MAIN 0x0
74 : /** HID Global item type */
75 1 : #define HID_ITEM_TYPE_GLOBAL 0x1
76 : /** HID Local item type */
77 1 : #define HID_ITEM_TYPE_LOCAL 0x2
78 :
79 : /** HID Input item tag */
80 1 : #define HID_ITEM_TAG_INPUT 0x8
81 : /** HID Output item tag */
82 1 : #define HID_ITEM_TAG_OUTPUT 0x9
83 : /** HID Collection item tag */
84 1 : #define HID_ITEM_TAG_COLLECTION 0xA
85 : /** HID Feature item tag */
86 1 : #define HID_ITEM_TAG_FEATURE 0xB
87 : /** HID End Collection item tag */
88 1 : #define HID_ITEM_TAG_COLLECTION_END 0xC
89 :
90 : /** HID Usage Page item tag */
91 1 : #define HID_ITEM_TAG_USAGE_PAGE 0x0
92 : /** HID Logical Minimum item tag */
93 1 : #define HID_ITEM_TAG_LOGICAL_MIN 0x1
94 : /** HID Logical Maximum item tag */
95 1 : #define HID_ITEM_TAG_LOGICAL_MAX 0x2
96 : /** HID Physical Minimum item tag */
97 1 : #define HID_ITEM_TAG_PHYSICAL_MIN 0x3
98 : /** HID Physical Maximum item tag */
99 1 : #define HID_ITEM_TAG_PHYSICAL_MAX 0x4
100 : /** HID Unit Exponent item tag */
101 1 : #define HID_ITEM_TAG_UNIT_EXPONENT 0x5
102 : /** HID Unit item tag */
103 1 : #define HID_ITEM_TAG_UNIT 0x6
104 : /** HID Report Size item tag */
105 1 : #define HID_ITEM_TAG_REPORT_SIZE 0x7
106 : /** HID Report ID item tag */
107 1 : #define HID_ITEM_TAG_REPORT_ID 0x8
108 : /** HID Report count item tag */
109 1 : #define HID_ITEM_TAG_REPORT_COUNT 0x9
110 :
111 : /** HID Usage item tag */
112 1 : #define HID_ITEM_TAG_USAGE 0x0
113 : /** HID Usage Minimum item tag */
114 1 : #define HID_ITEM_TAG_USAGE_MIN 0x1
115 : /** HID Usage Maximum item tag */
116 1 : #define HID_ITEM_TAG_USAGE_MAX 0x2
117 :
118 : /** Physical collection type */
119 1 : #define HID_COLLECTION_PHYSICAL 0x00
120 : /** Application collection type */
121 1 : #define HID_COLLECTION_APPLICATION 0x01
122 : /** Logical collection type */
123 1 : #define HID_COLLECTION_LOGICAL 0x02
124 : /** Report collection type */
125 1 : #define HID_COLLECTION_REPORT 0x03
126 : /** Named Array collection type */
127 1 : #define HID_COLLECTION_NAMED_ARRAY 0x04
128 : /** Usage Switch collection type */
129 1 : #define HID_COLLECTION_USAGE_SWITCH 0x05
130 : /** Modifier collection type */
131 1 : #define HID_COLLECTION_MODIFIER 0x06
132 :
133 :
134 : /* Usage page and IDs from Universal Serial Bus HID Usage Tables */
135 :
136 : /** HID Generic Desktop Controls Usage page */
137 1 : #define HID_USAGE_GEN_DESKTOP 0x01
138 : /** HID Keyboard Usage page */
139 1 : #define HID_USAGE_GEN_KEYBOARD 0x07
140 : /** HID LEDs Usage page */
141 1 : #define HID_USAGE_GEN_LEDS 0x08
142 : /** HID Button Usage page */
143 1 : #define HID_USAGE_GEN_BUTTON 0x09
144 :
145 : /** HID Generic Desktop Undefined Usage ID */
146 1 : #define HID_USAGE_GEN_DESKTOP_UNDEFINED 0x00
147 : /** HID Generic Desktop Pointer Usage ID */
148 1 : #define HID_USAGE_GEN_DESKTOP_POINTER 0x01
149 : /** HID Generic Desktop Mouse Usage ID */
150 1 : #define HID_USAGE_GEN_DESKTOP_MOUSE 0x02
151 : /** HID Generic Desktop Joystick Usage ID */
152 1 : #define HID_USAGE_GEN_DESKTOP_JOYSTICK 0x04
153 : /** HID Generic Desktop Gamepad Usage ID */
154 1 : #define HID_USAGE_GEN_DESKTOP_GAMEPAD 0x05
155 : /** HID Generic Desktop Keyboard Usage ID */
156 1 : #define HID_USAGE_GEN_DESKTOP_KEYBOARD 0x06
157 : /** HID Generic Desktop Keypad Usage ID */
158 1 : #define HID_USAGE_GEN_DESKTOP_KEYPAD 0x07
159 : /** HID Generic Desktop X Usage ID */
160 1 : #define HID_USAGE_GEN_DESKTOP_X 0x30
161 : /** HID Generic Desktop Y Usage ID */
162 1 : #define HID_USAGE_GEN_DESKTOP_Y 0x31
163 : /** HID Generic Desktop Wheel Usage ID */
164 1 : #define HID_USAGE_GEN_DESKTOP_WHEEL 0x38
165 :
166 : /**
167 : * @}
168 : */
169 :
170 : /**
171 : * @defgroup usb_hid_items USB HID Item helpers
172 : * @{
173 : */
174 :
175 : /**
176 : * @brief Define HID short item.
177 : *
178 : * @param bTag Item tag
179 : * @param bType Item type
180 : * @param bSize Item data size
181 : * @return HID Input item
182 : */
183 1 : #define HID_ITEM(bTag, bType, bSize) (((bTag & 0xF) << 4) | \
184 : ((bType & 0x3) << 2) | (bSize & 0x3))
185 :
186 : /**
187 : * @brief Define HID Input item with the data length of one byte.
188 : *
189 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
190 : * @ref HID_KEYBOARD_REPORT_DESC()
191 : *
192 : * @param a Input item data
193 : * @return HID Input item
194 : */
195 1 : #define HID_INPUT(a) \
196 : HID_ITEM(HID_ITEM_TAG_INPUT, HID_ITEM_TYPE_MAIN, 1), a
197 :
198 : /**
199 : * @brief Define HID Output item with the data length of one byte.
200 : *
201 : * For usage examples, see @ref HID_KEYBOARD_REPORT_DESC()
202 : *
203 : * @param a Output item data
204 : * @return HID Output item
205 : */
206 1 : #define HID_OUTPUT(a) \
207 : HID_ITEM(HID_ITEM_TAG_OUTPUT, HID_ITEM_TYPE_MAIN, 1), a
208 :
209 : /**
210 : * @brief Define HID Feature item with the data length of one byte.
211 : *
212 : * @param a Feature item data
213 : * @return HID Feature item
214 : */
215 1 : #define HID_FEATURE(a) \
216 : HID_ITEM(HID_ITEM_TAG_FEATURE, HID_ITEM_TYPE_MAIN, 1), a
217 :
218 : /**
219 : * @brief Define HID Collection item with the data length of one byte.
220 : *
221 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
222 : * @ref HID_KEYBOARD_REPORT_DESC()
223 : *
224 : * @param a Collection item data
225 : * @return HID Collection item
226 : */
227 1 : #define HID_COLLECTION(a) \
228 : HID_ITEM(HID_ITEM_TAG_COLLECTION, HID_ITEM_TYPE_MAIN, 1), a
229 :
230 : /**
231 : * @brief Define HID End Collection (non-data) item.
232 : *
233 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
234 : * @ref HID_KEYBOARD_REPORT_DESC()
235 : *
236 : * @return HID End Collection item
237 : */
238 1 : #define HID_END_COLLECTION \
239 : HID_ITEM(HID_ITEM_TAG_COLLECTION_END, HID_ITEM_TYPE_MAIN, 0)
240 :
241 : /**
242 : * @brief Define HID Usage Page item.
243 : *
244 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
245 : * @ref HID_KEYBOARD_REPORT_DESC()
246 : *
247 : * @param page Usage Page
248 : * @return HID Usage Page item
249 : */
250 1 : #define HID_USAGE_PAGE(page) \
251 : HID_ITEM(HID_ITEM_TAG_USAGE_PAGE, HID_ITEM_TYPE_GLOBAL, 1), page
252 :
253 : /**
254 : * @brief Define HID Logical Minimum item with the data length of one byte.
255 : *
256 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
257 : * @ref HID_KEYBOARD_REPORT_DESC()
258 : *
259 : * @param a Minimum value in logical units
260 : * @return HID Logical Minimum item
261 : */
262 1 : #define HID_LOGICAL_MIN8(a) \
263 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a
264 :
265 : /**
266 : * @brief Define HID Logical Maximum item with the data length of one byte.
267 : *
268 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
269 : * @ref HID_KEYBOARD_REPORT_DESC()
270 : *
271 : * @param a Maximum value in logical units
272 : * @return HID Logical Maximum item
273 : */
274 1 : #define HID_LOGICAL_MAX8(a) \
275 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a
276 :
277 : /**
278 : * @brief Define HID Logical Minimum item with the data length of two bytes.
279 : *
280 : * @param a Minimum value lower byte
281 : * @param b Minimum value higher byte
282 : * @return HID Logical Minimum item
283 : */
284 1 : #define HID_LOGICAL_MIN16(a, b) \
285 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 2), a, b
286 :
287 : /**
288 : * @brief Define HID Logical Maximum item with the data length of two bytes.
289 : *
290 : * @param a Minimum value lower byte
291 : * @param b Minimum value higher byte
292 : * @return HID Logical Maximum item
293 : */
294 1 : #define HID_LOGICAL_MAX16(a, b) \
295 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 2), a, b
296 :
297 : /**
298 : * @brief Define HID Logical Minimum item with the data length of four bytes.
299 : *
300 : * @param a Minimum value lower byte
301 : * @param b Minimum value low middle byte
302 : * @param c Minimum value high middle byte
303 : * @param d Minimum value higher byte
304 : * @return HID Logical Minimum item
305 : */
306 1 : #define HID_LOGICAL_MIN32(a, b, c, d) \
307 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
308 :
309 : /**
310 : * @brief Define HID Logical Maximum item with the data length of four bytes.
311 : *
312 : * @param a Minimum value lower byte
313 : * @param b Minimum value low middle byte
314 : * @param c Minimum value high middle byte
315 : * @param d Minimum value higher byte
316 : * @return HID Logical Maximum item
317 : */
318 1 : #define HID_LOGICAL_MAX32(a, b, c, d) \
319 : HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
320 :
321 : /**
322 : * @brief Define HID Report Size item with the data length of one byte.
323 : *
324 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
325 : * @ref HID_KEYBOARD_REPORT_DESC()
326 : *
327 : * @param size Report field size in bits
328 : * @return HID Report Size item
329 : */
330 1 : #define HID_REPORT_SIZE(size) \
331 : HID_ITEM(HID_ITEM_TAG_REPORT_SIZE, HID_ITEM_TYPE_GLOBAL, 1), size
332 :
333 : /**
334 : * @brief Define HID Report ID item with the data length of one byte.
335 : *
336 : * @param id Report ID
337 : * @return HID Report ID item
338 : */
339 1 : #define HID_REPORT_ID(id) \
340 : HID_ITEM(HID_ITEM_TAG_REPORT_ID, HID_ITEM_TYPE_GLOBAL, 1), id
341 :
342 : /**
343 : * @brief Define HID Report Count item with the data length of one byte.
344 : *
345 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
346 : * @ref HID_KEYBOARD_REPORT_DESC()
347 : *
348 : * @param count Number of data fields included in the report
349 : * @return HID Report Count item
350 : */
351 1 : #define HID_REPORT_COUNT(count) \
352 : HID_ITEM(HID_ITEM_TAG_REPORT_COUNT, HID_ITEM_TYPE_GLOBAL, 1), count
353 :
354 : /**
355 : * @brief Define HID Usage Index item with the data length of one byte.
356 : *
357 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
358 : * @ref HID_KEYBOARD_REPORT_DESC()
359 : *
360 : * @param idx Number of data fields included in the report
361 : * @return HID Usage Index item
362 : */
363 1 : #define HID_USAGE(idx) \
364 : HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx
365 :
366 : /**
367 : * @brief Define HID Usage Minimum item with the data length of one byte.
368 : *
369 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
370 : * @ref HID_KEYBOARD_REPORT_DESC()
371 : *
372 : * @param a Starting Usage
373 : * @return HID Usage Minimum item
374 : */
375 1 : #define HID_USAGE_MIN8(a) \
376 : HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 1), a
377 :
378 : /**
379 : * @brief Define HID Usage Maximum item with the data length of one byte.
380 : *
381 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
382 : * @ref HID_KEYBOARD_REPORT_DESC()
383 : *
384 : * @param a Ending Usage
385 : * @return HID Usage Maximum item
386 : */
387 1 : #define HID_USAGE_MAX8(a) \
388 : HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 1), a
389 :
390 : /**
391 : * @brief Define HID Usage Minimum item with the data length of two bytes.
392 : *
393 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
394 : * @ref HID_KEYBOARD_REPORT_DESC()
395 : *
396 : * @param a Starting Usage lower byte
397 : * @param b Starting Usage higher byte
398 : * @return HID Usage Minimum item
399 : */
400 1 : #define HID_USAGE_MIN16(a, b) \
401 : HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 2), a, b
402 :
403 : /**
404 : * @brief Define HID Usage Maximum item with the data length of two bytes.
405 : *
406 : * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
407 : * @ref HID_KEYBOARD_REPORT_DESC()
408 : *
409 : * @param a Ending Usage lower byte
410 : * @param b Ending Usage higher byte
411 : * @return HID Usage Maximum item
412 : */
413 1 : #define HID_USAGE_MAX16(a, b) \
414 : HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b
415 :
416 : /**
417 : * @}
418 : */
419 :
420 : /**
421 : * @defgroup usb_hid_mk_report_desc Mouse and keyboard report descriptors
422 : * @{
423 : */
424 :
425 : /**
426 : * @brief Simple HID mouse report descriptor for n button mouse.
427 : *
428 : * @param bcnt Button count. Allowed values from 1 to 8.
429 : */
430 1 : #define HID_MOUSE_REPORT_DESC(bcnt) { \
431 : HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
432 : HID_USAGE(HID_USAGE_GEN_DESKTOP_MOUSE), \
433 : HID_COLLECTION(HID_COLLECTION_APPLICATION), \
434 : HID_USAGE(HID_USAGE_GEN_DESKTOP_POINTER), \
435 : HID_COLLECTION(HID_COLLECTION_PHYSICAL), \
436 : /* Bits used for button signalling */ \
437 : HID_USAGE_PAGE(HID_USAGE_GEN_BUTTON), \
438 : HID_USAGE_MIN8(1), \
439 : HID_USAGE_MAX8(bcnt), \
440 : HID_LOGICAL_MIN8(0), \
441 : HID_LOGICAL_MAX8(1), \
442 : HID_REPORT_SIZE(1), \
443 : HID_REPORT_COUNT(bcnt), \
444 : /* HID_INPUT (Data,Var,Abs) */ \
445 : HID_INPUT(0x02), \
446 : /* Unused bits */ \
447 : HID_REPORT_SIZE(8 - bcnt), \
448 : HID_REPORT_COUNT(1), \
449 : /* HID_INPUT (Cnst,Ary,Abs) */ \
450 : HID_INPUT(1), \
451 : /* X and Y axis, scroll */ \
452 : HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
453 : HID_USAGE(HID_USAGE_GEN_DESKTOP_X), \
454 : HID_USAGE(HID_USAGE_GEN_DESKTOP_Y), \
455 : HID_USAGE(HID_USAGE_GEN_DESKTOP_WHEEL), \
456 : HID_LOGICAL_MIN8(-127), \
457 : HID_LOGICAL_MAX8(127), \
458 : HID_REPORT_SIZE(8), \
459 : HID_REPORT_COUNT(3), \
460 : /* HID_INPUT (Data,Var,Rel) */ \
461 : HID_INPUT(0x06), \
462 : HID_END_COLLECTION, \
463 : HID_END_COLLECTION, \
464 : }
465 :
466 : /**
467 : * @brief Simple HID keyboard report descriptor.
468 : */
469 1 : #define HID_KEYBOARD_REPORT_DESC() { \
470 : HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
471 : HID_USAGE(HID_USAGE_GEN_DESKTOP_KEYBOARD), \
472 : HID_COLLECTION(HID_COLLECTION_APPLICATION), \
473 : HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP_KEYPAD), \
474 : /* HID_USAGE_MINIMUM(Keyboard LeftControl) */ \
475 : HID_USAGE_MIN8(0xE0), \
476 : /* HID_USAGE_MAXIMUM(Keyboard Right GUI) */ \
477 : HID_USAGE_MAX8(0xE7), \
478 : HID_LOGICAL_MIN8(0), \
479 : HID_LOGICAL_MAX8(1), \
480 : HID_REPORT_SIZE(1), \
481 : HID_REPORT_COUNT(8), \
482 : /* HID_INPUT(Data,Var,Abs) */ \
483 : HID_INPUT(0x02), \
484 : HID_REPORT_SIZE(8), \
485 : HID_REPORT_COUNT(1), \
486 : /* HID_INPUT(Cnst,Var,Abs) */ \
487 : HID_INPUT(0x03), \
488 : HID_REPORT_SIZE(1), \
489 : HID_REPORT_COUNT(5), \
490 : HID_USAGE_PAGE(HID_USAGE_GEN_LEDS), \
491 : /* HID_USAGE_MINIMUM(Num Lock) */ \
492 : HID_USAGE_MIN8(1), \
493 : /* HID_USAGE_MAXIMUM(Kana) */ \
494 : HID_USAGE_MAX8(5), \
495 : /* HID_OUTPUT(Data,Var,Abs) */ \
496 : HID_OUTPUT(0x02), \
497 : HID_REPORT_SIZE(3), \
498 : HID_REPORT_COUNT(1), \
499 : /* HID_OUTPUT(Cnst,Var,Abs) */ \
500 : HID_OUTPUT(0x03), \
501 : HID_REPORT_SIZE(8), \
502 : HID_REPORT_COUNT(6), \
503 : HID_LOGICAL_MIN8(0), \
504 : HID_LOGICAL_MAX8(101), \
505 : HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP_KEYPAD), \
506 : /* HID_USAGE_MIN8(Reserved) */ \
507 : HID_USAGE_MIN8(0), \
508 : /* HID_USAGE_MAX8(Keyboard Application) */ \
509 : HID_USAGE_MAX8(101), \
510 : /* HID_INPUT (Data,Ary,Abs) */ \
511 : HID_INPUT(0x00), \
512 : HID_END_COLLECTION, \
513 : }
514 :
515 : /**
516 : * @brief HID keyboard button codes.
517 : */
518 0 : enum hid_kbd_code {
519 : HID_KEY_A = 4,
520 : HID_KEY_B = 5,
521 : HID_KEY_C = 6,
522 : HID_KEY_D = 7,
523 : HID_KEY_E = 8,
524 : HID_KEY_F = 9,
525 : HID_KEY_G = 10,
526 : HID_KEY_H = 11,
527 : HID_KEY_I = 12,
528 : HID_KEY_J = 13,
529 : HID_KEY_K = 14,
530 : HID_KEY_L = 15,
531 : HID_KEY_M = 16,
532 : HID_KEY_N = 17,
533 : HID_KEY_O = 18,
534 : HID_KEY_P = 19,
535 : HID_KEY_Q = 20,
536 : HID_KEY_R = 21,
537 : HID_KEY_S = 22,
538 : HID_KEY_T = 23,
539 : HID_KEY_U = 24,
540 : HID_KEY_V = 25,
541 : HID_KEY_W = 26,
542 : HID_KEY_X = 27,
543 : HID_KEY_Y = 28,
544 : HID_KEY_Z = 29,
545 : HID_KEY_1 = 30,
546 : HID_KEY_2 = 31,
547 : HID_KEY_3 = 32,
548 : HID_KEY_4 = 33,
549 : HID_KEY_5 = 34,
550 : HID_KEY_6 = 35,
551 : HID_KEY_7 = 36,
552 : HID_KEY_8 = 37,
553 : HID_KEY_9 = 38,
554 : HID_KEY_0 = 39,
555 : HID_KEY_ENTER = 40,
556 : HID_KEY_ESC = 41,
557 : HID_KEY_BACKSPACE = 42,
558 : HID_KEY_TAB = 43,
559 : HID_KEY_SPACE = 44,
560 : HID_KEY_MINUS = 45,
561 : HID_KEY_EQUAL = 46,
562 : HID_KEY_LEFTBRACE = 47,
563 : HID_KEY_RIGHTBRACE = 48,
564 : HID_KEY_BACKSLASH = 49,
565 : HID_KEY_HASH = 50, /* Non-US # and ~ */
566 : HID_KEY_SEMICOLON = 51,
567 : HID_KEY_APOSTROPHE = 52,
568 : HID_KEY_GRAVE = 53,
569 : HID_KEY_COMMA = 54,
570 : HID_KEY_DOT = 55,
571 : HID_KEY_SLASH = 56,
572 : HID_KEY_CAPSLOCK = 57,
573 : HID_KEY_F1 = 58,
574 : HID_KEY_F2 = 59,
575 : HID_KEY_F3 = 60,
576 : HID_KEY_F4 = 61,
577 : HID_KEY_F5 = 62,
578 : HID_KEY_F6 = 63,
579 : HID_KEY_F7 = 64,
580 : HID_KEY_F8 = 65,
581 : HID_KEY_F9 = 66,
582 : HID_KEY_F10 = 67,
583 : HID_KEY_F11 = 68,
584 : HID_KEY_F12 = 69,
585 : HID_KEY_SYSRQ = 70, /* PRINTSCREEN */
586 : HID_KEY_SCROLLLOCK = 71,
587 : HID_KEY_PAUSE = 72,
588 : HID_KEY_INSERT = 73,
589 : HID_KEY_HOME = 74,
590 : HID_KEY_PAGEUP = 75,
591 : HID_KEY_DELETE = 76,
592 : HID_KEY_END = 77,
593 : HID_KEY_PAGEDOWN = 78,
594 : HID_KEY_RIGHT = 79,
595 : HID_KEY_LEFT = 80,
596 : HID_KEY_DOWN = 81,
597 : HID_KEY_UP = 82,
598 : HID_KEY_NUMLOCK = 83,
599 : HID_KEY_KPSLASH = 84, /* NUMPAD DIVIDE */
600 : HID_KEY_KPASTERISK = 85, /* NUMPAD MULTIPLY */
601 : HID_KEY_KPMINUS = 86,
602 : HID_KEY_KPPLUS = 87,
603 : HID_KEY_KPENTER = 88,
604 : HID_KEY_KP_1 = 89,
605 : HID_KEY_KP_2 = 90,
606 : HID_KEY_KP_3 = 91,
607 : HID_KEY_KP_4 = 92,
608 : HID_KEY_KP_5 = 93,
609 : HID_KEY_KP_6 = 94,
610 : HID_KEY_KP_7 = 95,
611 : HID_KEY_KP_8 = 96,
612 : HID_KEY_KP_9 = 97,
613 : HID_KEY_KP_0 = 98,
614 : };
615 :
616 : /**
617 : * @brief HID keyboard modifiers.
618 : */
619 0 : enum hid_kbd_modifier {
620 : HID_KBD_MODIFIER_NONE = 0x00,
621 : HID_KBD_MODIFIER_LEFT_CTRL = 0x01,
622 : HID_KBD_MODIFIER_LEFT_SHIFT = 0x02,
623 : HID_KBD_MODIFIER_LEFT_ALT = 0x04,
624 : HID_KBD_MODIFIER_LEFT_UI = 0x08,
625 : HID_KBD_MODIFIER_RIGHT_CTRL = 0x10,
626 : HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20,
627 : HID_KBD_MODIFIER_RIGHT_ALT = 0x40,
628 : HID_KBD_MODIFIER_RIGHT_UI = 0x80,
629 : };
630 :
631 : /**
632 : * @brief HID keyboard LEDs.
633 : */
634 0 : enum hid_kbd_led {
635 : HID_KBD_LED_NUM_LOCK = 0x01,
636 : HID_KBD_LED_CAPS_LOCK = 0x02,
637 : HID_KBD_LED_SCROLL_LOCK = 0x04,
638 : HID_KBD_LED_COMPOSE = 0x08,
639 : HID_KBD_LED_KANA = 0x10,
640 : };
641 :
642 : /**
643 : * @}
644 : */
645 :
646 : /**
647 : * @}
648 : */
649 :
650 : #ifdef __cplusplus
651 : }
652 : #endif
653 :
654 : #endif /* ZEPHYR_INCLUDE_USB_CLASS_HID_H_ */
|