From 0174e1e6ab89827718eb285cae1a77aa3e2da7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Salvador=20Rufo?= Date: Thu, 26 May 2016 13:06:12 +0200 Subject: [PATCH] Adding toggleKbdProtocol capability --- Output/pjrcUSB/capabilities.kll | 1 + Output/pjrcUSB/output_com.c | 22 ++++++++++++++++++++++ Output/usbMuxUart/output_com.c | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/Output/pjrcUSB/capabilities.kll b/Output/pjrcUSB/capabilities.kll index c83f910..94a6c20 100644 --- a/Output/pjrcUSB/capabilities.kll +++ b/Output/pjrcUSB/capabilities.kll @@ -17,6 +17,7 @@ mouseOut => Output_usbMouse_capability( mouseCode : 2, relative_x : 2, relati # Configuration capabilities kbdProtocolBoot => Output_kbdProtocolBoot_capability(); kbdProtocolNKRO => Output_kbdProtocolNKRO_capability(); +toggleKbdProtocol => Output_toggleKbdProtocol_capability(); # Locale Settings keyboardLocale => KeyboardLocale_define; diff --git a/Output/pjrcUSB/output_com.c b/Output/pjrcUSB/output_com.c index 082c42b..6a9e64d 100644 --- a/Output/pjrcUSB/output_com.c +++ b/Output/pjrcUSB/output_com.c @@ -218,6 +218,28 @@ void Output_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_ } +// Toggle Keyboard Protocol +void Output_toggleKbdProtocol_capability( uint8_t state, uint8_t stateType, uint8_t *args ) +{ + // Display capability name + if ( stateType == 0xFF && state == 0xFF ) + { + print("Output_toggleKbdProtocol()"); + return; + } + + // Only toggle protocol if release state + if ( stateType == 0x00 && state == 0x03 ) + { + // Flush the key buffers + Output_flushBuffers(); + + // Toggle the keyboard protocol Mode + USBKeys_Protocol = !USBKeys_Protocol; + } +} + + // Sends a Consumer Control code to the USB Output buffer void Output_consCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) { diff --git a/Output/usbMuxUart/output_com.c b/Output/usbMuxUart/output_com.c index 00fbff6..1d41a9b 100644 --- a/Output/usbMuxUart/output_com.c +++ b/Output/usbMuxUart/output_com.c @@ -222,6 +222,28 @@ void Output_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_ } +// Toggle Keyboard Protocol +void Output_toggleKbdProtocol_capability( uint8_t state, uint8_t stateType, uint8_t *args ) +{ + // Display capability name + if ( stateType == 0xFF && state == 0xFF ) + { + print("Output_toggleKbdProtocol()"); + return; + } + + // Only toggle protocol if release state + if ( stateType == 0x00 && state == 0x03 ) + { + // Flush the key buffers + Output_flushBuffers(); + + // Toggle the keyboard protocol Mode + USBKeys_Protocol = !USBKeys_Protocol; + } +} + + // Sends a Consumer Control code to the USB Output buffer void Output_consCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {