Home // Uncategorized // DEFCON 27 Badge — What do the lights mean?

DEFCON 27 Badge — What do the lights mean?

Understanding the various flashing states of your DEFCON 27 badge:

So you went to DEFCON and got the badge and are now wondering WTF, well here is a break down of what all the flashing means. This was pulled from King Pins source code which he did a great job documenting for those of you who want to mod your badges and work your way through it.

One of which being right after you scan a another badge. The packet is processed by the radio and etc and handed to this function essentially.

DC27_ProcessPacket();
if (badge_state == ATTRACT || badge_state == COMPLETE)
{
LP5569_SetLED_AllOn();
}
else
{
DC27_UpdateDisplay(); // update LEDs based on current state
}
SysTick_DelayTicks(500);
LP5569_SetLED_AllOff();

You can see from here we call out to DC27_UpdateDisplay. Which is shown below:

As you scan badges the LEDs on you badge will increase in numbers 6 to be exact as shown by this function below.

void DC27_UpdateDisplay(void)	// update LEDs based on current state
{
	static volatile int j;

    switch (badge_state)
    {
    	default:
    	case ATTRACT: // Attract mode: Cycle through D, E, F, C, O, N LED states
    		switch (attract_state)
    		{
    			case D:
    	    		LP5569_RampLED(D);
    	    		attract_state = E;
    				break;
    			case E:
    	    		LP5569_RampLED(E);
    	    		attract_state = F;
    				break;
    			case F:
    	    		LP5569_RampLED(F);
    	    		attract_state = C;
    				break;
    			case C:
    	    		LP5569_RampLED(C);
    	    		attract_state = O;
    				break;
    			case O:
    	    		LP5569_RampLED(O);
    	    		attract_state = N;
    				break;
    			case N:
    	    		LP5569_RampLED(N);
    	    		attract_state = D;
    				break;
    			case ATTRACT:	// unused states
    			case COMPLETE:
    			default:
    				attract_state = D;
    				break;
    		}
    		break;

    	case D:
    		LP5569_SetLED_D(LP5569_PWM);
    		break;

    	case E:
    		LP5569_SetLED_E(LP5569_PWM);
    		break;

    	case F:
    		LP5569_SetLED_F(LP5569_PWM);
    		break;

    	case C:
    		LP5569_SetLED_C(LP5569_PWM);
    		break;

    	case O:
    		LP5569_SetLED_O(LP5569_PWM);
    		break;

    	case N:
    		LP5569_SetLED_N(LP5569_PWM);
    		break;

    	case COMPLETE:
    		for (j = 0; j <= LP5569_PWM; j++)  // ramp up to maximum defined brightness
    		{
    			LP5569_SetLED(1, j);
    			LP5569_SetLED(4, j);

        		SysTick_DelayTicks(LED_SPARKLE_FADE_DELAY);
    		}

    		SysTick_DelayTicks(LED_SPARKLE_ON_DELAY);

       		LP5569_SetLED_AllOff(); // clear display
    		LP5569_SetLED(0, LP5569_PWM);
    	    LP5569_SetLED(3, LP5569_PWM);
       		SysTick_DelayTicks(LED_SPARKLE_ON_DELAY);

       		LP5569_SetLED_AllOff(); // clear display
       		LP5569_SetLED(1, LP5569_PWM);
       		LP5569_SetLED(4, LP5569_PWM);
       		SysTick_DelayTicks(LED_SPARKLE_ON_DELAY);

       		LP5569_SetLED_AllOff(); // clear display
    		LP5569_SetLED(2, LP5569_PWM);
    	    LP5569_SetLED(5, LP5569_PWM);
       		SysTick_DelayTicks(LED_SPARKLE_ON_DELAY);

       		LP5569_SetLED_AllOff(); // clear display
    		LP5569_SetLED(1, LP5569_PWM);
    	    LP5569_SetLED(4, LP5569_PWM);
       		SysTick_DelayTicks(LED_SPARKLE_ON_DELAY);

    		for (j = LP5569_PWM; j >= 0; j--)  // ramp down from maximum defined brightness
    		{
    			LP5569_SetLED(1, j);
    			LP5569_SetLED(4, j);

        		SysTick_DelayTicks(LED_SPARKLE_FADE_DELAY);
    		}

    		break;
    }
}

