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