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