11th feb i2c checking chaitu's code

Dependencies:   SimpleDMA eeprom mbed-rtos mbed

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Revision:
4:104dd82c99b8
Parent:
3:6c81fc8834e2
Child:
5:ab276a17ca07
diff -r 6c81fc8834e2 -r 104dd82c99b8 DefinitionsAndGlobals.h
--- a/DefinitionsAndGlobals.h	Wed Dec 23 05:37:55 2015 +0000
+++ b/DefinitionsAndGlobals.h	Tue Dec 29 06:50:19 2015 +0000
@@ -1,8 +1,8 @@
 // **************DEFINITIONS*********************
 // COM_RX
-    #define RX_TIMEOUT_LIMIT 1.0
-    #define COM_RX_UART_TX PTE20
-    #define COM_RX_UART_RX PTE21
+    #define RX_TIMEOUT_LIMIT 3
+    #define COM_RX_UART_TX USBTX
+    #define COM_RX_UART_RX USBRX
 
 // COMMON SPI
     #define SPI_MOSI PTE1
@@ -12,6 +12,9 @@
     #define SPI_CS_SDC PTE22
     #define SPI_CS_RTC PTE29
     
+// COM_TX
+    #define COM_TX_CONFIG_LIMIT 3
+
 // ADF INTERRUPUT
     #define ADF_IRQ PTA14
 
@@ -46,6 +49,8 @@
 
 // COM_MNG_TMTC
     #define COM_PA_COOLING_TIME_LIMIT 20
+    #define COM_MAX_TC_LIMIT 200
+    #define TM_ACK_CODE_INDEX 2
     
     // call sign
     #define PSC_CALLSIGN 0x00
@@ -53,6 +58,7 @@
     
     // max value of telecommands in a tcl
     #define TCL_OVERFLOW_CONSTANT 256
+    #define TM_OVERFLOW_CONSTANT 256
 
     // starting value of packet sequence count at each pass 
     #define PSC_START_VALUE 1
@@ -74,12 +80,20 @@
     
     // TMID list
     #define TMID_ACK_L1 0xA
+    #define TMID_ACK_L234 0xB
+    #define TMID_TCL 0x7
+    #define TMID_CALL_SIGN 0xE
 
 // OBOSC SERVICE SUBTYPE
+    #define OBOSC_TCL_MAX_SHORT_SIZE 11
+    #define OBOSC_LONG_TC_FIRST_HALF_SIZE 67
+    #define OBOSC_LONG_TC_SECOND_HALF_SIZE 68
+    #define OBOSC_TCL_TAG_LONG_FIRST_HALF 0x10
+    #define OBOSC_TCL_TAG_LONG_SECOND_HALF 0x11
+
     #define OBOSC_SUB_DISABLE 0x01
     #define OBOSC_SUB_RETRY 0x05
-    #define OBOSC_SUB_REP_TCL_D 0x06
-    #define OBOSC_SUB_REP_TCL 0x08
+    #define OBOSC_SUB_REP_TCLD 0x06
     #define OBOSC_SUB_REP_LE 0x0F
     #define OBOSC_SUB_RESET 0x07
     
@@ -89,8 +103,8 @@
 // ****************GLOBAL VARIABLES******************
 // DEBUG
 Serial gPC( USBTX, USBRX );
-//DigitalOut gLEDR(LED_RED);
-//DigitalOut gLEDG(LED_GREEN);
+DigitalOut gLEDR(LED_RED);
+DigitalOut gLEDG(LED_GREEN);
 
 // COM_RX
 RawSerial RX1M( COM_RX_UART_TX, COM_RX_UART_RX );
@@ -123,18 +137,19 @@
 // COM_MNG_TMTC
 
 // PA cooling timeout
-Timeout gCOM_PA_COOLING_TIMER;
+Timeout gCOM_PA_COOLING_TIMEOUT;
 
 // GS code for verification
 const uint8_t gGSCODE[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 uint8_t gTOTAL_VALID_TC = 0x00;
 // USE LAST_L1_ACK FOR GENERATING REPORT
-uint8_t gLAST_L1_ACK[TM_SHORT_SIZE];
-uint8_t gLAST_L1_ACK_BUFFER[TM_SHORT_SIZE];
-uint8_t gOBOSC_PSC = PSC_START_VALUE;
-Base_tc* gOBOSC_HEAD = NULL;
+uint8_t gLAST_TM[TM_LONG_SIZE];
+uint8_t gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;
 
 // SCIENCE_THREAD
 Thread* gSCIENCE_THREAD = NULL;
-uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH];
\ No newline at end of file
+uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH];
+
+// CALL SIGN TM
+const uint8_t gCALL_SIGN_STRING[TM_SHORT_SIZE] = {0xE0, 0x00, 0x00, 0x00, 0x56, 0x55, 0x32, 0x4E, 0x43, 0x46, 0x00, 0xAC, 0x11};
\ No newline at end of file