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.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 5b56e8a03..cb3aa693b 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -142,7 +142,8 @@ 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 = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer}; 145static void send_programmable_button(uint32_t data);
146host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};
146 147
147#ifdef VIRTSER_ENABLE 148#ifdef VIRTSER_ENABLE
148// clang-format off 149// clang-format off
@@ -760,27 +761,31 @@ static void send_mouse(report_mouse_t *report) {
760#endif 761#endif
761} 762}
762 763
763/** \brief Send Extra 764static void send_report(void *report, size_t size) {
764 *
765 * FIXME: Needs doc
766 */
767#ifdef EXTRAKEY_ENABLE
768static void send_extra(uint8_t report_id, uint16_t data) {
769 uint8_t timeout = 255; 765 uint8_t timeout = 255;
770 766
771 if (USB_DeviceState != DEVICE_STATE_Configured) return; 767 if (USB_DeviceState != DEVICE_STATE_Configured) return;
772 768
773 static report_extra_t r;
774 r = (report_extra_t){.report_id = report_id, .usage = data};
775 Endpoint_SelectEndpoint(SHARED_IN_EPNUM); 769 Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
776 770
777 /* Check if write ready for a polling interval around 10ms */ 771 /* Check if write ready for a polling interval around 10ms */
778 while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); 772 while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
779 if (!Endpoint_IsReadWriteAllowed()) return; 773 if (!Endpoint_IsReadWriteAllowed()) return;
780 774
781 Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); 775 Endpoint_Write_Stream_LE(report, size, NULL);
782 Endpoint_ClearIN(); 776 Endpoint_ClearIN();
783} 777}
778
779/** \brief Send Extra
780 *
781 * FIXME: Needs doc
782 */
783#ifdef EXTRAKEY_ENABLE
784static void send_extra(uint8_t report_id, uint16_t data) {
785 static report_extra_t r;
786 r = (report_extra_t){.report_id = report_id, .usage = data};
787 send_report(&r, sizeof(r));
788}
784#endif 789#endif
785 790
786/** \brief Send System 791/** \brief Send System
@@ -822,6 +827,14 @@ static void send_consumer(uint16_t data) {
822#endif 827#endif
823} 828}
824 829
830static void send_programmable_button(uint32_t data) {
831#ifdef PROGRAMMABLE_BUTTON_ENABLE
832 static report_programmable_button_t r;
833 r = (report_programmable_button_t){.report_id = REPORT_ID_PROGRAMMABLE_BUTTON, .usage = data};
834 send_report(&r, sizeof(r));
835#endif
836}
837
825/******************************************************************************* 838/*******************************************************************************
826 * sendchar 839 * sendchar
827 ******************************************************************************/ 840 ******************************************************************************/