示例#1
0
void updateLeds()
{
    usbShowStatusWithGreenLed();

	if (getMs() - lastToggle >= param_led_change_ms/2)
	{
		T1CC1H = 0x00;
		T1CC1L = ledValue&0xFF;
		lastToggle = getMs();
		
		if (ledValue >= param_max_led_value) {
			ledValue -= param_led_increment;
			ledDir = 0;
		} else if (ledValue <= param_min_led_value) {
			ledValue += param_led_increment;
			ledDir = 1;
		} else {
			if (ledDir == 0) {
				ledValue -= param_led_increment;
			} else {
				ledValue += param_led_increment;
			}
		}
	}
}
示例#2
0
void updateLeds()
{
    usbShowStatusWithGreenLed();

    LED_YELLOW(0);

    // Turn on the red LED if we are sending a burst.
    LED_RED((uint16)(packetsSent < 100));
}
示例#3
0
void updateLeds()
{
    usbShowStatusWithGreenLed();

    //LED_YELLOW_TOGGLE();
    //LED_YELLOW(1);

    LED_RED(0);
}
示例#4
0
void updateLeds()
{
    usbShowStatusWithGreenLed();

    // NOTE: The code below is bad because it is reading two bytes of timeMs,
    // and the interrupt that updates timeMs could fire between those two reads.
    if (blinkYellow)
    {
        uint32 time = getMs();
        if (time >= nextToggle)
        {
            LED_YELLOW_TOGGLE();
            nextToggle = time + randomNumber();
        }
    }
    else
    {
        LED_YELLOW(1);
    }

    LED_RED(0);
}
示例#5
0
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(yellowLedOn);
}
示例#6
0
/** Functions *****************************************************************/
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(usbComRxControlSignals() & ACM_CONTROL_LINE_DTR);
    LED_RED(0);
}
void updateLeds()
{
    static BIT dimYellowLed = 0;
    static uint16 lastRadioActivityTime;
    uint16 now;

    usbShowStatusWithGreenLed();

    now = (uint16)getMs();

    if (currentSerialMode == SERIAL_MODE_USB_SPI)
    {
        // The radio is not being used, so turn off the yellow LED.
        LED_YELLOW(0);
    }
    else if (!radioLinkConnected())
    {
        // We have not connected to another device wirelessly yet, so do a
        // 50% blink with a period of 1024 ms.
        LED_YELLOW(now & 0x200 ? 1 : 0);
    }
    else
    {
        // We have connected.

        if ((now & 0x3FF) <= 20)
        {
            // Do a heartbeat every 1024ms for 21ms.
            LED_YELLOW(1);
        }
        else if (dimYellowLed)
        {
            static uint8 DATA count;
            count++;
            LED_YELLOW((count & 0x7)==0);
        }
        else
        {
            LED_YELLOW(0);
        }
    }

    if (radioLinkActivityOccurred)
    {
        radioLinkActivityOccurred = 0;
        dimYellowLed ^= 1;
        //dimYellowLed = 1;
        lastRadioActivityTime = now;
    }

    if ((uint16)(now - lastRadioActivityTime) > 32)
    {
        dimYellowLed = 0;
    }

    if ((uint8)(now - lastErrorTime) > 100)
    {
        errorOccurredRecently = 0;
    }

    LED_RED(errorOccurredRecently || uartRxDisabled);
}
示例#8
0
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(0);
    LED_RED(0);
}
示例#9
0
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_RED(serialProtocolError);
}