pl ack in tmtc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_pl123 by shubham c

Revision:
140:4feeb1163bb6
Parent:
139:17353d6311ce
--- a/COM_MNG_TMTC.h	Wed Mar 30 14:04:48 2016 +0000
+++ b/COM_MNG_TMTC.h	Sat Apr 02 04:17:20 2016 +0000
@@ -1009,10 +1009,48 @@
             }   
                 
             if(GETshort_or_long_tc(tc_ptr) == LONG_TC_CODE)
-                FCTN_I2C_WRITE_PL((char*)tc_ptr->TC_string,TC_LONG_SIZE);
+                {
+                    int y=FCTN_I2C_WRITE_PL((char*)tc_ptr->TC_string,TC_LONG_SIZE);
+                    if(y==1)
+                    {
+                        tm_pointer->TM_string[0] = 0xB0; 
+                        tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                        tm_pointer->TM_string[2] = 0x33; //ack_code
+                        tm_pointer->TM_string[3] = 0x00; 
+                        tm_pointer->TM_string[4] = 0x00;
+                        for(uint8_t i=0;i<6;i++)
+                        {
+                            tm_pointer->TM_string[i+5] = 0;
+                        }
+                        crc16 = crc16_gen(tm_ptr->TM_string,11);
+                        tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                        tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                        tm_pointer->next_TM = NULL;                 
+                        return tm_ptr;
+                        break;
+                    }
+            }
             else 
             {
-                FCTN_I2C_WRITE_PL((char*)tc_ptr->TC_string,TC_SHORT_SIZE);
+                int y=FCTN_I2C_WRITE_PL((char*)tc_ptr->TC_string,TC_SHORT_SIZE);
+                if(y==1)
+                    {
+                        tm_pointer->TM_string[0] = 0xB0; 
+                        tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
+                        tm_pointer->TM_string[2] = 0x33; //ack_code
+                        tm_pointer->TM_string[3] = 0x00; 
+                        tm_pointer->TM_string[4] = 0x00;
+                        for(uint8_t i=0;i<6;i++)
+                        {
+                            tm_pointer->TM_string[i+5] = 0;
+                        }
+                        crc16 = crc16_gen(tm_ptr->TM_string,11);
+                        tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
+                        tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
+                        tm_pointer->next_TM = NULL;                 
+                        return tm_ptr;
+                        break;
+                    }
             }