Latest FM Code with EEPROM
Dependencies: FreescaleIAP SimpleDMA eeprom mbed-rtos mbed
Fork of CDMS_QM_03MAR2017_Flash_with_obsrs by
Diff: COM_MNG_TMTC.h
- Revision:
- 147:7fd1ca3a35a1
- Parent:
- 136:8074893cd24e
- Child:
- 151:e6c7d4f87704
--- a/COM_MNG_TMTC.h Thu Mar 10 15:26:50 2016 +0000 +++ b/COM_MNG_TMTC.h Sat Apr 02 13:54:24 2016 +0000 @@ -14,7 +14,6 @@ #include "cdms_rtc.h" Timer t_pl; //defined in definations and globals, need to mapped with the final ones. -//DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE //DigitalIn tm_status_4m_pl(PIN61); //I2C interrupt to CDMS from PL uint8_t received = 0; @@ -407,26 +406,33 @@ { case 1: //apid=01 implies it corresponds to bae { - //printf("Telecommand is for BAE\r\n"); + printf("Telecommand is for BAE\r\n"); //printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae - //FCTN_I2C_WRITE((char*)tc_ptr->TC_string); -// while(1) -// { -// wait(1); //TimeOut instead of wait -// if(tm_status_4m_slv == 1) -// { -// //printf("receiving...\r\n"); -// FCTN_I2C_READ((char*)tm_pointer->TM_string,134); -// //printf("%s", tm_pointer->TM_string); -// received+=1; -// tm_pointer = tm_pointer->next_TM; -// break; //only for testing purpose -// } -// else -// { -// break; -// } -// } + + if(GETshort_or_long_tc(tc_ptr) == LONG_TC_CODE) + FCTN_I2C_WRITE((char*)tc_ptr->TC_string,TC_LONG_SIZE); + else + { + FCTN_I2C_WRITE((char*)tc_ptr->TC_string,TC_SHORT_SIZE); + } + + while(1) + { + wait(1); //TimeOut instead of wait + if(BAE_I2C_GPIO == 1) + { + //printf("receiving...\r\n"); + FCTN_I2C_READ((char*)tm_pointer->TM_string,TM_LONG_SIZE); + //printf("%s", tm_pointer->TM_string); + received+=1; + tm_pointer = tm_pointer->next_TM; + break; //only for testing purpose + } + else + { + break; + } + } // if(received >= 1 ) // { // //printf("Telemetry is received from BAE\r\n"); @@ -455,7 +461,7 @@ // 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; + //tm_pointer->next_TM = NULL; return tm_ptr; // } break; } @@ -501,7 +507,7 @@ //Data[0] = FCTN_CDMS_RD_FLASH(0); //Data[1] = FCTN_CDMS_RD_FLASH(1); //tm_pointer = new Long_tm; - tm_pointer->TM_string[0] = 0xB0; + tm_pointer->TM_string[0] = 0x30; tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr); tm_pointer->TM_string[2] = ACKCODE;