The only blinking patter established in this section above is for those who have completed there badge. The rest are defined below.

The first state will fire the following LEDS: Representing the letter D (Three on side A)

void LP5569_SetLED_D(unsigned char pwm_val)
{
LP5569_SetLED(0, 0);
LP5569_SetLED(1, 0);
LP5569_SetLED(2, 0);
LP5569_SetLED(3, pwm_val);
LP5569_SetLED(4, pwm_val);
LP5569_SetLED(5, pwm_val);
}

The second state will fire these LEDS: Representing the letter E (Two on Side B)

void LP5569_SetLED_F(unsigned char pwm_val)
{
LP5569_SetLED(0, pwm_val);
LP5569_SetLED(1, pwm_val);
LP5569_SetLED(2, pwm_val);
LP5569_SetLED(3, pwm_val);
LP5569_SetLED(4, 0);
LP5569_SetLED(5, 0);
}

The third state will fire these LEDS: Representing the letter F (Three on side B)

void LP5569_SetLED_C(unsigned char pwm_val)
{
LP5569_SetLED(0, pwm_val);
LP5569_SetLED(1, pwm_val);
LP5569_SetLED(2, pwm_val);
LP5569_SetLED(3, 0);
LP5569_SetLED(4, 0);
LP5569_SetLED(5, 0);
}

The fourth state will fire these LEDS: Representing the letter C (Two LEDs on each side)

void LP5569_SetLED_N(unsigned char pwm_val)
{
LP5569_SetLED(0, pwm_val);
LP5569_SetLED(1, pwm_val);
LP5569_SetLED(2, 0);
LP5569_SetLED(3, pwm_val);
LP5569_SetLED(4, pwm_val);
LP5569_SetLED(5, 0);
}

The fifth state will fire these LEDS: Representing the letter 0 (All LEDS will flash)

void LP5569_SetLED_O(unsigned char pwm_val)
{
LP5569_SetLED(0, pwm_val);
LP5569_SetLED(1, pwm_val);
LP5569_SetLED(2, pwm_val);
LP5569_SetLED(3, pwm_val);
LP5569_SetLED(4, pwm_val);
LP5569_SetLED(5, pwm_val);
}

The sixth state will fire these LEDS: Representing the letter N (Two LEDs on each side the scame as C)

void LP5569_SetLED_N(unsigned char pwm_val)
{
LP5569_SetLED(0, pwm_val);
LP5569_SetLED(1, pwm_val);
LP5569_SetLED(2, 0);
LP5569_SetLED(3, pwm_val);
LP5569_SetLED(4, pwm_val);
LP5569_SetLED(5, 0);
}

void LP5569_RampLED(badge_state_t ch) // display heartbeat (ramp up/down) of specified LED pattern
{
static volatile int j;

for (j = 0; j <= LP5569_PWM; j += 4)  // ramp up to maximum defined brightness
{
    if (g_nxhDetect)
    {
        g_nxhDetect = false;
        return; // exit the heartbeat if new badge data has just been received
    }

    switch (ch)
    {
        case D:
            LP5569_SetLED_D(j);
            break;

        case E:
            LP5569_SetLED_E(j);
            break;

        case F:
            LP5569_SetLED_F(j);
            break;

        case C:
            LP5569_SetLED_C(j);
            break;

        case O:
            LP5569_SetLED_O(j);
            break;

        case N:
            LP5569_SetLED_N(j);
            break;

        case ATTRACT:
        case COMPLETE:
        default:
            break;
    }

    SysTick_DelayTicks(LED_HEARTBEAT_FADE_DELAY);
}

This is just a quick overview of the code more to follow.

Posted in Uncategorized

Leave a Reply