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: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 186:eb19a02f83d6
- Parent:
- 182:8b73c010286b
--- a/ThreadsAndFunctions.h Fri Jun 17 11:36:22 2016 +0000
+++ b/ThreadsAndFunctions.h Fri Jun 17 13:41:43 2016 +0000
@@ -24,6 +24,51 @@
}
//COM THREAD
+
+#define STANDBY_SCIENCE_PL(tm_ptr) {\
+ Base_tc *linktest_tc = new Short_tc;\
+ linktest_tc->next_TC = NULL;\
+ PUTshort_or_long(linktest_tc,SHORT_TC_CODE);\
+ PUTcrc_pass(linktest_tc,0x1);\
+ PUTexec_status(linktest_tc,0);\
+ linktest_tc->TC_string[0] = 0x01;\
+ linktest_tc->TC_string[1] = 0xC0;\
+ linktest_tc->TC_string[2] = 0x81;\
+ linktest_tc->TC_string[3] = 0x2;\
+ linktest_tc->TC_string[4] = 0;\
+ linktest_tc->TC_string[5] = 0;\
+ linktest_tc->TC_string[6] = 0;\
+ linktest_tc->TC_string[7] = 0;\
+ linktest_tc->TC_string[8] = 0;\
+ uint16_t crc16 = crc16_gen(linktest_tc->TC_string, 9);\
+ linktest_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
+ linktest_tc->TC_string[10] = (crc16 & 0x00FF);\
+ tm_ptr = FCTN_CDMS_RLY_TMTC(linktest_tc);\
+}
+
+#define INIT_SCIENCE_PL(tm_ptr) {\
+ Base_tc *linktest_tc = new Short_tc;\
+ linktest_tc->next_TC = NULL;\
+ PUTshort_or_long(linktest_tc,SHORT_TC_CODE);\
+ PUTcrc_pass(linktest_tc,0x1);\
+ PUTexec_status(linktest_tc,0);\
+ linktest_tc->TC_string[0] = 0x02;\
+ linktest_tc->TC_string[1] = 0xC0;\
+ linktest_tc->TC_string[2] = 0x81;\
+ linktest_tc->TC_string[3] = 0x4;\
+ linktest_tc->TC_string[4] = 0;\
+ linktest_tc->TC_string[5] = 0;\
+ linktest_tc->TC_string[6] = 0;\
+ linktest_tc->TC_string[7] = 0;\
+ linktest_tc->TC_string[8] = 0;\
+ uint16_t crc16 = crc16_gen(linktest_tc->TC_string, 9);\
+ linktest_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
+ linktest_tc->TC_string[10] = (crc16 & 0x00FF);\
+ tm_ptr = FCTN_CDMS_RLY_TMTC(linktest_tc);\
+}
+
+
+
// UART ISR
void rx_read(){
gRX_CURRENT_DATA_NODE->values[gRX_COUNT] = RX1M.getc();
@@ -105,6 +150,22 @@
gFLAGS = gFLAGS & (~UART_INT_FLAG);
if( !(gFLAGS & COM_SESSION_FLAG) ){
// PENDING : DISABLE THREADS
+ Base_tm *tm_ptr = new Short_tm;
+ STANDBY_SCIENCE_PL(tm_ptr);
+ /*DELETE THE TM AFTER USE*/\
+ Base_tm *del_tm = tm_ptr;\
+ int overCount = 0;\
+ while( del_tm != NULL ){\
+ if( (overCount < TM_OVERFLOW_CONSTANT) ){\
+ Base_tm *temp = del_tm->next_TM;\
+ delete del_tm;\
+ del_tm = temp;\
+ ++overCount;\
+ }\
+ else{\
+ break;\
+ }\
+ }\
gFLAGS = gFLAGS | COM_SESSION_FLAG;
gSESSION_TIMEOUT.attach(&after_session, SESSION_TIME_LIMIT);
gFLAGS = gFLAGS | COM_RX_FLAG;
@@ -188,6 +249,22 @@
reset_all;
gFLAGS = gFLAGS & (~COM_SESSION_VALIDITY);
// PENDING : ENABLE THREADS
+ Base_tm *tm_ptr = new Short_tm;
+ INIT_SCIENCE_PL(tm_ptr);
+ /*DELETE THE TM AFTER USE*/\
+ Base_tm *del_tm = tm_ptr;\
+ int overCount = 0;\
+ while( del_tm != NULL ){\
+ if( (overCount < TM_OVERFLOW_CONSTANT) ){\
+ Base_tm *temp = del_tm->next_TM;\
+ delete del_tm;\
+ del_tm = temp;\
+ ++overCount;\
+ }\
+ else{\
+ break;\
+ }\
+ }\
gSESSION_TIMEOUT.detach();
gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
// WARNING: clear COM_MNG_TMTC ?
