diff options
Diffstat (limited to 'tmk_core/protocol/vusb')
-rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 485b20c90..e4db5d065 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
@@ -226,8 +226,9 @@ static void send_keyboard(report_keyboard_t *report); | |||
226 | static void send_mouse(report_mouse_t *report); | 226 | static void send_mouse(report_mouse_t *report); |
227 | static void send_system(uint16_t data); | 227 | static void send_system(uint16_t data); |
228 | static void send_consumer(uint16_t data); | 228 | static void send_consumer(uint16_t data); |
229 | static void send_programmable_button(uint32_t data); | ||
229 | 230 | ||
230 | static host_driver_t driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer}; | 231 | static host_driver_t driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button}; |
231 | 232 | ||
232 | host_driver_t *vusb_driver(void) { return &driver; } | 233 | host_driver_t *vusb_driver(void) { return &driver; } |
233 | 234 | ||
@@ -296,6 +297,19 @@ void send_digitizer(report_digitizer_t *report) { | |||
296 | #ifdef DIGITIZER_ENABLE | 297 | #ifdef DIGITIZER_ENABLE |
297 | if (usbInterruptIsReadyShared()) { | 298 | if (usbInterruptIsReadyShared()) { |
298 | usbSetInterruptShared((void *)report, sizeof(report_digitizer_t)); | 299 | usbSetInterruptShared((void *)report, sizeof(report_digitizer_t)); |
300 | #endif | ||
301 | } | ||
302 | |||
303 | static void send_programmable_button(uint32_t data) { | ||
304 | #ifdef PROGRAMMABLE_BUTTON_ENABLE | ||
305 | static report_programmable_button_t report = { | ||
306 | .report_id = REPORT_ID_PROGRAMMABLE_BUTTON, | ||
307 | }; | ||
308 | |||
309 | report.usage = data; | ||
310 | |||
311 | if (usbInterruptIsReadyShared()) { | ||
312 | usbSetInterruptShared((void *)&report, sizeof(report)); | ||
299 | } | 313 | } |
300 | #endif | 314 | #endif |
301 | } | 315 | } |
@@ -558,6 +572,26 @@ const PROGMEM uchar shared_hid_report[] = { | |||
558 | 0xC0 // End Collection | 572 | 0xC0 // End Collection |
559 | #endif | 573 | #endif |
560 | 574 | ||
575 | #ifdef PROGRAMMABLE_BUTTON_ENABLE | ||
576 | // Programmable buttons report descriptor | ||
577 | 0x05, 0x0C, // Usage Page (Consumer) | ||
578 | 0x09, 0x01, // Usage (Consumer Control) | ||
579 | 0xA1, 0x01, // Collection (Application) | ||
580 | 0x85, REPORT_ID_PROGRAMMABLE_BUTTON, // Report ID | ||
581 | 0x09, 0x03, // Usage (Programmable Buttons) | ||
582 | 0xA1, 0x04, // Collection (Named Array) | ||
583 | 0x05, 0x09, // Usage Page (Button) | ||
584 | 0x19, 0x01, // Usage Minimum (Button 1) | ||
585 | 0x29, 0x20, // Usage Maximum (Button 32) | ||
586 | 0x15, 0x00, // Logical Minimum (0) | ||
587 | 0x25, 0x01, // Logical Maximum (1) | ||
588 | 0x95, 0x20, // Report Count (32) | ||
589 | 0x75, 0x01, // Report Size (1) | ||
590 | 0x81, 0x02, // Input (Data, Variable, Absolute) | ||
591 | 0xC0, // End Collection | ||
592 | 0xC0 // End Collection | ||
593 | #endif | ||
594 | |||
561 | #ifdef SHARED_EP_ENABLE | 595 | #ifdef SHARED_EP_ENABLE |
562 | }; | 596 | }; |
563 | #endif | 597 | #endif |