Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 |
--- 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;
+
}
}
--- 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);
-
-
-
+
}
}
+