June 30

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Tue Apr 19 23:00:31 2016 +0000
Parent:
164:be3b4b760d0c
Child:
171:31bdf83591a1
Commit message:
Integrated BAE I2C : tested with GS

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
i2c.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Mon Apr 18 12:18:53 2016 +0000
+++ b/COM_MNG_TMTC.h	Tue Apr 19 23:00:31 2016 +0000
@@ -208,12 +208,7 @@
             gPC.printf("Telecommand is for BAE\r\n");
             //printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
 
-            if(GETshort_or_long_tc(tc_ptr) == LONG_TC_CODE)
-                FCTN_I2C_WRITE((char*)tc_ptr->TC_string,TC_LONG_SIZE);
-            else 
-            {
                 FCTN_I2C_WRITE((char*)tc_ptr->TC_string,TC_SHORT_SIZE);
-            }
             
             while(1)
             {
@@ -222,10 +217,9 @@
                 {
                     
                     //printf("receiving...\r\n");
-                    FCTN_I2C_READ((char*)tm_pointer->TM_string,TM_LONG_SIZE);
+                    FCTN_I2C_READ((char*)tm_pointer->TM_string,135);
                     //printf("%s", tm_pointer->TM_string);
                     received+=1;
-                    tm_pointer = tm_pointer->next_TM;
                     break; //only for testing purpose
                 }
                 else
@@ -233,7 +227,7 @@
                     break;
                 }
             }
-            if(received >= 1 )
+            if(received < 1 )
             {
                 //printf("Telemetry is not received from BAE\r\n");
                 //tm_pointer = new Short_tm;
@@ -251,7 +245,10 @@
                 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
                 tm_pointer->next_TM = NULL;                 return tm_ptr;
             }
-            break;
+            else
+            {
+                tm_pointer->next_TM = NULL; return tm_ptr;
+                }
         }
         case 2:
         {
--- a/i2c.h	Mon Apr 18 12:18:53 2016 +0000
+++ b/i2c.h	Tue Apr 19 23:00:31 2016 +0000
@@ -19,7 +19,7 @@
     write_ack = master.write(addr_pl|0x00,data2,tc_len2);//address to be defined in payload
     if(write_ack == 1)
     {
-        printf("\n\rdata not sent\n");
+        gPC.printf("\n\rdata not sent\n");
         }
 }
 
@@ -31,10 +31,10 @@
     //t_read.stop();
   
     if(read_ack == 0)
-        printf("\n\rData received from BAE %s \n",data);
+        gPC.printf("\n\rData received from BAE \n");
  if (read_ack == 1)
     {
-        printf("\n \r data not received \n");
+        gPC.printf("\n \r data not received \n");
     }
 //if(read_ack == 1)
 //pc.printf("\n \r data not received \n");
--- a/main.cpp	Mon Apr 18 12:18:53 2016 +0000
+++ b/main.cpp	Tue Apr 19 23:00:31 2016 +0000
@@ -84,6 +84,9 @@
     gPC.puts("competed allocating threads\r\n");
     #endif
     
+    
+    master.frequency(400000);
+    
     // *******************INITIALISATIONS END********************
     
     //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);