+// Set Boot Keyboard Protocol
+void Output_kbdProtocolBoot_capability( uint8_t state, uint8_t stateType, uint8_t *args )
+{
+ // Display capability name
+ if ( stateType == 0xFF && state == 0xFF )
+ {
+ print("Output_kbdProtocolBoot()");
+ return;
+ }
+
+ // Only set if necessary
+ if ( USBKeys_Protocol == 0 )
+ return;
+
+ // TODO Analog inputs
+ // Only set on key press
+ if ( stateType != 0x01 )
+ return;
+
+ // Flush the key buffers
+ Output_flushBuffers();
+
+ // Set the keyboard protocol to Boot Mode
+ USBKeys_Protocol = 0;
+}
+
+
+// Set NKRO Keyboard Protocol
+void Output_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_t *args )
+{
+ // Display capability name
+ if ( stateType == 0xFF && state == 0xFF )
+ {
+ print("Output_kbdProtocolNKRO()");
+ return;
+ }
+
+ // Only set if necessary
+ if ( USBKeys_Protocol == 1 )
+ return;
+
+ // TODO Analog inputs
+ // Only set on key press
+ if ( stateType != 0x01 )
+ return;
+
+ // Flush the key buffers
+ Output_flushBuffers();
+
+ // Set the keyboard protocol to NKRO Mode
+ USBKeys_Protocol = 1;
+}
+
+
+// Sends a Consumer Control code to the USB Output buffer
+void Output_consCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args )
+{
+ // Display capability name
+ if ( stateType == 0xFF && state == 0xFF )
+ {
+ print("Output_consCtrlSend(consCode)");
+ return;
+ }
+
+ // Not implemented in Boot Mode
+ if ( USBKeys_Protocol == 0 )
+ {
+ warn_print("Consumer Control is not implemented for Boot Mode");
+ return;
+ }
+
+ // TODO Analog inputs
+ // Only indicate USB has changed if either a press or release has occured
+ if ( state == 0x01 || state == 0x03 )
+ USBKeys_Changed |= USBKeyChangeState_Consumer;
+
+ // Only send keypresses if press or hold state
+ if ( stateType == 0x00 && state == 0x03 ) // Release state
+ {
+ USBKeys_ConsCtrl = 0;
+ return;
+ }
+
+ // Set consumer control code
+ USBKeys_ConsCtrl = *(uint16_t*)(&args[0]);
+}
+
+
+// Ignores the given key status update
+// Used to prevent fall-through, this is the None keyword in KLL
+void Output_noneSend_capability( uint8_t state, uint8_t stateType, uint8_t *args )
+{
+ // Display capability name
+ if ( stateType == 0xFF && state == 0xFF )
+ {
+ print("Output_noneSend()");
+ return;
+ }
+
+ // Nothing to do, because that's the point :P
+}
+
+
+// Sends a System Control code to the USB Output buffer
+void Output_sysCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args )
+{
+ // Display capability name
+ if ( stateType == 0xFF && state == 0xFF )
+ {
+ print("Output_sysCtrlSend(sysCode)");
+ return;
+ }
+
+ // Not implemented in Boot Mode
+ if ( USBKeys_Protocol == 0 )
+ {
+ warn_print("System Control is not implemented for Boot Mode");
+ return;
+ }
+
+ // TODO Analog inputs
+ // Only indicate USB has changed if either a press or release has occured
+ if ( state == 0x01 || state == 0x03 )
+ USBKeys_Changed |= USBKeyChangeState_System;
+
+ // Only send keypresses if press or hold state
+ if ( stateType == 0x00 && state == 0x03 ) // Release state
+ {
+ USBKeys_SysCtrl = 0;
+ return;
+ }
+
+ // Set system control code
+ USBKeys_SysCtrl = args[0];
+}
+
+