beacon on/off implemented and working

Dependencies:   mbed-rtos mbed

Fork of i2c_configuring by sakthi priya amirtharaj

Files at this revision

API Documentation at this revision

Comitter:
sakthipriya
Date:
Sun May 17 19:40:48 2015 +0000
Parent:
5:bf1f3504cd9d
Commit message:
beacon on/off implemented and working

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun May 17 06:18:41 2015 +0000
+++ b/main.cpp	Sun May 17 19:40:48 2015 +0000
@@ -67,7 +67,7 @@
         FUNC_HK_FAULTS();                                        // !Actual fault management is not implemented : polling
         FUNC_HK_POWER(SensorQuantised.power_mode);               // !The power mode algorithm is yet to be obtained  // status of power modde will decide actions
         FUNC_HK_MAIN();                                          //Collecting HK data for ADC n 
-        FUNC_I2C_IR2CDMS();                                      //sending HK data to CDMS
+       //FUNC_I2C_IR2CDMS();                                      //sending HK data to CDMS
         t.stop();
         printf("The time to execute hk_acq is %f seconds\n\r",t.read());
         t.reset();
@@ -352,21 +352,24 @@
 //------------------------------------------------------------------------------------------------------------------------------------------------
 void FUNC_I2C_TC_EXECUTE (char command)  
 { switch(command)
-   {   case '0' : printf("command 0 executed");      // assuming telecommand to switch of beacon 
+   {   case '0' : printf("\n\rcommand 0 executed");      // assuming telecommand to switch of beacon 
                   beac_flag = 1;
-                  bea_timeout.attach(&FUNC_BEA_TIMEOUT, 600);
+                  bea_timeout.attach(&FUNC_BEA_TIMEOUT,35.0 );
+                  printf("\n\rbeacon switched off");
        break;
-       case '1' : printf("command 1 executed");
+       case '1' : printf("\n\rcommand 1 executed");
        break;
-       case '2' : printf("command 2 executed");
+       case '2' : printf("\n\rcommand 2 executed");
        break;
-       case '3' : printf("command 3 executed");
+       case '3' : printf("\n\rcommand 3 executed");
     }
 }
 
 void FUNC_BEA_TIMEOUT()
 {
+  // printf("\n\rbea on");
    beac_flag = 0;
+  
 }  
    
 
@@ -378,7 +381,7 @@
 void T_SC(void const *args)
 {
     //DRDY=0;
-    printf("The value of i in scheduler is %d\n\r",schedcount);
+    printf("\n\rThe value of i in scheduler is %d\n",schedcount);
     if(schedcount == 65532)                         //to reset the counter  // when it reaches here back to intial state
     {
         schedcount = 0;
@@ -386,20 +389,20 @@
     
     if(schedcount%1==0)
     {
-      // ptr_t_acs -> signal_set(0x1);
-      // ptr_t_wdt -> signal_set(0x5);
+      ptr_t_acs -> signal_set(0x1);
+      ptr_t_wdt -> signal_set(0x5);
     }
     if(schedcount%2==0)
     {
        // ptr_t_fault -> signal_set(0x2);
-       ptr_t_hk_acq -> signal_set(0x2);
+      ptr_t_hk_acq -> signal_set(0x2);
         
     }
     if(schedcount%beacon_sc==0)
     {
         if(beac_flag==0)
         {
-            //ptr_t_bea -> signal_set(0x3);
+            ptr_t_bea -> signal_set(0x3);
         }
     }
     schedcount++;
@@ -440,11 +443,17 @@
     RtosTimer t_sc_timer(T_SC,osTimerPeriodic);     //values -3 tpo +3
     t_sc_timer.start(10000);
     printf("\n\r%f\n\r",t1.read()); 
-     
+    FUNC_I2C_TC_EXECUTE ('0');
+    printf("\n \r check1 \n"); 
    interrupt.rise(&FUNC_I2C_INT);                             //interrupt received from CDMS
     while(1)                                                   //required to prevent main from terminating
     {   
         Thread::wait(5000);                     // main by default a thread of priority 0
+       // printf("\n \r check \n"); 
+       // FUNC_I2C_TC_EXECUTE ('0');               // this has to come through i2c from cdms. just for testing beacon on/off
+       
+      //
+      
     }
     
 }