hkdata send using string working

Dependencies:   mbed-rtos mbed

Fork of greenisthemaster by green rosh

Files at this revision

API Documentation at this revision

Comitter:
raizel_varun
Date:
Tue Dec 16 11:05:44 2014 +0000
Parent:
4:cf8d2c7b65ad
Commit message:
BAE_vr 2.1.0 [hk_data in string] working

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r cf8d2c7b65ad -r 29ec04694833 main.cpp
--- a/main.cpp	Tue Dec 16 10:17:03 2014 +0000
+++ b/main.cpp	Tue Dec 16 11:05:44 2014 +0000
@@ -11,7 +11,7 @@
 
 typedef struct
 {
-    char data[13];          // To avoid dynamic memory allocation
+    char data[35];          // To avoid dynamic memory allocation
     int length;
 }i2c_data;
 
@@ -76,14 +76,14 @@
             
 void T_I2C_MASTER_FSLAVE(void const *args)
 {
-    char data_receive[13];
+    char data_receive[35];
     while(1)
     {
         Thread::signal_wait(0x1);
-        FUNC_I2C_MASTER_FSLAVE(data_receive,13);
+        FUNC_I2C_MASTER_FSLAVE(data_receive,35);
         i2c_data * i2c_data_r = i2c_data_receive.alloc();
         strcpy(i2c_data_r->data , data_receive);
-        i2c_data_r->length = 13;
+        i2c_data_r->length = 35;
         i2c_data_receive.put(i2c_data_r);
         printf("\n Data received from slave is %s\n\r",data_receive);
         i2c_data_receive.free(i2c_data_r);
@@ -97,7 +97,7 @@
      
 }
 
-char writedata[13];
+char writedata[35];
 bool write2slave;
 bool master_status_write;
 void FUNC_MASTER_WRITE()
@@ -106,12 +106,12 @@
    
     interrupt = 1;
      
-    char data[13];
+    char data[35];
     strcpy(data,"sakthi");
     strcat(data,"priya");
     i2c_data * i2c_data_s = i2c_data_send.alloc();
     strcpy(i2c_data_s->data ,data);
-    i2c_data_s->length = 13;
+    i2c_data_s->length = 35;
     i2c_data_send.put(i2c_data_s); 
     master_status_write = true;
     
@@ -127,7 +127,7 @@
                 {                
                 printf("master clk freq setup and addressing slave\n\r");
                 master.start();                                 //initiating the data transfer
-                master_status_write = (bool) master.write(addr|0x00,writedata,13);
+                master_status_write = (bool) master.write(addr|0x00,writedata,35);
                 if(master_status_write==0)
                     {
                     printf("master has written %s to slave\n\r",writedata);