I2C code testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_pl123 by Siva ram

Revision:
72:9eea047ebd0c
Parent:
52:0bd68655c651
--- a/Structures.h	Tue Jan 19 10:30:46 2016 +0000
+++ b/Structures.h	Sun Jan 24 09:21:57 2016 +0000
@@ -98,17 +98,22 @@
 
 // TELEMETRY:
 // MASKS
-#define SHORT_LONG_TM_MASK 0x10
-#define TMID_MASK 0x0F
+
+// short_or_long mask for fields variable
+#define SHORT_LONG_TM_MASK 0x01
+
+// tmid mask to read from telemetry
+#define TMID_MASK_LONG 0x78
+#define TMID_MASK_SHORT 0xF0
 
-//x should be 'fields' variable defined in the Base_tm
-#define GETshort_or_long_tm(x) ((x & SHORT_LONG_TM_MASK) >> 4)
-#define GETtmid(x) (x & TMID_MASK)
+//x should be Base_tm ptr
+#define GETshort_or_long_tm(x) (((x->fields) & SHORT_LONG_TM_MASK))
+#define GETtmid(x) (GETshort_or_long(x) == TM_SHORT_CODE ? ((x->TM_string[0] & TMID_MASK_SHORT) >> 4) : ((x->TM_string[0] & TMID_MASK_LONG) >> 3) )
 
-//x should be 'fields' variable defines in the Base_tm
+//x should be Base_tm pointer
 //y should be an 8-bit number with relevent data at LSB
-#define PUTshort_or_long_tm(x,y) x = (x & ~(SHORT_LONG_TM_MASK)) | ((y<<4) & SHORT_LONG_TM_MASK)
-#define PUTtmid(x,y) x = (x & ~(TMID_MASK)) | (y & TMID_MASK)
+#define PUTshort_or_long_tm(x,y) x->fields = ((x->fields) & ~(SHORT_LONG_TM_MASK)) | ((y) & SHORT_LONG_TM_MASK)
+// #define PUTtmid(x,y) x = (x & ~(TMID_MASK)) | (y & TMID_MASK)
 
 // PARENT TELEMETRY CLASS
 class Base_tm{