テストモード追加、LED有効化 left -> SerialRX, Data Recieve Complete , Serial Tx , Light Tx

Dependencies:   XBee mbed NetServicesMin

common/leds.cpp

Committer:
recotana
Date:
2012-04-18
Revision:
2:dec6319cf02c
Parent:
1:36eb173eb52b

File content as of revision 2:dec6319cf02c:

#include "mbed.h"
#include "leds.h"

Timeout timer1;
Timeout timer2;
Timeout timer3;
Timeout timer4;

DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);

extern Serial pc;

void offSerialRx(void){
    led1=0;
}

void offSerialDataCmp(void){
    led2=0;
    
}
void offSerialTx(void){
    led3=0;
}
void offLightlTx(void){
    led4=0;
}

void ledSerialRx(void)
{
    if(led1 == 1) return;
    led1=1;
    timer1.attach(&offSerialRx,kLedOnTime);
}
void ledSerialDataCmp(void)
{
    led2=1;
    timer2.attach(&offSerialDataCmp,kLedOnTime);
}
void ledSerialTx(void)
{
    led3=1;
    timer3.attach(&offSerialTx,kLedOnTime);
}
void ledLightTx(void)
{
    led4=1;
    timer4.attach(&offLightlTx,kLedOnTime);
}

void startLed(void)
{
    
    led1=1;
    wait(0.2);
    led1=0;
    
    led2=1;
    wait(0.2);
    led2=0;
        
    led3=1;
    wait(0.2);
    led3=0;
    
    led4=1;
    wait(0.2);
    led4=0;
    
    wait(0.4);
    
    led1=1;
    led2=1;
    led3=1;
    led4=1;
    wait(0.05);
    
    led1=0;
    led2=0;
    led3=0;
    led4=0;
    wait(0.1);
    
    led1=1;
    led2=1;
    led3=1;
    led4=1;
    wait(0.05);
    
    led1=0;
    led2=0;
    led3=0;
    led4=0;
 

}