aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/lufa/lufa.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/lufa/lufa.c')
-rw-r--r--tmk_core/protocol/lufa/lufa.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 4ac079e16..8ddb8b1c4 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -142,9 +142,7 @@ static void send_keyboard(report_keyboard_t *report);
142static void send_mouse(report_mouse_t *report); 142static void send_mouse(report_mouse_t *report);
143static void send_system(uint16_t data); 143static void send_system(uint16_t data);
144static void send_consumer(uint16_t data); 144static void send_consumer(uint16_t data);
145host_driver_t lufa_driver = { 145host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer};
146 keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer,
147};
148 146
149#ifdef VIRTSER_ENABLE 147#ifdef VIRTSER_ENABLE
150// clang-format off 148// clang-format off
@@ -525,6 +523,11 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
525 /* Setup joystick endpoint */ 523 /* Setup joystick endpoint */
526 ConfigSuccess &= Endpoint_ConfigureEndpoint((JOYSTICK_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1); 524 ConfigSuccess &= Endpoint_ConfigureEndpoint((JOYSTICK_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1);
527#endif 525#endif
526
527#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP)
528 /* Setup digitizer endpoint */
529 ConfigSuccess &= Endpoint_ConfigureEndpoint((DIGITIZER_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, DIGITIZER_EPSIZE, 1);
530#endif
528} 531}
529 532
530/* FIXME: Expose this table in the docs somehow 533/* FIXME: Expose this table in the docs somehow
@@ -983,6 +986,23 @@ void virtser_send(const uint8_t byte) {
983} 986}
984#endif 987#endif
985 988
989void send_digitizer(report_digitizer_t *report) {
990#ifdef DIGITIZER_ENABLE
991 uint8_t timeout = 255;
992
993 if (USB_DeviceState != DEVICE_STATE_Configured) return;
994
995 Endpoint_SelectEndpoint(DIGITIZER_IN_EPNUM);
996
997 /* Check if write ready for a polling interval around 10ms */
998 while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
999 if (!Endpoint_IsReadWriteAllowed()) return;
1000
1001 Endpoint_Write_Stream_LE(report, sizeof(report_digitizer_t), NULL);
1002 Endpoint_ClearIN();
1003#endif
1004}
1005
986/******************************************************************************* 1006/*******************************************************************************
987 * main 1007 * main
988 ******************************************************************************/ 1008 ******************************************************************************/