テストモード追加、LED有効化 left -> SerialRX, Data Recieve Complete , Serial Tx , Light Tx
Dependencies: XBee mbed NetServicesMin
Revision 2:dec6319cf02c, committed 2012-04-18
- Comitter:
- recotana
- Date:
- Wed Apr 18 07:52:46 2012 +0000
- Parent:
- 1:36eb173eb52b
- Commit message:
Changed in this revision
frame_layer/layer_frame.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 36eb173eb52b -r dec6319cf02c frame_layer/layer_frame.cpp --- a/frame_layer/layer_frame.cpp Sun Apr 15 13:09:53 2012 +0000 +++ b/frame_layer/layer_frame.cpp Wed Apr 18 07:52:46 2012 +0000 @@ -31,16 +31,24 @@ DigitalOut lightPowerOn(p8); DigitalOut out(p19); +DigitalOut lightButtonLed(p29); + extern PrefSender spref; void lightIlluminateChange(uint8_t _sw){ if(_sw == 0){ - lightPowerOn=0; + lightPowerOn=0; + spref.lightsw = 0; + lightButtonLed = 0; } else{ - lightPowerOn=1; + + lightPowerOn=1; + spref.lightsw = 1; + lightButtonLed = 1; + } }
diff -r 36eb173eb52b -r dec6319cf02c main.cpp --- a/main.cpp Sun Apr 15 13:09:53 2012 +0000 +++ b/main.cpp Wed Apr 18 07:52:46 2012 +0000 @@ -8,12 +8,32 @@ #include "serialRecieve.h" DigitalIn din(p20); +DigitalIn lightButton(p30); + extern Payload sendedPayload; volatile uint16_t count; volatile PrefSender spref; +volatile int oldBt; +volatile bool isChatterWait; +Timeout chatterWait; + +void ctProcess(void) +{ + if(oldBt ^ lightButton) + { + spref.lightsw = lightButton; + oldBt = spref.lightsw; + lightIlluminateChange(lightButton); + } + + isChatterWait = false; +} + + + int main(){ serialInit(); @@ -25,10 +45,12 @@ pc.printf("sender start\n"); din.mode(PullUp); + lightIlluminateChange(0); + spref.currentFrameNumber = 0; spref.gainData.gain = kTxGain; spref.gainData.middleLevel = kTxMidLevel; - spref.lightsw = 1; + spref.continueusMode = 0; spref.isSend = 0; spref.xbeeAdress = 0; @@ -39,9 +61,24 @@ initCarrierWave(); startLed(); + + isChatterWait = false; + spref.lightsw = lightButton; + oldBt = spref.lightsw; + + lightIlluminateChange(spref.lightsw); while(1){ + //light button push or release + if( (oldBt ^ lightButton) && !isChatterWait ){ + + isChatterWait = true; + chatterWait.attach(&ctProcess,0.05); + + + } + readProcess(); @@ -51,9 +88,8 @@ else sendByteData(0x00); - - - + } } +