for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
261:1e54415b34d3
Parent:
259:066a7abd2a5f
Child:
262:752c8689944a
--- a/main.cpp	Tue Jul 12 17:54:30 2016 +0000
+++ b/main.cpp	Thu Jul 14 13:07:30 2016 +0000
@@ -28,10 +28,11 @@
 #include "Flash.h"
 #include "CDMS_PL.h"
 #include "FMS_all.h"
+#include "Compression.h"
 #include "COM_MNG_TMTC.h"
 #include "COM_POWER_ON_TX.h"
 #include "COM_POWER_OFF_TX.h"
-#include "Compression.h"
+
 #include "ThreadsAndFunctions.h"
 #include "TEST_PL.h"
 
@@ -85,6 +86,47 @@
                             gPC.puts("exit_adf\r\n");\
 }
 
+
+#define BAE_tc(tm_ptr) {\
+    Base_tc *bae_tc = new  Long_tc;\
+    bae_tc->next_TC = NULL;\
+    PUTshort_or_long(bae_tc,0);\
+    PUTcrc_pass(bae_tc,0x1);\
+    PUTexec_status(bae_tc,0);\
+    bae_tc->TC_string[0] = 0x01;\
+    bae_tc->TC_string[1] = 0x71;\
+    bae_tc->TC_string[2] = 0x81;\
+    bae_tc->TC_string[3] = 0x32;\
+    bae_tc->TC_string[4] = 0;\
+    bae_tc->TC_string[5] = 0;\
+    bae_tc->TC_string[6] = 0;\
+    bae_tc->TC_string[7] = 0;\
+    bae_tc->TC_string[8] = 0;\    
+    uint16_t crc16 = crc16_gen(bae_tc->TC_string, 9);\
+    bae_tc->TC_string[9]  = (uint8_t)(crc16 & 0xFF00)>>8;\
+    bae_tc->TC_string[10] = (uint8_t)(crc16 & 0x00FF);\
+    for(uint8_t i=11;i<135;i++)\
+        bae_tc->TC_string[i] = 0;\
+    tm_ptr =  FCTN_CDMS_RLY_TMTC(bae_tc);\
+    delete bae_tc;\
+    Base_tm *temp;\
+    temp = tm_ptr;\
+    while(tm_ptr!=NULL)\
+    {\
+        temp = temp->next_TM;\
+        delete tm_ptr;\
+        tm_ptr = temp;\        
+    }\
+}
+
+void BAE_TC();
+void BAE_TC()
+{
+    Base_tm *tm_ptr = new Long_tm;     
+    BAE_tc(tm_ptr);    
+}
+
+
 int main()
 {
     
@@ -102,7 +144,7 @@
     
     // COMMON SPI
     spi.format(8,0);
-    spi.frequency(1000000);
+    spi.frequency(500000);
 
     // SD CARD
     cs_sd = 1;
@@ -110,7 +152,7 @@
     gCS_ADF = 1;
     
     FCTN_CDMS_INIT_RTC();/* rtc initialization*/
-    //FCTN_CDMS_SD_INIT();/* sd card initialization*/
+    FCTN_CDMS_SD_INIT();/* sd card initialization*/
     
     
     //uint8_t test[512] = {0};
@@ -142,14 +184,15 @@
     
     master.frequency(400000);
     
-    /*HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
-    HK_counter->start(10000);*/
+    HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
+    HK_counter->start(10000);
     
-    PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
-    PL_wo_dma->start(6000);//
+    /*PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
+    PL_wo_dma->start(6000);*/
     //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
     
-    
+    /*Timeout flipper;
+    flipper.attach(BAE_TC,31);*/
     
     /*while(1){
     gPC.printf("PL_TC sending\r\n");