diff options
| -rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 1750afc562..d09b2f19b7 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
| @@ -230,10 +230,6 @@ static void send_keyboard(report_keyboard_t *report) { | |||
| 230 | keyboard_report_sent = *report; | 230 | keyboard_report_sent = *report; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | static void send_nkro(report_nkro_t *report) { | ||
| 234 | // TODO: Implement NKRO | ||
| 235 | } | ||
| 236 | |||
| 237 | #ifndef KEYBOARD_SHARED_EP | 233 | #ifndef KEYBOARD_SHARED_EP |
| 238 | # define MOUSE_IN_EPNUM 3 | 234 | # define MOUSE_IN_EPNUM 3 |
| 239 | # define SHARED_IN_EPNUM 3 | 235 | # define SHARED_IN_EPNUM 3 |
| @@ -242,6 +238,12 @@ static void send_nkro(report_nkro_t *report) { | |||
| 242 | # define SHARED_IN_EPNUM 1 | 238 | # define SHARED_IN_EPNUM 1 |
| 243 | #endif | 239 | #endif |
| 244 | 240 | ||
| 241 | static void send_nkro(report_nkro_t *report) { | ||
| 242 | #ifdef NKRO_ENABLE | ||
| 243 | send_report(3, report, sizeof(report_nkro_t)); | ||
| 244 | #endif | ||
| 245 | } | ||
| 246 | |||
| 245 | static void send_mouse(report_mouse_t *report) { | 247 | static void send_mouse(report_mouse_t *report) { |
| 246 | #ifdef MOUSE_ENABLE | 248 | #ifdef MOUSE_ENABLE |
| 247 | send_report(MOUSE_IN_EPNUM, report, sizeof(report_mouse_t)); | 249 | send_report(MOUSE_IN_EPNUM, report, sizeof(report_mouse_t)); |
| @@ -433,6 +435,45 @@ const PROGMEM uchar shared_hid_report[] = { | |||
| 433 | # define SHARED_REPORT_STARTED | 435 | # define SHARED_REPORT_STARTED |
| 434 | #endif | 436 | #endif |
| 435 | 437 | ||
| 438 | #ifdef NKRO_ENABLE | ||
| 439 | // NKRO report descriptor | ||
| 440 | 0x05, 0x01, // Usage Page (Generic Desktop) | ||
| 441 | 0x09, 0x06, // Usage (Keyboard) | ||
| 442 | 0xA1, 0x01, // Collection (Application) | ||
| 443 | 0x85, REPORT_ID_NKRO, // Report ID | ||
| 444 | // Modifiers (8 bits) | ||
| 445 | 0x05, 0x07, // Usage Page (Keyboard/Keypad) | ||
| 446 | 0x19, 0xE0, // Usage Minimum (Keyboard Left Control) | ||
| 447 | 0x29, 0xE7, // Usage Maximum (Keyboard Right GUI) | ||
| 448 | 0x15, 0x00, // Logical Minimum (0) | ||
| 449 | 0x25, 0x01, // Logical Maximum (1) | ||
| 450 | 0x95, 0x08, // Report Count (8) | ||
| 451 | 0x75, 0x01, // Report Size (1) | ||
| 452 | 0x81, 0x02, // Input (Data, Variable, Absolute) | ||
| 453 | // Keycodes | ||
| 454 | 0x05, 0x07, // Usage Page (Keyboard/Keypad) | ||
| 455 | 0x19, 0x00, // Usage Minimum (0) | ||
| 456 | 0x29, NKRO_REPORT_BITS * 8 - 1, // Usage Maximum | ||
| 457 | 0x15, 0x00, // Logical Minimum (0) | ||
| 458 | 0x25, 0x01, // Logical Maximum (1) | ||
| 459 | 0x95, NKRO_REPORT_BITS * 8, // Report Count | ||
| 460 | 0x75, 0x01, // Report Size (1) | ||
| 461 | 0x81, 0x02, // Input (Data, Variable, Absolute) | ||
| 462 | |||
| 463 | // Status LEDs (5 bits) | ||
| 464 | 0x05, 0x08, // Usage Page (LED) | ||
| 465 | 0x19, 0x01, // Usage Minimum (Num Lock) | ||
| 466 | 0x29, 0x05, // Usage Maximum (Kana) | ||
| 467 | 0x95, 0x05, // Report Count (5) | ||
| 468 | 0x75, 0x01, // Report Size (1) | ||
| 469 | 0x91, 0x02, // Output (Data, Variable, Absolute) | ||
| 470 | // LED padding (3 bits) | ||
| 471 | 0x95, 0x01, // Report Count (1) | ||
| 472 | 0x75, 0x03, // Report Size (3) | ||
| 473 | 0x91, 0x03, // Output (Constant) | ||
| 474 | 0xC0, // End Collection | ||
| 475 | #endif | ||
| 476 | |||
| 436 | #ifdef MOUSE_ENABLE | 477 | #ifdef MOUSE_ENABLE |
| 437 | // Mouse report descriptor | 478 | // Mouse report descriptor |
| 438 | 0x05, 0x01, // Usage Page (Generic Desktop) | 479 | 0x05, 0x01, // Usage Page (Generic Desktop) |
