Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Revision:
2:2caf2a9a13aa
Parent:
1:a0055b3280c8
Child:
3:6c81fc8834e2
diff -r a0055b3280c8 -r 2caf2a9a13aa main.cpp
--- a/main.cpp	Mon Dec 14 12:04:01 2015 +0000
+++ b/main.cpp	Tue Dec 22 06:09:48 2015 +0000
@@ -15,7 +15,6 @@
 #include "COM_MNG_TMTC.h"
 #include "ThreadsAndFunctions.h"
 
-DigitalOut led(LED_RED);
 
 int main()
 {
@@ -25,11 +24,12 @@
     gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;
     gRX_HEAD_DATA_NODE->next_node = NULL;
     gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;
-    gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
+    gRX_COUNT = 0;
+//    gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
     RX1M.attach(&rx_read, Serial::RxIrq);
     
     // DEBUG
-    gPC.baud(9600);
+    gPC.baud(1200);
     gPC.puts("welcome to mng_tm_tc\r\n");
     
     // COMMON SPI
@@ -37,7 +37,8 @@
     spi.frequency(1000000);
 
     // SD CARD
-    // cs_SDCard=1;
+    gCS_SDC = 1;
+    gCS_RTC = 1;
     // initialise_card();
     // int result= initialise_card();
     // disk_initialize();    
@@ -52,21 +53,32 @@
     gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
     // *******************INITIALISATIONS END********************
     
+    //adf test
+    gPC.puts("Testing ADF\r\n");
+    Base_tm *testTM = new Short_tm;
+    uint8_t temp8;
+    temp8 = 0xA;
+    PUTtmid(testTM->fields, temp8);
+    temp8 = 0x00;
+    PUTshort_or_long_tm(testTM->fields, temp8);
+    testTM->TM_string[0] = TMID_ACK_L1 << 4;
+    testTM->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;
+    testTM->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;
+    testTM->TM_string[3] = (gMASTER_STATE << 4) & 0xF0;
+    testTM->next_TM = NULL;
+    gPC.puts("sending now\r\n");
+    snd_tm.head_pointer(testTM);
+    adf_not_SDcard();
+    gPC.puts("Completed testing ADF\r\n");
+    
     int theAcount = 0;
     while(true){
-        if(theAcount >= 100000){
+        if(theAcount >= 700000){
             theAcount = 0;
-            gLEDR = !gLEDR;
+            //gLEDR = !gLEDR;
         }
         else{
             theAcount++;
         }
-        if(gFLAGS & END_SESSION){
-            gFLAGS = gFLAGS & (~END_SESSION);
-            gFLAGS = gFLAGS | (0xFF & START_SESSION);
-            // pass got over reset all
-            reset_all;
-            //PENDING: also consider frame_no
-        }
     }
 }
\ No newline at end of file