Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
CDMS_HK.h@246:565458eefd94, 2016-07-10 (annotated)
- Committer:
- ee12b079
- Date:
- Sun Jul 10 21:32:28 2016 +0000
- Revision:
- 246:565458eefd94
- Parent:
- 245:da9d1bd999da
- Child:
- 247:d0be0773b951
part of HK commented, threads integrated, a bug to be solved : change all unsigned char to uint8_t
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ee12b079 | 210:f4acf895b598 | 1 | |
shreeshas95 | 103:b55559925dc1 | 2 | |
shreeshas95 | 103:b55559925dc1 | 3 | void FCTN_CDMS_HK_MAIN(); |
shreeshas95 | 103:b55559925dc1 | 4 | void FCTN_CDMS_HK(); |
ee12b079 | 210:f4acf895b598 | 5 | void VERIFY_COMRX(); |
ee12b079 | 210:f4acf895b598 | 6 | void VERIFY_RTC(); |
ee12b079 | 210:f4acf895b598 | 7 | void CDMS_HK_SD(); |
ee12b079 | 210:f4acf895b598 | 8 | void HANDLE_HW_FAULTS(); |
ee12b079 | 210:f4acf895b598 | 9 | void HANDLE_HW_FAULT_SD(); |
ee12b079 | 210:f4acf895b598 | 10 | void HANDLE_HW_FAULT_BAE(); |
ee12b079 | 210:f4acf895b598 | 11 | void HANDLE_HW_FAULT_PL(); |
ee12b079 | 210:f4acf895b598 | 12 | void FUNC_CDMS_GPIO_STATUS(); |
ee12b079 | 210:f4acf895b598 | 13 | void minMaxHkData(); |
ee12b079 | 210:f4acf895b598 | 14 | void COLLECT_CDMS_RAM(); |
shreeshas95 | 103:b55559925dc1 | 15 | |
ee12b079 | 210:f4acf895b598 | 16 | AnalogIn TempInput(PIN27); // Input from Current Multiplexer |
shreeshas95 | 103:b55559925dc1 | 17 | AnalogIn CDMS_temp_sensor(PIN53); |
ee12b079 | 210:f4acf895b598 | 18 | AnalogIn COMRX_RSSI_volatge(PIN70); |
ee12b079 | 210:f4acf895b598 | 19 | |
shreeshas95 | 103:b55559925dc1 | 20 | |
shreeshas95 | 103:b55559925dc1 | 21 | DigitalOut SelectLinec3 (PIN79); // MSB of Select Lines |
shreeshas95 | 103:b55559925dc1 | 22 | DigitalOut SelectLinec2 (PIN78); |
shreeshas95 | 103:b55559925dc1 | 23 | DigitalOut SelectLinec1 (PIN77); |
shreeshas95 | 103:b55559925dc1 | 24 | DigitalOut SelectLinec0 (PIN76); // LSB of Select Lines |
shreeshas95 | 103:b55559925dc1 | 25 | |
shreeshas95 | 104:a50ae79ca36e | 26 | void FCTN_CDMS_HK_MAIN(void const *args) |
shreeshas95 | 103:b55559925dc1 | 27 | { |
ee12b079 | 245:da9d1bd999da | 28 | while(1) |
ee12b079 | 245:da9d1bd999da | 29 | { |
chaithanyarss | 224:3ac1f91e0ebc | 30 | gPC.printf("Entering HK thread"); |
ee12b079 | 245:da9d1bd999da | 31 | gHK_THREAD->signal_wait(HK_SIGNAL); |
chaithanyarss | 224:3ac1f91e0ebc | 32 | unsigned char CDMS_HK_FRAME[134] = {0}; |
ee12b079 | 245:da9d1bd999da | 33 | char BAE_HK[134] = {0}; |
chaithanyarss | 224:3ac1f91e0ebc | 34 | uint8_t convoluted_CDMS_HK[270]; |
chaithanyarss | 224:3ac1f91e0ebc | 35 | uint8_t interleave_CDMS_HK[288]; |
chaithanyarss | 224:3ac1f91e0ebc | 36 | uint8_t CDMS_HEALTH_FINAL[512] = {0}; |
chaithanyarss | 224:3ac1f91e0ebc | 37 | uint8_t convoluted_BAE_HK[270]; |
chaithanyarss | 224:3ac1f91e0ebc | 38 | uint8_t interleave_BAE_HK[288]; |
chaithanyarss | 224:3ac1f91e0ebc | 39 | uint8_t BAE_HEALTH_FINAL[512] = {0}; |
chaithanyarss | 224:3ac1f91e0ebc | 40 | unsigned char BAE_HK_FRAME[134] = {0}; |
ee12b079 | 210:f4acf895b598 | 41 | |
chaithanyarss | 224:3ac1f91e0ebc | 42 | CDMS_HK_MAIN_STATUS = 0x01; |
chaithanyarss | 224:3ac1f91e0ebc | 43 | CDMS_HK_MAIN_COUNTER++; |
ee12b079 | 210:f4acf895b598 | 44 | |
chaithanyarss | 224:3ac1f91e0ebc | 45 | FCTN_CDMS_HK(); |
chaithanyarss | 224:3ac1f91e0ebc | 46 | RSSI_volatge = COMRX_RSSI_volatge.read() * 3.3; |
chaithanyarss | 224:3ac1f91e0ebc | 47 | VERIFY_COMRX(); |
chaithanyarss | 224:3ac1f91e0ebc | 48 | VERIFY_RTC(); |
chaithanyarss | 224:3ac1f91e0ebc | 49 | HANDLE_HW_FAULTS(); |
chaithanyarss | 224:3ac1f91e0ebc | 50 | FUNC_CDMS_GPIO_STATUS(); //yet to be done |
ee12b079 | 210:f4acf895b598 | 51 | |
chaithanyarss | 224:3ac1f91e0ebc | 52 | uint8_t CDMS_quant[19]; |
chaithanyarss | 224:3ac1f91e0ebc | 53 | for(int i=0; i<16; i++) { |
chaithanyarss | 224:3ac1f91e0ebc | 54 | CDMS_quant[i]= (uint8_t)quant_data.temp_quant[i]; |
chaithanyarss | 224:3ac1f91e0ebc | 55 | } |
chaithanyarss | 224:3ac1f91e0ebc | 56 | CDMS_quant[16]= (uint8_t)RSSI_volatge; |
chaithanyarss | 224:3ac1f91e0ebc | 57 | CDMS_quant[17]= (uint8_t)quant_data.CDMS_temp_quant; |
chaithanyarss | 224:3ac1f91e0ebc | 58 | minMaxHkData(); |
ee12b079 | 210:f4acf895b598 | 59 | |
chaithanyarss | 224:3ac1f91e0ebc | 60 | uint64_t time = FCTN_CDMS_RD_RTC(); //Reading Time from RTC |
chaithanyarss | 224:3ac1f91e0ebc | 61 | gPC.printf("0x%08X \n",time); |
chaithanyarss | 224:3ac1f91e0ebc | 62 | time = time>>7; |
chaithanyarss | 224:3ac1f91e0ebc | 63 | uint32_t HK_time = (uint32_t)time; |
chaithanyarss | 224:3ac1f91e0ebc | 64 | for(int i = 0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 65 | CDMS_HEALTH_DATA[i] = HK_time >> i; |
chaithanyarss | 224:3ac1f91e0ebc | 66 | |
chaithanyarss | 224:3ac1f91e0ebc | 67 | // Here: Have to FIT flash data. |
chaithanyarss | 224:3ac1f91e0ebc | 68 | for(int i = 0; i<19; i++) //Collecting Data from Temp sensors |
chaithanyarss | 224:3ac1f91e0ebc | 69 | CDMS_HEALTH_DATA[i+24] = CDMS_quant[i]; |
chaithanyarss | 224:3ac1f91e0ebc | 70 | |
chaithanyarss | 224:3ac1f91e0ebc | 71 | COLLECT_CDMS_RAM(); //Reading RAM parameters |
chaithanyarss | 224:3ac1f91e0ebc | 72 | |
chaithanyarss | 224:3ac1f91e0ebc | 73 | CDMS_HEALTH_DATA[126] = GPIO_STATUS; //Reading GPIO Pins |
chaithanyarss | 224:3ac1f91e0ebc | 74 | CDMS_HEALTH_DATA[127] = GPIO_STATUS >> 8; |
chaithanyarss | 224:3ac1f91e0ebc | 75 | FCTN_SD_MNGR(); //Adding FSC & TMID to TM frame |
chaithanyarss | 224:3ac1f91e0ebc | 76 | CDMS_HK_FRAME[0] = 0x20; |
chaithanyarss | 224:3ac1f91e0ebc | 77 | CDMS_HK_FRAME[1] = FSC_CURRENT[4]+1; |
chaithanyarss | 224:3ac1f91e0ebc | 78 | CDMS_HK_FRAME[2] = (FSC_CURRENT[4]+1) >> 8; |
chaithanyarss | 224:3ac1f91e0ebc | 79 | CDMS_HK_FRAME[3] = (FSC_CURRENT[4]+1) >> 16; |
ee12b079 | 210:f4acf895b598 | 80 | |
chaithanyarss | 224:3ac1f91e0ebc | 81 | for(int i = 0; i<128; i++) /*Adding actual CDMS Health data to TM frame*/ |
chaithanyarss | 224:3ac1f91e0ebc | 82 | CDMS_HK_FRAME[4+i] = CDMS_HEALTH_DATA[i]; |
chaithanyarss | 224:3ac1f91e0ebc | 83 | |
chaithanyarss | 224:3ac1f91e0ebc | 84 | uint16_t crc = crc16_gen(CDMS_HK_FRAME,132); /*Adding CRC to TM frame*/ |
chaithanyarss | 224:3ac1f91e0ebc | 85 | CDMS_HK_FRAME[133] = crc; |
chaithanyarss | 224:3ac1f91e0ebc | 86 | CDMS_HK_FRAME[132] = crc >> 8; |
ee12b079 | 246:565458eefd94 | 87 | |
ee12b079 | 246:565458eefd94 | 88 | |
ee12b079 | 246:565458eefd94 | 89 | exor(CDMS_HK_FRAME); |
ee12b079 | 246:565458eefd94 | 90 | ConvObj.convolutionEncode(CDMS_HK_FRAME , convoluted_CDMS_HK); |
ee12b079 | 246:565458eefd94 | 91 | ConvObj.convolutionEncode(CDMS_HK_FRAME + 67, convoluted_CDMS_HK + 135); |
chaithanyarss | 224:3ac1f91e0ebc | 92 | interleave(convoluted_CDMS_HK , interleave_CDMS_HK); |
chaithanyarss | 224:3ac1f91e0ebc | 93 | interleave(convoluted_CDMS_HK +135, interleave_CDMS_HK + 144); |
ee12b079 | 246:565458eefd94 | 94 | // for(int i=0; i<288; i++) |
ee12b079 | 246:565458eefd94 | 95 | // CDMS_HEALTH_FINAL[i] = interleave_CDMS_HK[i]; |
ee12b079 | 246:565458eefd94 | 96 | // |
ee12b079 | 246:565458eefd94 | 97 | // SD_WRITE(CDMS_HEALTH_FINAL,FSC_CURRENT[4]+1,4); |
ee12b079 | 246:565458eefd94 | 98 | // gPC.printf("\rCompleted CDMS HK\n"); |
ee12b079 | 246:565458eefd94 | 99 | // |
ee12b079 | 246:565458eefd94 | 100 | // /*---------------------------------- BAE HK --------------------------------------------*/ |
ee12b079 | 246:565458eefd94 | 101 | // |
ee12b079 | 246:565458eefd94 | 102 | // |
chaithanyarss | 224:3ac1f91e0ebc | 103 | BAE_HK_I2C = FCTN_I2C_READ(BAE_HK,134); |
ee12b079 | 245:da9d1bd999da | 104 | gPC.printf("\rEntering BAE HK\n"); |
chaithanyarss | 224:3ac1f91e0ebc | 105 | if(BAE_HK_I2C == 0) { |
ee12b079 | 245:da9d1bd999da | 106 | crc = crc16_gen((unsigned char *)BAE_HK,132); |
ee12b079 | 245:da9d1bd999da | 107 | if(crc == ((uint16_t)BAE_HK[132] << 8) | (uint16_t)BAE_HK[133]){ |
ee12b079 | 245:da9d1bd999da | 108 | TIME_LATEST_I2C_BAE = FCTN_CDMS_RD_RTC() >> 7; |
ee12b079 | 245:da9d1bd999da | 109 | for(int i = 0; i<15; i++) |
ee12b079 | 245:da9d1bd999da | 110 | gPC.printf("\r 0x%02X\n",BAE_HK[i]); |
ee12b079 | 245:da9d1bd999da | 111 | for(int i = 0; i<4; i++) |
ee12b079 | 245:da9d1bd999da | 112 | BAE_HK[i] = HK_time >> i; |
ee12b079 | 245:da9d1bd999da | 113 | BAE_HK_FRAME[0] = 0x28; |
ee12b079 | 245:da9d1bd999da | 114 | BAE_HK_FRAME[1] = FSC_CURRENT[5]+1; |
ee12b079 | 245:da9d1bd999da | 115 | BAE_HK_FRAME[2] = (FSC_CURRENT[5]+1) >> 8; |
ee12b079 | 245:da9d1bd999da | 116 | BAE_HK_FRAME[3] = (FSC_CURRENT[5]+1) >> 16; |
ee12b079 | 245:da9d1bd999da | 117 | for(int i = 0; i<128; i++) /*Adding actual CDMS Health data to TM frame*/ |
ee12b079 | 245:da9d1bd999da | 118 | BAE_HK_FRAME[4+i] = BAE_HK[i]; |
ee12b079 | 245:da9d1bd999da | 119 | crc = crc16_gen(BAE_HK_FRAME,132); /*Adding CRC to TM frame*/ |
ee12b079 | 245:da9d1bd999da | 120 | BAE_HK_FRAME[133] = crc; |
ee12b079 | 245:da9d1bd999da | 121 | BAE_HK_FRAME[132] = crc >> 8; |
ee12b079 | 246:565458eefd94 | 122 | // BAE_HEALTH.convolutionEncode(BAE_HK_FRAME , convoluted_BAE_HK); |
ee12b079 | 246:565458eefd94 | 123 | // BAE_HEALTH.convolutionEncode(BAE_HK_FRAME + 67, convoluted_BAE_HK + 135); |
ee12b079 | 246:565458eefd94 | 124 | // interleave(convoluted_BAE_HK , interleave_BAE_HK); |
ee12b079 | 246:565458eefd94 | 125 | // interleave(convoluted_BAE_HK +135, interleave_BAE_HK + 144); |
ee12b079 | 246:565458eefd94 | 126 | // for(int i=0; i<288; i++) |
ee12b079 | 246:565458eefd94 | 127 | // BAE_HEALTH_FINAL[i] = interleave_BAE_HK[i]; |
ee12b079 | 246:565458eefd94 | 128 | // SD_WRITE(BAE_HEALTH_FINAL,FSC_CURRENT[5]+1,5); |
ee12b079 | 245:da9d1bd999da | 129 | } |
ee12b079 | 246:565458eefd94 | 130 | // |
chaithanyarss | 224:3ac1f91e0ebc | 131 | } else { |
ee12b079 | 245:da9d1bd999da | 132 | gPC.printf("\rBAE HK data not recieved through I2C\n"); |
ee12b079 | 245:da9d1bd999da | 133 | for(int i = 0; i<134; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 134 | BAE_HK[i] = 0; |
chaithanyarss | 224:3ac1f91e0ebc | 135 | } |
ee12b079 | 245:da9d1bd999da | 136 | gPC.printf("\rCompleted BAE HK\n"); |
chaithanyarss | 224:3ac1f91e0ebc | 137 | |
chaithanyarss | 224:3ac1f91e0ebc | 138 | /*----------------------------------Beacon message--------------------------------------*/ |
chaithanyarss | 224:3ac1f91e0ebc | 139 | unsigned char SC_HK_LBM_0[135]; |
chaithanyarss | 224:3ac1f91e0ebc | 140 | SC_HK_LBM_0[0] = 0; // Sending long beacon msg as telecommand with Packet sequence count 0x00 |
chaithanyarss | 224:3ac1f91e0ebc | 141 | // Add HK bits |
chaithanyarss | 224:3ac1f91e0ebc | 142 | |
chaithanyarss | 224:3ac1f91e0ebc | 143 | // Add SC bits |
chaithanyarss | 224:3ac1f91e0ebc | 144 | crc = crc16_gen(SC_HK_LBM_0,133); |
chaithanyarss | 224:3ac1f91e0ebc | 145 | SC_HK_LBM_0[132] = crc; |
chaithanyarss | 224:3ac1f91e0ebc | 146 | SC_HK_LBM_0[133] = crc >> 8; |
chaithanyarss | 224:3ac1f91e0ebc | 147 | FCTN_I2C_WRITE((char *)SC_HK_LBM_0,135); |
ee12b079 | 245:da9d1bd999da | 148 | gPC.printf("\rCompleted Beacon\n"); |
ee12b079 | 245:da9d1bd999da | 149 | } |
ee12b079 | 210:f4acf895b598 | 150 | } |
shreeshas95 | 103:b55559925dc1 | 151 | |
shreeshas95 | 103:b55559925dc1 | 152 | int quantiz(float start,float step,float x) |
shreeshas95 | 103:b55559925dc1 | 153 | { |
shreeshas95 | 103:b55559925dc1 | 154 | int y=(x-start)/step; |
shreeshas95 | 103:b55559925dc1 | 155 | if(y<=0)y=0; |
shreeshas95 | 103:b55559925dc1 | 156 | if(y>=255)y=255; |
shreeshas95 | 103:b55559925dc1 | 157 | return y; |
shreeshas95 | 103:b55559925dc1 | 158 | } |
shreeshas95 | 103:b55559925dc1 | 159 | |
ee12b079 | 210:f4acf895b598 | 160 | char saveMin(char x,char y) |
ee12b079 | 210:f4acf895b598 | 161 | { |
ee12b079 | 210:f4acf895b598 | 162 | return (y<x)?y:x; |
shreeshas95 | 103:b55559925dc1 | 163 | } |
ee12b079 | 210:f4acf895b598 | 164 | |
ee12b079 | 210:f4acf895b598 | 165 | char saveMax(char x,char y) |
ee12b079 | 210:f4acf895b598 | 166 | { |
ee12b079 | 210:f4acf895b598 | 167 | return (y>x)?y:x; |
shreeshas95 | 103:b55559925dc1 | 168 | } |
ee12b079 | 210:f4acf895b598 | 169 | |
ee12b079 | 210:f4acf895b598 | 170 | void minMaxHkData() |
chaithanyarss | 224:3ac1f91e0ebc | 171 | { |
chaithanyarss | 224:3ac1f91e0ebc | 172 | if(firstCount==true) { |
chaithanyarss | 224:3ac1f91e0ebc | 173 | for (int i = 0; i < 16; ++i) { |
chaithanyarss | 224:3ac1f91e0ebc | 174 | min_max_data.temp_min[i] = quant_data.temp_quant[i]; |
chaithanyarss | 224:3ac1f91e0ebc | 175 | min_max_data.temp_max[i] = quant_data.temp_quant[i]; |
shreeshas95 | 103:b55559925dc1 | 176 | } |
shreeshas95 | 103:b55559925dc1 | 177 | |
shreeshas95 | 103:b55559925dc1 | 178 | min_max_data.CDMS_temp_min=quant_data.CDMS_temp_quant; |
shreeshas95 | 103:b55559925dc1 | 179 | min_max_data.CDMS_temp_max=quant_data.CDMS_temp_quant; |
chaithanyarss | 224:3ac1f91e0ebc | 180 | } else { |
chaithanyarss | 224:3ac1f91e0ebc | 181 | for (int i = 0; i < 16; ++i) { |
chaithanyarss | 224:3ac1f91e0ebc | 182 | min_max_data.temp_min[i] = saveMin(min_max_data.temp_min[i],quant_data.temp_quant[i]); |
chaithanyarss | 224:3ac1f91e0ebc | 183 | min_max_data.temp_max[i] = saveMax(min_max_data.temp_max[i],quant_data.temp_quant[i]); |
shreeshas95 | 103:b55559925dc1 | 184 | } |
chaithanyarss | 224:3ac1f91e0ebc | 185 | |
ee12b079 | 210:f4acf895b598 | 186 | min_max_data.CDMS_temp_min = saveMin(min_max_data.CDMS_temp_min,quant_data.CDMS_temp_quant); |
ee12b079 | 210:f4acf895b598 | 187 | min_max_data.CDMS_temp_max = saveMax(min_max_data.CDMS_temp_max,quant_data.CDMS_temp_quant); |
chaithanyarss | 224:3ac1f91e0ebc | 188 | } |
shreeshas95 | 103:b55559925dc1 | 189 | firstCount=false; |
shreeshas95 | 103:b55559925dc1 | 190 | } |
shreeshas95 | 103:b55559925dc1 | 191 | |
shreeshas95 | 103:b55559925dc1 | 192 | void FCTN_CDMS_HK() |
shreeshas95 | 103:b55559925dc1 | 193 | { |
chaithanyarss | 224:3ac1f91e0ebc | 194 | |
shreeshas95 | 103:b55559925dc1 | 195 | int Iteration=0; |
shreeshas95 | 103:b55559925dc1 | 196 | |
shreeshas95 | 103:b55559925dc1 | 197 | SelectLinec0=0; |
shreeshas95 | 103:b55559925dc1 | 198 | SelectLinec1=0; |
shreeshas95 | 103:b55559925dc1 | 199 | SelectLinec2=0; |
shreeshas95 | 103:b55559925dc1 | 200 | SelectLinec3=0; |
shreeshas95 | 103:b55559925dc1 | 201 | |
chaithanyarss | 224:3ac1f91e0ebc | 202 | for(Iteration=0; Iteration<16; Iteration++) { |
shreeshas95 | 103:b55559925dc1 | 203 | |
shreeshas95 | 103:b55559925dc1 | 204 | actual_data.temp_actual[Iteration]=TempInput.read(); |
shreeshas95 | 103:b55559925dc1 | 205 | |
shreeshas95 | 103:b55559925dc1 | 206 | SelectLinec0=!(SelectLinec0); |
shreeshas95 | 103:b55559925dc1 | 207 | if(Iteration%2==1) |
shreeshas95 | 103:b55559925dc1 | 208 | SelectLinec1=!(SelectLinec1); |
shreeshas95 | 103:b55559925dc1 | 209 | if(Iteration%4==3) |
shreeshas95 | 103:b55559925dc1 | 210 | SelectLinec2=!(SelectLinec2); |
shreeshas95 | 103:b55559925dc1 | 211 | if(Iteration%8==7) |
chaithanyarss | 224:3ac1f91e0ebc | 212 | SelectLinec3=!(SelectLinec3); |
shreeshas95 | 103:b55559925dc1 | 213 | } |
shreeshas95 | 103:b55559925dc1 | 214 | |
ee12b079 | 210:f4acf895b598 | 215 | actual_data.CDMS_temp_actual=(-90.7*3.3*CDMS_temp_sensor.read())+190.1543; |
shreeshas95 | 103:b55559925dc1 | 216 | |
chaithanyarss | 224:3ac1f91e0ebc | 217 | for(Iteration=0; Iteration<16; Iteration++) { |
chaithanyarss | 224:3ac1f91e0ebc | 218 | |
chaithanyarss | 224:3ac1f91e0ebc | 219 | if(Iteration<14) { |
shreeshas95 | 103:b55559925dc1 | 220 | |
shreeshas95 | 103:b55559925dc1 | 221 | actual_data.temp_actual[Iteration]=actual_data.temp_actual[Iteration]*3.3; |
chaithanyarss | 224:3ac1f91e0ebc | 222 | int resistance; |
chaithanyarss | 224:3ac1f91e0ebc | 223 | |
shreeshas95 | 103:b55559925dc1 | 224 | resistance=24000*actual_data.temp_actual[Iteration]/(3.3-actual_data.temp_actual[Iteration]); |
chaithanyarss | 224:3ac1f91e0ebc | 225 | if(actual_data.temp_actual[Iteration]>1.47) { |
shreeshas95 | 103:b55559925dc1 | 226 | actual_data.temp_actual[Iteration]=3694/log(24.032242*resistance); |
chaithanyarss | 224:3ac1f91e0ebc | 227 | } else { |
chaithanyarss | 224:3ac1f91e0ebc | 228 | |
shreeshas95 | 103:b55559925dc1 | 229 | actual_data.temp_actual[Iteration]=3365.4/log(7.60573*resistance); |
shreeshas95 | 103:b55559925dc1 | 230 | } |
chaithanyarss | 224:3ac1f91e0ebc | 231 | } else |
shreeshas95 | 103:b55559925dc1 | 232 | actual_data.temp_actual[Iteration]=(-90.7*3.3*actual_data.temp_actual[Iteration])+190.1543; |
shreeshas95 | 103:b55559925dc1 | 233 | } |
shreeshas95 | 103:b55559925dc1 | 234 | |
chaithanyarss | 224:3ac1f91e0ebc | 235 | for(Iteration=0; Iteration<16; Iteration++) { |
shreeshas95 | 103:b55559925dc1 | 236 | |
chaithanyarss | 224:3ac1f91e0ebc | 237 | if(Iteration<14) { |
shreeshas95 | 103:b55559925dc1 | 238 | |
shreeshas95 | 103:b55559925dc1 | 239 | quant_data.temp_quant[Iteration]=quantiz(tstart_thermistor,tstep_thermistor,actual_data.temp_actual[Iteration]); |
chaithanyarss | 224:3ac1f91e0ebc | 240 | } else |
shreeshas95 | 103:b55559925dc1 | 241 | quant_data.temp_quant[Iteration]=quantiz(tstart,tstep,actual_data.temp_actual[Iteration]); |
shreeshas95 | 103:b55559925dc1 | 242 | } |
shreeshas95 | 103:b55559925dc1 | 243 | |
shreeshas95 | 103:b55559925dc1 | 244 | quant_data.CDMS_temp_quant=quantiz(tstart,tstep,actual_data.CDMS_temp_actual); |
shreeshas95 | 103:b55559925dc1 | 245 | |
shreeshas95 | 103:b55559925dc1 | 246 | minMaxHkData(); |
ee12b079 | 210:f4acf895b598 | 247 | } |
ee12b079 | 210:f4acf895b598 | 248 | |
ee12b079 | 210:f4acf895b598 | 249 | void FUNC_CDMS_GPIO_STATUS() //Polls the status of Input GPIO PINS |
ee12b079 | 210:f4acf895b598 | 250 | { |
chaithanyarss | 224:3ac1f91e0ebc | 251 | //V_A_PGOOD //TRZ EN |
chaithanyarss | 224:3ac1f91e0ebc | 252 | GPIO_STATUS=(V_A_PGOOD)?(GPIO_STATUS)||((uint16_t)(0x1<<15)):(GPIO_STATUS)&(~((uint16_t)(0x1<<15))); |
chaithanyarss | 224:3ac1f91e0ebc | 253 | //V_B_PGOOD_1 //3V3BPGOOD //$ |
chaithanyarss | 224:3ac1f91e0ebc | 254 | GPIO_STATUS=(V_B_PGOOD_1)?(GPIO_STATUS)||((uint16_t)(0x1<<14)):(GPIO_STATUS)&(~((uint16_t)(0x1<<14))); |
chaithanyarss | 224:3ac1f91e0ebc | 255 | //V_B_PGOOD_2 //3V3BEN //$ |
chaithanyarss | 224:3ac1f91e0ebc | 256 | GPIO_STATUS=(V_B_PGOOD_2)?(GPIO_STATUS)||((uint16_t)(0x1<<13)):(GPIO_STATUS)&(~((uint16_t)(0x1<<13))); |
chaithanyarss | 224:3ac1f91e0ebc | 257 | //V_C_PGOOD //3V3CPGOOD //$ |
chaithanyarss | 224:3ac1f91e0ebc | 258 | GPIO_STATUS=(V_C_PGOOD)?(GPIO_STATUS)||((uint16_t)(0x1<<12)):(GPIO_STATUS)&(~((uint16_t)(0x1<<12))); |
chaithanyarss | 224:3ac1f91e0ebc | 259 | //COMRX_OC_FAULT //$ |
chaithanyarss | 224:3ac1f91e0ebc | 260 | GPIO_STATUS=(COMRX_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<11)):(GPIO_STATUS)&(~((uint16_t)(0x1<<11))); |
chaithanyarss | 224:3ac1f91e0ebc | 261 | // COMTX_OC_FAULT //$ |
chaithanyarss | 224:3ac1f91e0ebc | 262 | GPIO_STATUS=(COMTX_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<10)):(GPIO_STATUS)&(~((uint16_t)(0x1<<10))); |
chaithanyarss | 224:3ac1f91e0ebc | 263 | //BAE_OC_FAULT //$ |
chaithanyarss | 224:3ac1f91e0ebc | 264 | GPIO_STATUS=(BAE_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<9)):(GPIO_STATUS)&(~((uint16_t)(0x1<<9))); |
chaithanyarss | 224:3ac1f91e0ebc | 265 | //PL_GPIO_1_STATUS //$ |
chaithanyarss | 224:3ac1f91e0ebc | 266 | GPIO_STATUS=(PL_GPIO_1_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<8)):(GPIO_STATUS)&(~((uint16_t)(0x1<<8))); |
chaithanyarss | 224:3ac1f91e0ebc | 267 | //PL_GPIO_2_STATUS //$ |
chaithanyarss | 224:3ac1f91e0ebc | 268 | GPIO_STATUS=(PL_GPIO_2_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<7)):(GPIO_STATUS)&(~((uint16_t)(0x1<<7))); |
chaithanyarss | 224:3ac1f91e0ebc | 269 | //PL_GPIO_3_STATUS //$ |
chaithanyarss | 224:3ac1f91e0ebc | 270 | GPIO_STATUS=(PL_GPIO_3_STATUS)?(GPIO_STATUS)||((uint16_t)(0x1<<6)):(GPIO_STATUS)&(~((uint16_t)(0x1<<6))); |
chaithanyarss | 224:3ac1f91e0ebc | 271 | //PL_BEE_SW_OC_FAULT //to be verified |
chaithanyarss | 224:3ac1f91e0ebc | 272 | GPIO_STATUS=(PL_BEE_SW_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<5)):(GPIO_STATUS)&(~((uint16_t)(0x1<<5))); |
chaithanyarss | 224:3ac1f91e0ebc | 273 | //PL_EPS_LATCH_SW_OC_FAULT // to be verified |
chaithanyarss | 224:3ac1f91e0ebc | 274 | GPIO_STATUS=(PL_EPS_LATCH_SW_OC_FAULT)?(GPIO_STATUS)||((uint16_t)(0x1<<4)):(GPIO_STATUS)&(~((uint16_t)(0x1<<4))); |
ee12b079 | 245:da9d1bd999da | 275 | |
ee12b079 | 210:f4acf895b598 | 276 | } |
ee12b079 | 210:f4acf895b598 | 277 | |
ee12b079 | 210:f4acf895b598 | 278 | void VERIFY_COMRX() |
ee12b079 | 210:f4acf895b598 | 279 | { |
chaithanyarss | 224:3ac1f91e0ebc | 280 | //COMRX_OC_FAULT //$ |
chaithanyarss | 224:3ac1f91e0ebc | 281 | if(PIN68==0 && RSSI_volatge > 0.4) { |
chaithanyarss | 224:3ac1f91e0ebc | 282 | COMRX_STATUS = COMRX_ALIVE; |
chaithanyarss | 224:3ac1f91e0ebc | 283 | } else { |
chaithanyarss | 224:3ac1f91e0ebc | 284 | RESET_COMRX(); |
chaithanyarss | 224:3ac1f91e0ebc | 285 | COMRX_RESET_COUNTER++; |
chaithanyarss | 224:3ac1f91e0ebc | 286 | if(PIN68==0 && RSSI_volatge > 0.4) |
chaithanyarss | 224:3ac1f91e0ebc | 287 | COMRX_STATUS = COMRX_ALIVE; |
chaithanyarss | 224:3ac1f91e0ebc | 288 | else |
chaithanyarss | 224:3ac1f91e0ebc | 289 | COMRX_STATUS = COMRX_DEAD; |
chaithanyarss | 224:3ac1f91e0ebc | 290 | } |
ee12b079 | 210:f4acf895b598 | 291 | } |
ee12b079 | 210:f4acf895b598 | 292 | |
chaithanyarss | 224:3ac1f91e0ebc | 293 | void VERIFY_RTC() |
chaithanyarss | 224:3ac1f91e0ebc | 294 | { |
ee12b079 | 210:f4acf895b598 | 295 | |
chaithanyarss | 224:3ac1f91e0ebc | 296 | if(RTC_STATUS == 0x00) { |
chaithanyarss | 224:3ac1f91e0ebc | 297 | SPI_mutex.lock(); |
chaithanyarss | 224:3ac1f91e0ebc | 298 | gCS_RTC=1; |
chaithanyarss | 224:3ac1f91e0ebc | 299 | gCS_RTC=0; |
chaithanyarss | 224:3ac1f91e0ebc | 300 | spi.write(0x0F); |
chaithanyarss | 224:3ac1f91e0ebc | 301 | if(spi.write(0x00) & 0x04 == 0x04) { |
chaithanyarss | 224:3ac1f91e0ebc | 302 | RTC_STATUS = 0x00; |
chaithanyarss | 224:3ac1f91e0ebc | 303 | RESET_RTC(); |
chaithanyarss | 224:3ac1f91e0ebc | 304 | RTC_FAULTCOUNT++; |
chaithanyarss | 224:3ac1f91e0ebc | 305 | } |
chaithanyarss | 224:3ac1f91e0ebc | 306 | gCS_RTC=1; |
chaithanyarss | 224:3ac1f91e0ebc | 307 | SPI_mutex.unlock(); |
ee12b079 | 210:f4acf895b598 | 308 | } |
ee12b079 | 210:f4acf895b598 | 309 | } |
ee12b079 | 210:f4acf895b598 | 310 | |
ee12b079 | 210:f4acf895b598 | 311 | void HANDLE_HW_FAULTS() |
ee12b079 | 210:f4acf895b598 | 312 | { |
chaithanyarss | 224:3ac1f91e0ebc | 313 | HANDLE_HW_FAULT_SD(); |
chaithanyarss | 224:3ac1f91e0ebc | 314 | HANDLE_HW_FAULT_BAE(); |
chaithanyarss | 224:3ac1f91e0ebc | 315 | HANDLE_HW_FAULT_PL(); |
ee12b079 | 210:f4acf895b598 | 316 | } |
ee12b079 | 210:f4acf895b598 | 317 | |
ee12b079 | 210:f4acf895b598 | 318 | void HANDLE_HW_FAULT_SD() |
ee12b079 | 210:f4acf895b598 | 319 | { |
chaithanyarss | 224:3ac1f91e0ebc | 320 | if(SD_STATUS != DEVICE_DISABLED) { |
chaithanyarss | 224:3ac1f91e0ebc | 321 | if(SD_STATUS == DEVICE_OC_FAULT) |
chaithanyarss | 224:3ac1f91e0ebc | 322 | SD_SW_EN_DS = 0; //powering on SD |
chaithanyarss | 224:3ac1f91e0ebc | 323 | |
chaithanyarss | 224:3ac1f91e0ebc | 324 | if(SD_OC_FAULT == 0) { |
chaithanyarss | 224:3ac1f91e0ebc | 325 | SD_SW_EN_DS = 1; //switching off SD card |
ee12b079 | 210:f4acf895b598 | 326 | |
chaithanyarss | 224:3ac1f91e0ebc | 327 | SD_FAULTCOUNT++; |
chaithanyarss | 224:3ac1f91e0ebc | 328 | SD_STATUS = (SD_FAULTCOUNT == 3) ? DEVICE_DISABLED :DEVICE_OC_FAULT; |
chaithanyarss | 224:3ac1f91e0ebc | 329 | } else { |
chaithanyarss | 224:3ac1f91e0ebc | 330 | SD_STATUS = DEVICE_POWERED; |
chaithanyarss | 224:3ac1f91e0ebc | 331 | SD_FAULTCOUNT = 0; |
chaithanyarss | 224:3ac1f91e0ebc | 332 | } |
ee12b079 | 210:f4acf895b598 | 333 | } |
ee12b079 | 210:f4acf895b598 | 334 | } |
ee12b079 | 210:f4acf895b598 | 335 | |
ee12b079 | 210:f4acf895b598 | 336 | void HANDLE_HW_FAULT_BAE() |
ee12b079 | 210:f4acf895b598 | 337 | { |
chaithanyarss | 224:3ac1f91e0ebc | 338 | if(BAE_STATUS != DEVICE_DISABLED) { |
chaithanyarss | 224:3ac1f91e0ebc | 339 | if(BAE_STATUS == DEVICE_OC_FAULT) |
chaithanyarss | 224:3ac1f91e0ebc | 340 | BAE_SW_EN_DS = 0; //Power ON BAE |
ee12b079 | 210:f4acf895b598 | 341 | |
chaithanyarss | 224:3ac1f91e0ebc | 342 | if(BAE_OC_FAULT == 0) { // If OC Fault |
chaithanyarss | 224:3ac1f91e0ebc | 343 | BAE_SW_EN_DS = 1; //Switch OFF BAE |
chaithanyarss | 224:3ac1f91e0ebc | 344 | BAE_FAULTCOUNT++; |
chaithanyarss | 224:3ac1f91e0ebc | 345 | BAE_STATUS = (BAE_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT; |
chaithanyarss | 224:3ac1f91e0ebc | 346 | } else { |
chaithanyarss | 224:3ac1f91e0ebc | 347 | BAE_STATUS = DEVICE_POWERED; |
chaithanyarss | 224:3ac1f91e0ebc | 348 | BAE_FAULTCOUNT = 0; |
chaithanyarss | 224:3ac1f91e0ebc | 349 | } |
ee12b079 | 210:f4acf895b598 | 350 | } |
ee12b079 | 210:f4acf895b598 | 351 | } |
ee12b079 | 210:f4acf895b598 | 352 | |
ee12b079 | 210:f4acf895b598 | 353 | void HANDLE_HW_FAULT_PL() |
ee12b079 | 210:f4acf895b598 | 354 | { |
chaithanyarss | 224:3ac1f91e0ebc | 355 | if(PL_STATUS != DEVICE_DISABLED) { |
ee12b079 | 245:da9d1bd999da | 356 | if(PL_STATUS == DEVICE_OC_FAULT){ |
ee12b079 | 245:da9d1bd999da | 357 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 358 | PYLD_DFF = 1; // Switching ON PL |
ee12b079 | 245:da9d1bd999da | 359 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 360 | PYLD_DFF_CLK = 1; |
ee12b079 | 245:da9d1bd999da | 361 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 362 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 363 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 364 | } |
chaithanyarss | 224:3ac1f91e0ebc | 365 | if(PL_BEE_SW_OC_FAULT == 0) { // if OC Fault |
ee12b079 | 245:da9d1bd999da | 366 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 367 | PYLD_DFF = 0; //Switching OFF PL |
ee12b079 | 245:da9d1bd999da | 368 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 369 | PYLD_DFF_CLK = 1; |
ee12b079 | 245:da9d1bd999da | 370 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 371 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 372 | wait_us(1); |
chaithanyarss | 224:3ac1f91e0ebc | 373 | PL_FAULTCOUNT++; |
chaithanyarss | 224:3ac1f91e0ebc | 374 | PL_STATUS = (PL_FAULTCOUNT == 3)?DEVICE_DISABLED:DEVICE_OC_FAULT; |
chaithanyarss | 224:3ac1f91e0ebc | 375 | } else { |
ee12b079 | 245:da9d1bd999da | 376 | if(PL_STATUS == DEVICE_OC_FAULT){ |
ee12b079 | 245:da9d1bd999da | 377 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 378 | PYLD_DFF = 0; //Switching OFF PL |
ee12b079 | 245:da9d1bd999da | 379 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 380 | PYLD_DFF_CLK = 1; |
ee12b079 | 245:da9d1bd999da | 381 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 382 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 383 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 384 | } |
chaithanyarss | 224:3ac1f91e0ebc | 385 | PL_STATUS = DEVICE_ENABLED; |
chaithanyarss | 224:3ac1f91e0ebc | 386 | PL_FAULTCOUNT = 0; |
chaithanyarss | 224:3ac1f91e0ebc | 387 | } |
ee12b079 | 210:f4acf895b598 | 388 | } |
ee12b079 | 210:f4acf895b598 | 389 | } |
chaithanyarss | 224:3ac1f91e0ebc | 390 | |
ee12b079 | 210:f4acf895b598 | 391 | void COLLECT_CDMS_RAM() |
chaithanyarss | 224:3ac1f91e0ebc | 392 | { |
chaithanyarss | 224:3ac1f91e0ebc | 393 | /*--------------------Current FSC's---------------------*/ |
chaithanyarss | 224:3ac1f91e0ebc | 394 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 395 | CDMS_HEALTH_DATA[i+43] = FSC_LAST[5] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 396 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 397 | CDMS_HEALTH_DATA[i+47] = FSC_CURRENT[5] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 398 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 399 | CDMS_HEALTH_DATA[i+51] = FSC_LAST[4] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 400 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 401 | CDMS_HEALTH_DATA[i+55] = FSC_CURRENT[4] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 402 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 403 | CDMS_HEALTH_DATA[i+59] = FSC_LAST[3] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 404 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 405 | CDMS_HEALTH_DATA[i+63] = FSC_CURRENT[3] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 406 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 407 | CDMS_HEALTH_DATA[i+67] = FSC_LAST[2] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 408 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 409 | CDMS_HEALTH_DATA[i+71] = FSC_CURRENT[2] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 410 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 411 | CDMS_HEALTH_DATA[i+75] = FSC_LAST[1] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 412 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 413 | CDMS_HEALTH_DATA[i+79] = FSC_CURRENT[1] >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 414 | /*---------------------Latest Time----------------------*/ |
chaithanyarss | 224:3ac1f91e0ebc | 415 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 416 | CDMS_HEALTH_DATA[i+83] = TIME_LATEST_SPI_SPEED >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 417 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 418 | CDMS_HEALTH_DATA[i+87] = TIME_LATEST_SD_RD >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 419 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 420 | CDMS_HEALTH_DATA[i+91] = TIME_LATEST_SD_WR >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 421 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 422 | CDMS_HEALTH_DATA[i+95] = TIME_LATEST_I2C_SPEED >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 423 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 424 | CDMS_HEALTH_DATA[i+99] = TIME_LATEST_I2C_BAE >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 425 | for(int i=0; i<4; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 426 | CDMS_HEALTH_DATA[i+103] = TIME_LATEST_RTC >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 427 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 428 | CDMS_HEALTH_DATA[i+107] = COMRX_RESET_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 429 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 430 | CDMS_HEALTH_DATA[i+107] = PL_RCV_SC_DATA_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 431 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 432 | CDMS_HEALTH_DATA[i+111] = PL_MAIN_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 433 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 434 | CDMS_HEALTH_DATA[i+113] = CDMS_HK_MAIN_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 435 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 436 | CDMS_HEALTH_DATA[i+115] = CDMS_I2C_ERR_BAE_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 437 | for(int i=0; i<2; i++) |
chaithanyarss | 224:3ac1f91e0ebc | 438 | CDMS_HEALTH_DATA[i+117] = CDMS_I2C_ERR_SPEED_COUNTER >> (i*8); |
chaithanyarss | 224:3ac1f91e0ebc | 439 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | CDMS_STANDBY_PL << 7; |
chaithanyarss | 224:3ac1f91e0ebc | 440 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_INIT_STATUS << 6) & 0x40); |
chaithanyarss | 224:3ac1f91e0ebc | 441 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_HK_MAIN_STATUS << 5) & 0x20); |
chaithanyarss | 224:3ac1f91e0ebc | 442 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_HK_STATUS << 3) & 0x18); |
chaithanyarss | 224:3ac1f91e0ebc | 443 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((COMRX_STATUS << 2) & 0x04); |
chaithanyarss | 224:3ac1f91e0ebc | 444 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] | ((CDMS_RTC_BL << 1) & 0x02); |
chaithanyarss | 224:3ac1f91e0ebc | 445 | CDMS_HEALTH_DATA[120] = CDMS_HEALTH_DATA[120] & 0xFE; |
ee12b079 | 210:f4acf895b598 | 446 | |
chaithanyarss | 224:3ac1f91e0ebc | 447 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | PL_RCV_SC_DATA_STATUS << 7; |
chaithanyarss | 224:3ac1f91e0ebc | 448 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_SESSION << 6) & 0x40); |
chaithanyarss | 224:3ac1f91e0ebc | 449 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_RX << 5) & 0x20); |
chaithanyarss | 224:3ac1f91e0ebc | 450 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((RF_SW_STATUS << 4) & 0x10); |
chaithanyarss | 224:3ac1f91e0ebc | 451 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_TX << 3) & 0x08); |
chaithanyarss | 224:3ac1f91e0ebc | 452 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_TX_STATUS << 2) & 0x04); |
chaithanyarss | 224:3ac1f91e0ebc | 453 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | ((COM_MNG_TMTC << 1) & 0x02); |
chaithanyarss | 224:3ac1f91e0ebc | 454 | CDMS_HEALTH_DATA[121] = CDMS_HEALTH_DATA[121] | (CDMS_STANDBY_HK & 0x01); |
chaithanyarss | 224:3ac1f91e0ebc | 455 | |
chaithanyarss | 224:3ac1f91e0ebc | 456 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | PL_INIT_STATUS << 7; |
chaithanyarss | 224:3ac1f91e0ebc | 457 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_MAIN_STATUS << 6) & 0x40); |
chaithanyarss | 224:3ac1f91e0ebc | 458 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_LOW_POWER << 5) & 0x20); |
chaithanyarss | 224:3ac1f91e0ebc | 459 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | ((PL_STATE << 3) & 0x18); |
chaithanyarss | 224:3ac1f91e0ebc | 460 | CDMS_HEALTH_DATA[122] = CDMS_HEALTH_DATA[122] | (PL_STATUS & 0x07); |
shreeshas95 | 103:b55559925dc1 | 461 | } |