テストモード追加、LED有効化 left -> SerialRX, Data Recieve Complete , Serial Tx , Light Tx
Dependencies: XBee mbed NetServicesMin
Diff: common/leds.cpp
- Revision:
- 1:36eb173eb52b
- Parent:
- 0:42adca80439c
--- a/common/leds.cpp Thu Mar 22 12:40:48 2012 +0000 +++ b/common/leds.cpp Sun Apr 15 13:09:53 2012 +0000 @@ -1,47 +1,98 @@ #include "mbed.h" #include "leds.h" -Timeout led_ether; -Timeout led_xbee; -Timeout led_device; +Timeout timer1; +Timeout timer2; +Timeout timer3; +Timeout timer4; -DigitalOut ledXb(LED1); -DigitalOut ledDev(LED2); -DigitalOut ledTcpCon(LED3); -DigitalOut ledEt(LED4); +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +extern Serial pc; -void offEther(void){ - ledEt=0; +void offSerialRx(void){ + led1=0; } -void offXBee(void){ - ledXb=0; + +void offSerialDataCmp(void){ + led2=0; + } -void offDevice(void){ - ledDev=0; +void offSerialTx(void){ + led3=0; +} +void offLightlTx(void){ + led4=0; } -void ledEther(void) +void ledSerialRx(void) { - ledEt=1; - led_ether.attach(&offEther,kLedOnTime); + if(led1 == 1) return; + led1=1; + timer1.attach(&offSerialRx,kLedOnTime); } -void ledXBee(void) +void ledSerialDataCmp(void) { - ledXb=1; - led_xbee.attach(&offXBee,kLedOnTime); + led2=1; + timer2.attach(&offSerialDataCmp,kLedOnTime); } -void ledDevice(void) +void ledSerialTx(void) { - ledDev=1; - led_device.attach(&offDevice,kLedOnTime); + led3=1; + timer3.attach(&offSerialTx,kLedOnTime); } -void onLedDevice(void) +void ledLightTx(void) { - ledDev=1; + led4=1; + timer4.attach(&offLightlTx,kLedOnTime); } -void ledTcpConnect(bool isConnect) +void startLed(void) { - if(isConnect) ledTcpCon=1; - else ledTcpCon=0; + + 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; + + } \ No newline at end of file