Пример #1
0
// to be called from systick
void Mdm_Worker()
{
	if (timer != 0) {
		timer --;
	}

	if (timer == 1) {
		if (Mdm_state == MDM_STATE_CMD) {
			LED_GREEN(LED_OFF);
			LED_YELLOW(LED_OFF);
			LED_RED(LED_OFF);

			// cmd timeout
			cmd_len = 0;
		} else if (Mdm_state == MDM_STATE_COMM) {
			// timeouted :(
			LED_YELLOW(LED_ON);

			// turn off receiver
			RFM_IdleMode();

			// turn off led in 'timeout'.
			timer = Mdm_CMDTimeout;
			Mdm_state = MDM_STATE_CMD;
		} else if (Mdm_state == MDM_STATE_ANALYZER) {
			// start sample
			ADC_start();
		}
	}
}
Пример #2
0
void GPIO_Configuration(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;

	// JTAG enabled in debug mode !!! (see also .gdbinit)
	if (DEBUG_ON != 1) {
		GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
	}

	// set PA[0-4] as analog inputs
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	// set LEDs
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	// pins to default state
	LED_RED(Bit_SET); // off
	LED_GREEN(Bit_SET); // off
	LED_YELLOW(Bit_SET); // off
}
Пример #3
0
void Mdm_SniffStop()
{
	// disable sniff mode
	RFM_IdleMode();

	LED_GREEN(LED_OFF);
	LED_YELLOW(LED_OFF);
}
Пример #4
0
void Mdm_SniffStart(uint8_t a)
{
	// enable sniff mode
	RFM_SniffMode(a);

	LED_GREEN(LED_ON);
	LED_YELLOW(LED_ON);
}
Пример #5
0
void updateLeds()
{
    usbShowStatusWithGreenLed();

    LED_YELLOW(0);

    // Turn on the red LED if we are sending a burst.
    LED_RED((uint16)(packetsSent < 100));
}
Пример #6
0
void updateLeds()
{
    static BIT dimYellowLed = 0;
    static uint16 lastRadioActivityTime;
    uint16 now;

    // usbShowStatusWithGreenLed();

    now = (uint16)getMs();

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

    LED_YELLOW(errorOccurredRecently || uartRxDisabled);
}
Пример #7
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);
}
Пример #8
0
/** Functions *****************************************************************/
void updateLeds()
{
    LED_GREEN_TOGGLE();					//Die gruene LED blinkt bei Daten
	LED_YELLOW(ACM_CONTROL_LINE_DTR);	//Funktioniert nicht so wie gedacht
    LED_RED(0);							//Ist einfach aus
}
Пример #9
0
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(yellowLedOn);
}
Пример #10
0
/** Functions *****************************************************************/
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(usbComRxControlSignals() & ACM_CONTROL_LINE_DTR);
    LED_RED(0);
}
Пример #11
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);
}
Пример #12
0
void updateLeds()
{
    usbShowStatusWithGreenLed();
    LED_YELLOW(0);
    LED_RED(0);
}