aboutsummaryrefslogtreecommitdiff
path: root/protocol/lufa/lufa.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/lufa/lufa.c')
-rw-r--r--protocol/lufa/lufa.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index a863b8d23..c1617cd05 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -220,6 +220,12 @@ void EVENT_USB_Device_ConfigurationChanged(void)
220 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, 220 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
221 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); 221 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
222#endif 222#endif
223
224#ifdef NKRO_ENABLE
225 /* Setup NKRO HID Report Endpoints */
226 ConfigSuccess &= ENDPOINT_CONFIG(NKRO_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
227 NKRO_EPSIZE, ENDPOINT_BANK_SINGLE);
228#endif
223} 229}
224 230
225/* 231/*
@@ -350,15 +356,31 @@ static void send_keyboard(report_keyboard_t *report)
350 if (USB_DeviceState != DEVICE_STATE_Configured) 356 if (USB_DeviceState != DEVICE_STATE_Configured)
351 return; 357 return;
352 358
353 // TODO: handle NKRO report
354 /* Select the Keyboard Report Endpoint */ 359 /* Select the Keyboard Report Endpoint */
355 Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM); 360#ifdef NKRO_ENABLE
361 if (keyboard_nkro) {
362 Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
363 }
364 else
365#endif
366 {
367 Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
368 }
356 369
357 /* Check if Keyboard Endpoint Ready for Read/Write */ 370 /* Check if Keyboard Endpoint Ready for Read/Write */
358 while (--timeout && !Endpoint_IsReadWriteAllowed()) ; 371 while (--timeout && !Endpoint_IsReadWriteAllowed()) ;
359 372
360 /* Write Keyboard Report Data */ 373 /* Write Keyboard Report Data */
361 Endpoint_Write_Stream_LE(report, sizeof(report_keyboard_t), NULL); 374#ifdef NKRO_ENABLE
375 if (keyboard_nkro) {
376 Endpoint_Write_Stream_LE(report, NKRO_EPSIZE, NULL);
377 }
378 else
379#endif
380 {
381 /* boot mode */
382 Endpoint_Write_Stream_LE(report, KEYBOARD_EPSIZE, NULL);
383 }
362 384
363 /* Finalize the stream transfer to send the last packet */ 385 /* Finalize the stream transfer to send the last packet */
364 Endpoint_ClearIN(); 386 Endpoint_ClearIN();