CDMS_CODE_samp_23SEP_DMA_flag

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE_samp_23SEP_DMA by iitm sat

Revision:
137:489a93a04d6b
Parent:
12:ffdb29353058
Child:
144:4c20fcc105ce
--- a/COM_POWER_OFF_TX.h	Wed Mar 02 17:17:45 2016 +0000
+++ b/COM_POWER_OFF_TX.h	Thu Mar 24 04:04:33 2016 +0000
@@ -1,15 +1,51 @@
+#define power_on_bae {\
+    /*PENDING*/\
+}
+
+#define resume_bcn {\
+    Base_tc *beacon_tc = new Short_tc;\
+    beacon_tc->next_TC = NULL;\
+    PUTshort_or_long(beacon_tc,0);\
+    PUTcrc_pass(beacon_tc,0x1);\
+    PUTexec_status(beacon_tc,0);\
+    beacon_tc->TC_string[0] = 0x01;\
+    beacon_tc->TC_string[1] = 0x41;\
+    beacon_tc->TC_string[2] = 0x65;\
+    beacon_tc->TC_string[3] = 0x11;\
+    beacon_tc->TC_string[4] = 0x00;\
+    beacon_tc->TC_string[5] = 0;\
+    beacon_tc->TC_string[6] = 0;\
+    beacon_tc->TC_string[7] = 0;\
+    beacon_tc->TC_string[8] = 0x01;\
+    uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
+    beacon_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
+    beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
+    Base_tm *tm_ptr = new Short_tm;\
+    tm_ptr =  FCTN_CDMS_RLY_TMTC(beacon_tc);\
+}
+
 #define COM_POWER_OFF_TX {\
     /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
     /*PENDING: POWER OFF TRANSMITTER*/\
+    /*power_on_com_tx_pin = 0;*/\
     RX1M.attach(&rx_read, Serial::RxIrq);\
     gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
     /*PENDING: SWITCH RF RELAY TO BEACON*/\
-    /*PENDING: RF_SW_STATUS = RF_BCN*/\
-    /*PENDING: POWER ON BAE*/\
-    /*PENDING: SET BAE SW_EN_STATUS*/\
-    /*PENDING: RESUME BEACON*/\
+    gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\
+    if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
+        power_on_bae;\
+        gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\
+        gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
+        resume_bcn;\
+    }\
+    else{\
+        if( gFLAGS & BAE_SW_EN_FLAG ){\
+            resume_bcn;\
+        }\
+    }\
     gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
     gCOM_PA_COOLING_TIMEOUT.detach();\
     gFLAGS = gFLAGS & (~COM_TX_FLAG);\
-    /*gPC.puts("ompleted com_power_off tx\r\n");*/\
+    gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
+    /*gPC.puts("completed com_power_off tx\r\n");*/\
 }
\ No newline at end of file