lkdsnf;

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_PL_Working by Siva ram

Revision:
132:d4a4461214ad
Parent:
130:d5b53088270b
Child:
136:8074893cd24e
--- a/main.cpp	Sat Feb 27 07:12:04 2016 +0000
+++ b/main.cpp	Mon Feb 29 13:21:40 2016 +0000
@@ -2,7 +2,10 @@
 
 #include "mbed.h"
 
+uint8_t rcv_isr = 0; // flag for interrupt
+
 #define DEBUG 1
+#define SDCARD 0
 
 #include "SimpleDMA.h"
 #include "dmaSPIslave.h"
@@ -28,6 +31,8 @@
 #include "ThreadsAndFunctions.h"
 
 //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
+
+
 int main()
 {
     //gLEDR = 1;
@@ -43,7 +48,7 @@
     RX1M.attach(&rx_read, Serial::RxIrq);
     
     //I2C to Payload    (depends on pl interrupt design)
-    //PYLD_I2C_Int.rise(&isr_pyldtm);
+    PYLD_I2C_Int.rise(&isr_pyldtm);
     
     
     // DEBUG
@@ -60,7 +65,9 @@
     gCS_ADF = 1;
     
     //FCTN_CDMS_INIT_RTC();/* rtc initialization*/
+    #if SDCARD
     FCTN_CDMS_SD_INIT();/* sd card initialization*/
+    #endif
     
     #if DEBUG
     gPC.puts("welcome to mng_tmtc\r\n");
@@ -72,15 +79,16 @@
     #if DEBUG
     gPC.puts("allocating threads\r\n");
     #endif
+    #if SDCARD
     gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
    // gPC.puts("step one complete\r\n");
     gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
+    #endif
     
     #if DEBUG
     gPC.puts("competed allocating threads\r\n");
     #endif
-    
-    
+      
     // *******************INITIALISATIONS END********************
     
     //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
@@ -100,9 +108,27 @@
     {delete gSCIENCE_THREAD;
     break;}
     }*/
-    
-    
-    
+    int i =0 ;
+    char test[1] ;
+    test[0] = 7;
+    while(1)
+    {
+        
+        wait(5);
+        printf("Wriring to I2C\n");
+        master.write(addr_pl|0x00,test,1);
+        
+        if(rcv_isr == 1)
+        {
+            for(i = 0; i < 134 ; i++)
+            {
+                printf("%d\r\n",PL_I2C_DATA[i]);
+            }
+            rcv_isr = 0;
+        }
+        
+    }
+   
     while(true){
         Thread::wait(osWaitForever);
         //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';