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
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 00005 #include "config.h" 00006 #include "layer_frame.h" 00007 #include "leds.h" 00008 #include "serialRecieve.h" 00009 00010 DigitalIn din(p20); 00011 DigitalIn lightButton(p30); 00012 00013 00014 extern Payload sendedPayload; 00015 00016 volatile uint16_t count; 00017 volatile PrefSender spref; 00018 00019 volatile int oldBt; 00020 volatile bool isChatterWait; 00021 Timeout chatterWait; 00022 00023 void ctProcess(void) 00024 { 00025 if(oldBt ^ lightButton) 00026 { 00027 spref.lightsw = lightButton; 00028 oldBt = spref.lightsw; 00029 lightIlluminateChange(lightButton); 00030 } 00031 00032 isChatterWait = false; 00033 } 00034 00035 00036 00037 int main(){ 00038 00039 serialInit(); 00040 00041 #ifdef _SERVER_TEST_MODE_ 00042 pc.printf("*.*.*.*.*.*.*. T E S T M O D E *.*.*.*.*.*.*.*.*.*.\n"); 00043 #endif 00044 00045 pc.printf("sender start\n"); 00046 din.mode(PullUp); 00047 00048 lightIlluminateChange(0); 00049 00050 spref.currentFrameNumber = 0; 00051 spref.gainData.gain = kTxGain; 00052 spref.gainData.middleLevel = kTxMidLevel; 00053 00054 spref.continueusMode = 0; 00055 spref.isSend = 0; 00056 spref.xbeeAdress = 0; 00057 00058 Payload test; 00059 initTestPayloadData(&test); 00060 00061 initCarrierWave(); 00062 00063 startLed(); 00064 00065 isChatterWait = false; 00066 spref.lightsw = lightButton; 00067 oldBt = spref.lightsw; 00068 00069 lightIlluminateChange(spref.lightsw); 00070 00071 while(1){ 00072 00073 //light button push or release 00074 if( (oldBt ^ lightButton) && !isChatterWait ){ 00075 00076 isChatterWait = true; 00077 chatterWait.attach(&ctProcess,0.05); 00078 00079 00080 } 00081 00082 readProcess(); 00083 00084 00085 if(spref.continueusMode == 1) sendPayload(&sendedPayload); 00086 00087 else if(!din) sendPayload(&test); 00088 00089 else sendByteData(0x00); 00090 00091 00092 } 00093 00094 } 00095
Generated on Wed Jul 13 2022 03:39:54 by
