tc execution

Dependencies:   mbed-rtos mbed

Fork of BAE_vr2_gingerbread by sakthi priya amirtharaj

Files at this revision

API Documentation at this revision

Comitter:
sakthipriya
Date:
Wed Dec 17 12:48:19 2014 +0000
Parent:
2:7aede71f4c22
Commit message:
tc execution added

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Dec 17 09:46:36 2014 +0000
+++ b/main.cpp	Wed Dec 17 12:48:19 2014 +0000
@@ -49,7 +49,7 @@
 
 
 
-Mail<i2c_data,16> i2c_data_receive;
+//Mail<i2c_data,16> i2c_data_receive;
 Mail<i2c_data,16> i2c_data_send;
 
 //--------------------------------------------------------------------------------------------------------------------------------------------------
@@ -236,7 +236,7 @@
 //---------------------------------------------------------------------------------------------------------------------------------------------------
 //TASK 5 : i2c data
 //---------------------------------------------------------------------------------------------------------------------------------------------------
-
+void tc_execute (char command) ;
  
 void C_FUNC_INT()
 {
@@ -318,7 +318,7 @@
             printf("\ndone\n\r");
 
 }
-char data_send[25],data_receive[25];
+char data_send[25],data_receive;
 void T_I2C_BAE()
 {
     //char data_send,data_receive;
@@ -331,13 +331,14 @@
         if(i2c_status == 0 && reset !=1)
         {
             
-            FUNC_I2C_WRITE2CDMS(data_receive,25);
-            i2c_data * i2c_data_r = i2c_data_receive.alloc();
-            strcpy(i2c_data_r->data,data_receive);
-            i2c_data_r->length = 25;
-            i2c_data_receive.put(i2c_data_r);
-            printf("\n Data received from CDMS is %s \n\r",data_receive);
-            i2c_data_receive.free(i2c_data_r);                              // This has to be done from a differen thread
+            FUNC_I2C_WRITE2CDMS(&data_receive,1);
+            printf("\n received\n");
+            /*i2c_data * i2c_data_r = i2c_data_receive.alloc();
+            i2c_data_r->data = data_receive;
+            i2c_data_r->length = 1;
+            i2c_data_receive.put(i2c_data_r);*/
+            printf("\n Data received from CDMS is %c \n\r",data_receive);
+            tc_execute(data_receive);                             // This has to be done from a differen thread
             
         }
         else if(i2c_status ==1 && reset !=1)
@@ -406,17 +407,23 @@
         //temp = i2c_status;
 }
       
-   
+
+//------------------------------------------------------------------------------------------------------------------------------------------------
+//TELECOMMAND
+//------------------------------------------------------------------------------------------------------------------------------------------------
+void tc_execute (char command)  
+{ switch(command)
+   {   case '0' : printf("command 0 executed");
+       break;
+       case '1' : printf("command 1 executed");
+       break;
+       case '2' : printf("command 2 executed");
+       break;
+       case '3' : printf("command 3 executed");
+    }
+}  
    
 
-
-
-
-
-
-
-
-
 //------------------------------------------------------------------------------------------------------------------------------------------------
 //SCHEDULER
 //------------------------------------------------------------------------------------------------------------------------------------------------
@@ -472,9 +479,9 @@
     interrupt_fault();
     
     //ptr_t_fault -> set_priority(osPriorityRealtime);
-    ptr_t_acs->set_priority(osPriorityHigh);
-    ptr_t_i2c->set_priority(osPriorityAboveNormal);
-    ptr_t_hk_acq->set_priority(osPriorityNormal);
+    ptr_t_acs->set_priority(osPriorityAboveNormal);
+    ptr_t_i2c->set_priority(osPriorityHigh);
+    ptr_t_hk_acq->set_priority(osPriorityAboveNormal);
     //ptr_t_acs_write2flash->set_priority(osPriorityBelowNormal);
     ptr_t_bea->set_priority(osPriorityAboveNormal);
     //ptr_t_bea_telecommand->set_priority(osPriorityIdle);