pattern.c
void vRainbowCrossfade( const uint32_t ulPatternCount )
{
    static uint8_t usColors[ configRAINBOW_SIMULTANEOUS_COLORS ][ COLOR_CHANNELS ] = { { 0 } };
    static int16_t sLedCount[ configRAINBOW_SIMULTANEOUS_COLORS ] = { 0 };

    /* Initial run. */
    if ( ulPatternCount == 0 )
    {
        vGetRandPix( &usColors[0][0], configRAINBOW_SIMULTANEOUS_COLORS );

        /* Evenly space the start positions throughout the LED strip. */
        for ( uint8_t i = 0; i < configRAINBOW_SIMULTANEOUS_COLORS; i++ )
        {
            sLedCount[i] = -configRAINBOW_TRANSITION_LENGTH + i * ( ( configRAINBOW_TRANSITION_LENGTH + NUMBER_OF_LEDS ) / configRAINBOW_SIMULTANEOUS_COLORS );
        }
    }

    for ( uint8_t i = 0; i < configRAINBOW_SIMULTANEOUS_COLORS; i++ )
    {
        if ( ( sLedCount[i] < NUMBER_OF_LEDS ) && ( ulPatternCount % configRAINBOW_RAMP_TIME_MS == 0 ) )
        {
            sLedCount[i]++;
            vCrossfade( sLedCount[i], configRAINBOW_TRANSITION_LENGTH, 0, usColors[i][0], usColors[i][1], usColors[i][2] );
        }
        else if ( sLedCount[i] >= NUMBER_OF_LEDS )
        {
            sLedCount[i] = -configRAINBOW_TRANSITION_LENGTH;
            vGetRandPix( &usColors[i][0], 1 );
        }
    }
}
/**
  * @brief  Crossfades between the RGB colors.
  * @retval None
  */
@brief  Crossfades between the RGB colors.
@retval None
@brief Crossfades between the RGB colors . @retval None
void vRainbowCrossfade( const uint32_t ulPatternCount )
{
    static uint8_t usColors[ configRAINBOW_SIMULTANEOUS_COLORS ][ COLOR_CHANNELS ] = { { 0 } };
    static int16_t sLedCount[ configRAINBOW_SIMULTANEOUS_COLORS ] = { 0 };
    if ( ulPatternCount == 0 )
    {
        vGetRandPix( &usColors[0][0], configRAINBOW_SIMULTANEOUS_COLORS );
        for ( uint8_t i = 0; i < configRAINBOW_SIMULTANEOUS_COLORS; i++ )
        {
            sLedCount[i] = -configRAINBOW_TRANSITION_LENGTH + i * ( ( configRAINBOW_TRANSITION_LENGTH + NUMBER_OF_LEDS ) / configRAINBOW_SIMULTANEOUS_COLORS );
        }
    }
    for ( uint8_t i = 0; i < configRAINBOW_SIMULTANEOUS_COLORS; i++ )
    {
        if ( ( sLedCount[i] < NUMBER_OF_LEDS ) && ( ulPatternCount % configRAINBOW_RAMP_TIME_MS == 0 ) )
        {
            sLedCount[i]++;
            vCrossfade( sLedCount[i], configRAINBOW_TRANSITION_LENGTH, 0, usColors[i][0], usColors[i][1], usColors[i][2] );
        }
        else if ( sLedCount[i] >= NUMBER_OF_LEDS )
        {
            sLedCount[i] = -configRAINBOW_TRANSITION_LENGTH;
            vGetRandPix( &usColors[i][0], 1 );
        }
    }
}
void vRainbowCrossfade ( const uint32_t ulPatternCount ) { static uint8_t usColors [ configRAINBOW_SIMULTANEOUS_COLORS ] [ COLOR_CHANNELS ] = { { 0 } } ; static int16_t sLedCount [ configRAINBOW_SIMULTANEOUS_COLORS ] = { 0 } ; if ( ulPatternCount == 0 ) { vGetRandPix ( & usColors [ 0 ] [ 0 ] , configRAINBOW_SIMULTANEOUS_COLORS ) ; for ( uint8_t i = 0 ; i < configRAINBOW_SIMULTANEOUS_COLORS ; i ++ ) { sLedCount [ i ] = - configRAINBOW_TRANSITION_LENGTH + i * ( ( configRAINBOW_TRANSITION_LENGTH + NUMBER_OF_LEDS ) / configRAINBOW_SIMULTANEOUS_COLORS ) ; } } for ( uint8_t i = 0 ; i < configRAINBOW_SIMULTANEOUS_COLORS ; i ++ ) { if ( ( sLedCount [ i ] < NUMBER_OF_LEDS ) && ( ulPatternCount % configRAINBOW_RAMP_TIME_MS == 0 ) ) { sLedCount [ i ] ++ ; vCrossfade ( sLedCount [ i ] , configRAINBOW_TRANSITION_LENGTH , 0 , usColors [ i ] [ 0 ] , usColors [ i ] [ 1 ] , usColors [ i ] [ 2 ] ) ; } else if ( sLedCount [ i ] >= NUMBER_OF_LEDS ) { sLedCount [ i ] = - configRAINBOW_TRANSITION_LENGTH ; vGetRandPix ( & usColors [ i ] [ 0 ] , 1 ) ; } } }
@brief  Crossfades between the RGB colors.
@brief Crossfades between the RGB colors .
/* Initial run. */ /* Evenly space the start positions throughout the LED strip. */