# HG changeset patch # User José Luis Salvador Rufo # Date 1464260772 -7200 # Node ID 380e1f0123d03c7c1a3f8538eaeccba05de000c4 # Parent a6370d67f460431a510c4f9347bbc268a188f7ca Adding toggleKbdProtocol capability diff -r a6370d67f460 -r 380e1f0123d0 Output/pjrcUSB/capabilities.kll --- a/Output/pjrcUSB/capabilities.kll Mon May 23 17:19:21 2016 -0700 +++ b/Output/pjrcUSB/capabilities.kll Thu May 26 13:06:12 2016 +0200 @@ -17,6 +17,7 @@ # Configuration capabilities kbdProtocolBoot => Output_kbdProtocolBoot_capability(); kbdProtocolNKRO => Output_kbdProtocolNKRO_capability(); +toggleKbdProtocol => Output_toggleKbdProtocol_capability(); # Locale Settings keyboardLocale => KeyboardLocale_define; diff -r a6370d67f460 -r 380e1f0123d0 Output/pjrcUSB/output_com.c --- a/Output/pjrcUSB/output_com.c Mon May 23 17:19:21 2016 -0700 +++ b/Output/pjrcUSB/output_com.c Thu May 26 13:06:12 2016 +0200 @@ -218,6 +218,28 @@ } +// 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 -r a6370d67f460 -r 380e1f0123d0 Output/usbMuxUart/output_com.c --- a/Output/usbMuxUart/output_com.c Mon May 23 17:19:21 2016 -0700 +++ b/Output/usbMuxUart/output_com.c Thu May 26 13:06:12 2016 +0200 @@ -222,6 +222,28 @@ } +// 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 ) {