i2c working with new hk(no pin conflict)

Dependencies:   mbed-rtos mbed

Fork of BAE_vr2_1_4 by sakthi priya amirtharaj

Revision:
1:bd715ccef1bb
Parent:
0:e9c32e1df869
Child:
2:7aede71f4c22
--- a/main.cpp	Wed Dec 17 06:52:26 2014 +0000
+++ b/main.cpp	Wed Dec 17 09:18:36 2014 +0000
@@ -40,7 +40,7 @@
 
 typedef struct
 {
-    char data[30];          // To avoid dynamic memory allocation
+    char data[25];          // To avoid dynamic memory allocation
     int length;
 }i2c_data;
 
@@ -56,7 +56,7 @@
 //TASK 2 : HK
 //--------------------------------------------------------------------------------------------------------------------------------------------------
 
-char hk_data[30];
+char hk_data[25];
 extern SensorDataQuantised SensorQuantised;
 void t_hk_acq(void const *args)
 {
@@ -71,7 +71,7 @@
         POWER(SensorQuantised.power_mode);                                                   //The power mode algorithm is yet to be obtained
         FUNC_HK_MAIN();                                                             //Collecting HK data
         //thread_2.signal_set(0x4);
-        //FUNC_I2C_SLAVE_MAIN(30);    
+        //FUNC_I2C_SLAVE_MAIN(25);    
         ir2master();
         t.stop();
         printf("The time to execute hk_acq is %f seconds\n",t.read());
@@ -303,7 +303,7 @@
             printf("\ndone\n\r");
 
 }
-char data_send[30],data_receive[30];
+char data_send[25],data_receive[25];
 void T_I2C_BAE()
 {
     //char data_send,data_receive;
@@ -316,10 +316,10 @@
         if(i2c_status == 0 && reset !=1)
         {
             
-            FUNC_I2C_WRITE2CDMS(data_receive,30);
+            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 = 30;
+            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
@@ -332,7 +332,7 @@
             {
                 i2c_data *i2c_data_s = (i2c_data*)evt.value.p;
                 strcpy(data_send,i2c_data_s -> data);
-                FUNC_I2C_WRITE2CDMS(data_send,30);
+                FUNC_I2C_WRITE2CDMS(data_send,25);
                 printf("\nData sent to CDMS is %s\n\r",data_send);
                 i2c_data_send.free(i2c_data_s);
                 i2c_status = 0;
@@ -363,7 +363,7 @@
 void ir2master()
 {
         
-        //char data[30];
+        //char data[25];
         //strcpy(data,"sakthi ");
         //strcat(data,"priya");
         strcpy(hk_data,SensorQuantised.Voltage);
@@ -385,7 +385,7 @@
         i2c_status=1;
         i2c_data * i2c_data_s = i2c_data_send.alloc();
         strcpy(i2c_data_s->data,hk_data);
-        i2c_data_s->length = 30;
+        i2c_data_s->length = 25;
         i2c_data_send.put(i2c_data_s); 
         data_ready=1;
         //temp = i2c_status;
@@ -431,7 +431,7 @@
         if(beac_flag==0)
         {
             
-            ptr_t_bea -> signal_set(0x3);
+            //ptr_t_bea -> signal_set(0x3);
         }
     }
     schedcount++;