Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
krishanprajapat
Date:
Fri Jan 01 08:55:38 2016 +0000
Parent:
16:538de1b20b3a
Child:
20:0e856afd1cf1
Commit message:
Not_working.. to be debugged; For further testings, use previous revision

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
COM_POWER_ON_TX.h Show annotated file Show diff for this revision Revisions of this file
DefinitionsAndGlobals.h Show annotated file Show diff for this revision Revisions of this file
adf.h Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Thu Dec 31 18:35:59 2015 +0000
+++ b/COM_MNG_TMTC.h	Fri Jan 01 08:55:38 2016 +0000
@@ -612,8 +612,8 @@
         }\
         obosc_tm_current = obosc_tm_current->next_TM;\
     }\
-    /*snd_tm.head_pointer(obosc_tm_head);*/\
-    /*adf_not_SDcard();*/\
+    snd_tm.head_pointer(obosc_tm_head);\
+    adf_not_SDcard;\
     /*DELETE THE TM AFTER USE*/\
     obosc_tm_current = obosc_tm_head;\
     int overCount = 0;\
@@ -745,8 +745,8 @@
                                 tm_ptr = tm_ptr->next_TM;\
                             }\
                             /*SEND DATA TO GS*/\
-                            /*snd_tm.head_pointer(tm_ptr_head);*/\
-                            /*adf_not_SDcard();*/\
+                            snd_tm.head_pointer(tm_ptr_head);\
+                            adf_not_SDcard;\
                             /*DELETE THE TM AFTER USE*/\
                             tm_ptr = tm_ptr_head;\
                             overflowCountExecute = 0;\
--- a/COM_POWER_ON_TX.h	Thu Dec 31 18:35:59 2015 +0000
+++ b/COM_POWER_ON_TX.h	Fri Jan 01 08:55:38 2016 +0000
@@ -84,6 +84,8 @@
             }\
             power_on_tm = power_on_tm->next_TM;\
         }\
+        snd_tm.head_pointer(power_on_tm_head);\
+        adf_not_SDcard;\
         /*PENDING: TRANSMIT ABOVE TM*/\
         /*deleting the telemetry*/\
         power_on_tm = power_on_tm_head;\
--- a/DefinitionsAndGlobals.h	Thu Dec 31 18:35:59 2015 +0000
+++ b/DefinitionsAndGlobals.h	Fri Jan 01 08:55:38 2016 +0000
@@ -14,6 +14,7 @@
     
 // COM_TX
     #define COM_TX_CONFIG_LIMIT 3
+    #define COM_TX_TICKER_LIMIT 32
 
 // ADF INTERRUPUT
     #define ADF_IRQ PTA14
--- a/adf.h	Thu Dec 31 18:35:59 2015 +0000
+++ b/adf.h	Fri Jan 01 08:55:38 2016 +0000
@@ -1,6 +1,5 @@
 //without reset feature , with state checks.
 InterruptIn IRQ(ADF_IRQ);
-Ticker ticker;
  
 bool sent_tmfrom_SDcard;
 bool loop_on;
@@ -419,15 +418,7 @@
         gPC.puts("adf_off\r\n");\
     }\
 }
- 
- 
-void check(){   
-    if(IRQ){
-        gCOM_MNG_TMTC_THREAD->signal_set(signal);
-    }
-}
   
- 
 #define send_data {\
     if(sent_tmfrom_SDcard){\
         send_tm_from_SD_card();\
@@ -464,7 +455,7 @@
     spi.write(0xFF);\
     gCS_ADF=1;\
     SPI_mutex.unlock();\
-    ticker.attach_us(&check,32000);\
+    gPC.puts("entg tick\r\n");\
 }
     
     
@@ -486,7 +477,6 @@
         gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\
         if(ADF_off){\
             SPI_mutex.lock();\
-            ticker.detach();\
             gCS_ADF=0;\
             spi.write(0xB1);\
             gCS_ADF=1;\
@@ -523,55 +513,78 @@
 //    gCOM_MNG_TMTC_THREAD->signal_set(signal);
 //}
  
-void configure_adf(){
-    finish_write_data = false;
-    buffer_state = true;
-    last_buffer = false;
-    loop_on = true;
-    ADF_off = false;
-    /*initial adf check*/
-    initial_adf_check;
-    gPC.puts("initial adf check\r\n");
-    initiate;
-//    gPC.puts("initiate done\r\n");
-    gPC.puts("adf configured\r\n");
+#define configure_adf {\
+    finish_write_data = false;\
+    buffer_state = true;\
+    last_buffer = false;\
+    loop_on = true;\
+    ADF_off = false;\
+    initial_adf_check;\
+    gPC.puts("initial adf check\r\n");\
+    initiate;\
+    gPC.puts("adf configured\r\n");\
 }
  
-void adf_not_SDcard(){
-    sent_tmfrom_SDcard = false;
-    configure_adf();
-    signal = COM_MNG_TMTC_SIGNAL_ADF_NSD;
-    send_data;
-    
-//    gPC.puts("Inside adf transmission\r\n");
-//    ADF_non_responsive_timeout.attach(&ADF_non_responsive_fun, 10);
- 
-    while(loop_on){
-        gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_NSD);
+#define adf_not_SDcard {\
+    sent_tmfrom_SDcard = false;\
+    configure_adf;\
+    signal = COM_MNG_TMTC_SIGNAL_ADF_NSD;\
+    send_data;\
+    gPC.puts("before while loop\r\n");\
+    while(loop_on){\
+        wait_ms(COM_TX_TICKER_LIMIT);\
+        ADF_off = true;\
+        finish_write_data = true;\
+        gLEDG = 0;\
+        if(IRQ){\
+            gPC.puts("Yeah");\
+            ADF_off = true;\
+            finish_write_data = true;\
+            break;\
+        }\
+        gLEDR = 1;\
+    }\
+    gPC.puts("after while loop\r\n");\
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 //        if( ADF_non_responsive_flag == false ){
-            if(finish_write_data){
-                if(ADF_off){
-                    SPI_mutex.lock();
-                    ticker.detach(); 
-        //            wait_ms(35); 
-                    gCS_ADF=0;
-                    spi.write(0xB1);
-                    gCS_ADF=1;
-                    SPI_mutex.unlock();
-                    loop_on = false;
-                    gPC.puts("Transmission done\r\n");
-                }
-                else{
-                    ADF_off = true;
-                }
-            }else{   
-                write_data;
-                snd_tm.transmit_data(buffer_112,&last_buffer);
-            }
+//            if(finish_write_data){
+//                if(ADF_off){
+//                    break;
+//                }
+//            }
+//                    SPI_mutex.lock();
+//                    ticker.detach(); 
+//        //            wait_ms(35); 
+//                    gCS_ADF=0;
+//                    spi.write(0xB1);
+//                    gCS_ADF=1;
+//                    SPI_mutex.unlock();
+//                    loop_on = false;
+//                    gPC.puts("Transmission done\r\n");
+//                }
+//                else{
+//                    ADF_off = true;
+//                }
+//            }else{   
+//                write_data;
+//                snd_tm.transmit_data(buffer_112,&last_buffer);
+//            }
 //        }
 //        else{
 //            gPC.puts("ADF non responsive\r\n");
 //            break;
-//        }
-    }
-}
\ No newline at end of file
+//        }
\ No newline at end of file