MCPcopy Create free account
hub / github.com/kiibohd/controller / Output_usbCodeSend_capability

Function Output_usbCodeSend_capability

Output/USB/output_usb.c:368–591  ·  view source on GitHub ↗

Adds a single USB Code to the USB Output buffer Argument #1: USB Code

Source from the content-addressed store, hash-verified

366// Adds a single USB Code to the USB Output buffer
367// Argument #1: USB Code
368void Output_usbCodeSend_capability( TriggerMacro *trigger, uint8_t state, uint8_t stateType, uint8_t *args )
369{
370#if enableKeyboard_define == 1
371 CapabilityState cstate = KLL_CapabilityState( state, stateType );
372
373 // Depending on which mode the keyboard is in the USB needs Press/Hold/Release events
374 uint8_t keyPress = 0; // Default to key release
375
376 switch ( cstate )
377 {
378 case CapabilityState_Initial:
379 // Indicate changed
380 keyPress = 1;
381 break;
382 case CapabilityState_Last:
383 break;
384 case CapabilityState_Debug:
385 // Display capability name
386 print("Output_usbCodeSend(usbCode)");
387
388 // Read arg if not set to 0
389 if ( args != 0 )
390 {
391 uint8_t key = args[0];
392 print(" -> ");
393 printInt8( key );
394 }
395 return;
396 default:
397 return;
398 }
399
400 // Get the keycode from arguments
401 uint8_t key = args[0];
402
403 // Extra USB Debug
404 if ( Output_DebugMode > 1 )
405 {
406 print("\033[1;34mUSB\033[0m ");
407 printInt8( key );
408 print(" ");
409 switch ( cstate )
410 {
411 case CapabilityState_Initial:
412 print("\033[1;33mP\033[0m");
413 break;
414 case CapabilityState_Last:
415 print("\033[1;35mR\033[0m");
416 break;
417 default:
418 break;
419 }
420 print( NL );
421 }
422
423 // Depending on which mode the keyboard is in, USBKeys_Keys array is used differently
424 // Boot mode - Maximum of 6 byte codes
425 // NKRO mode - Each bit of the 26 byte corresponds to a key

Calls 2

KLL_CapabilityStateFunction · 0.85
printInt8Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…