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

Function Pixel_FadeControl_capability

Macro/PixelMap/pixel.c:718–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718void Pixel_FadeControl_capability( TriggerMacro *trigger, uint8_t state, uint8_t stateType, uint8_t *args )
719{
720 CapabilityState cstate = KLL_CapabilityState( state, stateType );
721
722 switch ( cstate )
723 {
724 case CapabilityState_Initial:
725 // Only activate on press event
726 break;
727 case CapabilityState_Debug:
728 // Display capability name
729 print("Pixel_FadeControl_capability(test)");
730 return;
731 default:
732 return;
733 }
734
735 // Get arguments
736 uint8_t profile = args[0];
737 uint8_t command = args[1];
738 uint8_t arg = args[2];
739
740 // Make sure profile is valid
741 if ( profile >= sizeof(Pixel_pixel_fade_profile_entries) )
742 {
743 return;
744 }
745
746 // Process command
747 uint16_t tmp;
748 switch ( command )
749 {
750 case PixelFadeControl_Reset:
751 for ( uint8_t config = 0; config < 4; config++ )
752 {
753 Pixel_pixel_fade_profile_entries[profile].conf[config] = \
754 Pixel_LED_FadePeriods[Pixel_LED_FadePeriod_Defaults[profile][config]];
755 }
756 Pixel_pixel_fade_profile_entries[profile].pos = 0;
757 Pixel_pixel_fade_profile_entries[profile].period_conf = PixelPeriodIndex_Off_to_On;
758 Pixel_pixel_fade_profile_entries[profile].brightness = Pixel_LED_FadeBrightness[profile];
759 break;
760
761 case PixelFadeControl_Reset_All:
762 // Setup fade defaults
763 for ( uint8_t pr = 0; pr < 4; pr++ )
764 {
765 for ( uint8_t config = 0; config < 4; config++ )
766 {
767 Pixel_pixel_fade_profile_entries[pr].conf[config] = \
768 Pixel_LED_FadePeriods[Pixel_LED_FadePeriod_Defaults[pr][config]];
769 }
770 Pixel_pixel_fade_profile_entries[pr].pos = 0;
771 Pixel_pixel_fade_profile_entries[pr].period_conf = PixelPeriodIndex_Off_to_On;
772 Pixel_pixel_fade_profile_entries[profile].brightness = Pixel_LED_FadeBrightness[pr];
773 }
774 break;
775

Callers

nothing calls this directly

Calls 1

KLL_CapabilityStateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…