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:
Sat Jun 11 10:05:52 2016 +0000
Parent:
183:fba74e465e1a
Child:
185:3b3cd96a7811
Commit message:
Testing PL_I2C_bae way

Changed in this revision

COM_MNG_TMTC.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
i2c.h Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Sat Jun 11 08:51:16 2016 +0000
+++ b/COM_MNG_TMTC.h	Sat Jun 11 10:05:52 2016 +0000
@@ -806,20 +806,14 @@
             {
                 if(PYLD_I2C_Int == 1)
                 {
-                    read_ack = master.read(addr_pl|1,PL_I2C_DATA,134);
-                    if(read_ack) gPC.printf("\n\rData not received from PL \n") else gPC.printf("\n\rData received from PL \n");
-                    gLEDR=!gLEDR;
-                    for(int i = 0;i< PL_TM_SIZE;i++)
-                        tm_pointer->TM_string[i] = PL_I2C_DATA[i];
-                        received++;
-                    break;   
+                    
+                    //printf("receiving...\r\n");
+                    FCTN_I2C_READ_PL((char*)tm_pointer->TM_string,134);
+                    gPC.printf("%s", tm_pointer->TM_string);
+                    received+=1;
+                    break; //only for testing purpose
                 }
             }
-            else
-            {
-                
-                break;
-            }
             if(received < 1 )
             {
                 printf("Telemetry is not received from BAE\r\n");
@@ -1238,7 +1232,7 @@
                             /*SEND call sign, ACK_L1, NON OBSRS TM TO GS*/\
                             snd_tm.head_pointer(tm_ptr_head);\
                             gPC.puts("enter_adf\r\n");\
-                            transmit_adf;\
+                            /*transmit_adf;*/\
                             gPC.puts("exit_adf\r\n");\ 
                             /*DELETE THE TM AFTER USE*/\
                             tm_ptr = tm_ptr_head;\
@@ -1266,7 +1260,7 @@
                             /*read_TC(current_TC);*/\
                             execute_OBSRS_TC(current_TC);\
                             gPC.puts("enter_adf\r\n");\
-                            transmit_adf;\
+                            /*transmit_adf;*/\
                             gPC.puts("exit_adf\r\n");\
                             uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\
                             PUTexec_status(current_TC, tempExec);\
--- a/DefinitionsAndGlobals.h	Sat Jun 11 08:51:16 2016 +0000
+++ b/DefinitionsAndGlobals.h	Sat Jun 11 10:05:52 2016 +0000
@@ -12,7 +12,7 @@
     
 // COMMON SPI
     #define SPI_MOSI PTE1
-    #define SPI_MISO PTE3
+    #define SPI_MISO PTE2
     #define SPI_CLK PTE2
     #define SPI_CS_ADF PTA15
     #define SPI_CS_SDC PIN20
@@ -28,7 +28,8 @@
     
 //I2C - Payload to CDMS (need to change while using CDMS hardware);
 I2C master(PIN32,PIN31);
-InterruptIn PYLD_I2C_Int(PTC13);
+DigitalIn PYLD_I2C_Int(PTC13);
+DigitalOut PYLD_I2C_GPIO(PTE3);
 
 //I2C - CDMS to BAE
 DigitalIn BAE_I2C_GPIO(PIN39);
--- a/i2c.h	Sat Jun 11 08:51:16 2016 +0000
+++ b/i2c.h	Sat Jun 11 10:05:52 2016 +0000
@@ -25,6 +25,22 @@
         }
 }
 
+void FCTN_I2C_READ_PL(char *data,int length)
+{   
+    PYLD_I2C_GPIO = 1;
+    //t_read.start();
+    read_ack = master.read(addr_pl|1,data,length);
+    //t_read.stop();
+  
+    if(read_ack == 0)
+        gPC.printf("\n\rData received from PL \n");
+ if (read_ack == 1)
+    {
+        gPC.printf("\n \r data not received \n");
+    }
+    PYLD_I2C_GPIO = 0;
+}
+
 void FCTN_I2C_READ(char *data,int length)
 {   
     CDMS_I2C_GPIO = 1;
@@ -64,12 +80,4 @@
     CDMS_I2C_GPIO = 0;
     //gPC.printf("\n\r %d \n",t.read_us());
     //t.reset();
-}
-
-void isr_pyldtm()
-{
-
-    read_ack = master.read(addr_pl|1,PL_I2C_DATA,134);
-    gLEDR=!gLEDR;
-    rcv_isr = 1;
 }
\ No newline at end of file