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

Dependencies:   XBee mbed NetServicesMin

Revision:
2:dec6319cf02c
Parent:
1:36eb173eb52b
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);
         
-        
-
-        
+               
     }
     
 }
+