publishing to check changes in cdms code
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA_flag by
Diff: CDMS_HK.h
- Revision:
- 251:c766afa330a3
- Parent:
- 247:d0be0773b951
- Child:
- 253:fd6696d91e74
- Child:
- 255:642ea552ac77
diff -r d0be0773b951 -r c766afa330a3 CDMS_HK.h --- a/CDMS_HK.h Mon Jul 11 09:48:57 2016 +0000 +++ b/CDMS_HK.h Mon Jul 11 12:30:41 2016 +0000 @@ -23,21 +23,28 @@ DigitalOut SelectLinec1 (PIN77); DigitalOut SelectLinec0 (PIN76); // LSB of Select Lines +Convolution CDMS_HEALTH; +Convolution BAE_HEALTH; +unsigned char CDMS_HK_FRAME[134] = {0}; +char BAE_HK[134] = {0}; +uint8_t convoluted_CDMS_HK[270]; +uint8_t interleave_CDMS_HK[288]; +uint8_t CDMS_HEALTH_FINAL[512] = {0}; +uint8_t convoluted_BAE_HK[270]; +uint8_t interleave_BAE_HK[288]; +uint8_t BAE_HEALTH_FINAL[512] = {0}; +unsigned char BAE_HK_FRAME[134] = {0}; + + + void FCTN_CDMS_HK_MAIN(void const *args) { while(1) { gPC.printf("Entering HK thread"); gHK_THREAD->signal_wait(HK_SIGNAL); - unsigned char CDMS_HK_FRAME[134] = {0}; - char BAE_HK[134] = {0}; - uint8_t convoluted_CDMS_HK[270]; - uint8_t interleave_CDMS_HK[288]; - uint8_t CDMS_HEALTH_FINAL[512] = {0}; - uint8_t convoluted_BAE_HK[270]; - uint8_t interleave_BAE_HK[288]; - uint8_t BAE_HEALTH_FINAL[512] = {0}; - unsigned char BAE_HK_FRAME[134] = {0}; + + gMutex.lock(); CDMS_HK_MAIN_STATUS = 0x01; CDMS_HK_MAIN_COUNTER++; @@ -84,13 +91,12 @@ uint16_t crc = crc16_gen(CDMS_HK_FRAME,132); /*Adding CRC to TM frame*/ CDMS_HK_FRAME[133] = crc; CDMS_HK_FRAME[132] = crc >> 8; - - Convolution CDMS_HEALTH; - Convolution BAE_HEALTH; - //CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME , convoluted_CDMS_HK); - //CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME + 67, convoluted_CDMS_HK + 135); - //interleave(convoluted_CDMS_HK , interleave_CDMS_HK); - //interleave(convoluted_CDMS_HK +135, interleave_CDMS_HK + 144); + + exor(CDMS_HK_FRAME); + CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME , convoluted_CDMS_HK); + CDMS_HEALTH.convolutionEncode(CDMS_HK_FRAME + 67, convoluted_CDMS_HK + 135); + interleave(convoluted_CDMS_HK , interleave_CDMS_HK); + interleave(convoluted_CDMS_HK +135, interleave_CDMS_HK + 144); for(int i=0; i<288; i++) CDMS_HEALTH_FINAL[i] = interleave_CDMS_HK[i]; @@ -119,10 +125,11 @@ crc = crc16_gen(BAE_HK_FRAME,132); /*Adding CRC to TM frame*/ BAE_HK_FRAME[133] = crc; BAE_HK_FRAME[132] = crc >> 8; - //BAE_HEALTH.convolutionEncode(BAE_HK_FRAME , convoluted_BAE_HK); - //BAE_HEALTH.convolutionEncode(BAE_HK_FRAME + 67, convoluted_BAE_HK + 135); - //interleave(convoluted_BAE_HK , interleave_BAE_HK); - //interleave(convoluted_BAE_HK +135, interleave_BAE_HK + 144); + exor(BAE_HK_FRAME); + BAE_HEALTH.convolutionEncode(BAE_HK_FRAME , convoluted_BAE_HK); + BAE_HEALTH.convolutionEncode(BAE_HK_FRAME + 67, convoluted_BAE_HK + 135); + interleave(convoluted_BAE_HK , interleave_BAE_HK); + interleave(convoluted_BAE_HK +135, interleave_BAE_HK + 144); for(int i=0; i<288; i++) BAE_HEALTH_FINAL[i] = interleave_BAE_HK[i]; //SD_WRITE(BAE_HEALTH_FINAL,FSC_CURRENT[5]+1,5); @@ -146,6 +153,7 @@ SC_HK_LBM_0[133] = crc >> 8; FCTN_I2C_WRITE((char *)SC_HK_LBM_0,135); gPC.printf("\rCompleted Beacon\n"); + gMutex.unlock(); } }