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