working version
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
FMS_all.h@357:f3d48d62e00e, 2022-04-03 (annotated)
- Committer:
- samp1234
- Date:
- Sun Apr 03 15:35:53 2022 +0000
- Revision:
- 357:f3d48d62e00e
- Parent:
- 356:197c93dc2012
First commit test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chaithanyarss | 328:2242ebc71be8 | 1 | #ifndef FMS_ALL_INCLUDED |
chaithanyarss | 328:2242ebc71be8 | 2 | #define FMS_ALL_INCLUDED |
chaithanyarss | 257:7d404e9dc9e2 | 3 | |
chaithanyarss | 257:7d404e9dc9e2 | 4 | // Includes MMS RAM functions also |
chaithanyarss | 257:7d404e9dc9e2 | 5 | |
chaithanyarss | 257:7d404e9dc9e2 | 6 | /*===================================================FMS Functions=================================================*/ |
chaithanyarss | 257:7d404e9dc9e2 | 7 | |
ee12b079 | 209:63e9c8f8b5d2 | 8 | |
ee12b079 | 245:da9d1bd999da | 9 | //Run processes |
ee12b079 | 209:63e9c8f8b5d2 | 10 | void P_PL_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 11 | void P_PL_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 12 | void P_COM_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 13 | void P_CDMS_HK_MAIN(); |
ee12b079 | 209:63e9c8f8b5d2 | 14 | void P_PL_RCV_SC_DATA(); |
ee12b079 | 209:63e9c8f8b5d2 | 15 | void P_CDMS_INIT_SD(); |
ee12b079 | 245:da9d1bd999da | 16 | |
ee12b079 | 245:da9d1bd999da | 17 | // Switch ON/OFF functions |
ee12b079 | 209:63e9c8f8b5d2 | 18 | void CDMS_SD_SW_ON(); |
ee12b079 | 209:63e9c8f8b5d2 | 19 | void CDMS_SD_SW_OFF(); |
ee12b079 | 245:da9d1bd999da | 20 | void CDMS_RTC_ON(); |
ee12b079 | 245:da9d1bd999da | 21 | void CDMS_RTC_OFF(); |
ee12b079 | 209:63e9c8f8b5d2 | 22 | void SW_ON_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 23 | void SW_OFF_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 24 | void SW_ON_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 25 | void SW_OFF_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 26 | void SW_ON_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 27 | void SW_OFF_PL_EPS(); |
ee12b079 | 209:63e9c8f8b5d2 | 28 | void SW_ON_V_A_EN(); |
ee12b079 | 209:63e9c8f8b5d2 | 29 | void SW_OFF_V_A_EN(); |
ee12b079 | 245:da9d1bd999da | 30 | |
ee12b079 | 245:da9d1bd999da | 31 | // RST functions |
ee12b079 | 209:63e9c8f8b5d2 | 32 | void RST_SD(); |
ee12b079 | 245:da9d1bd999da | 33 | void SW_RST_BAE(); |
ee12b079 | 245:da9d1bd999da | 34 | void SW_RST_PL_BEE(); |
ee12b079 | 209:63e9c8f8b5d2 | 35 | void RST_BAE(); |
ee12b079 | 209:63e9c8f8b5d2 | 36 | void RST_PL_BEE(); |
chaithanyarss | 257:7d404e9dc9e2 | 37 | void CDMS_RESET(); |
ee12b079 | 245:da9d1bd999da | 38 | void EPS_V_A_EN(); |
ee12b079 | 245:da9d1bd999da | 39 | void EPS_V_C_EN(); |
ee12b079 | 245:da9d1bd999da | 40 | |
ee12b079 | 209:63e9c8f8b5d2 | 41 | void RST_HK_COUNTER(); |
chaithanyarss | 257:7d404e9dc9e2 | 42 | int8_t CDMS_RD_SD_HK(uint8_t *); |
chaithanyarss | 257:7d404e9dc9e2 | 43 | void CDMS_CALIB_RTC(uint8_t *); |
chaithanyarss | 257:7d404e9dc9e2 | 44 | void TOTAL_RESET_WITH_CDMS(); |
chaithanyarss | 257:7d404e9dc9e2 | 45 | |
ee12b079 | 209:63e9c8f8b5d2 | 46 | void P_PL_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 47 | { |
ee12b079 | 209:63e9c8f8b5d2 | 48 | |
ee12b079 | 209:63e9c8f8b5d2 | 49 | } |
ee12b079 | 209:63e9c8f8b5d2 | 50 | |
ee12b079 | 209:63e9c8f8b5d2 | 51 | void P_PL_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 52 | { |
chaithanyarss | 257:7d404e9dc9e2 | 53 | FCTN_CDMS_PL_MAIN((void *)NULL); |
ee12b079 | 209:63e9c8f8b5d2 | 54 | } |
ee12b079 | 209:63e9c8f8b5d2 | 55 | |
ee12b079 | 209:63e9c8f8b5d2 | 56 | void P_COM_INIT() |
ee12b079 | 209:63e9c8f8b5d2 | 57 | { |
ee12b079 | 245:da9d1bd999da | 58 | P_COM_INIT; |
ee12b079 | 209:63e9c8f8b5d2 | 59 | } |
ee12b079 | 209:63e9c8f8b5d2 | 60 | |
ee12b079 | 209:63e9c8f8b5d2 | 61 | void P_CDMS_HK_MAIN() |
ee12b079 | 209:63e9c8f8b5d2 | 62 | { |
ee12b079 | 245:da9d1bd999da | 63 | FCTN_CDMS_HK_MAIN((void *)NULL); |
ee12b079 | 209:63e9c8f8b5d2 | 64 | } |
ee12b079 | 209:63e9c8f8b5d2 | 65 | |
ee12b079 | 209:63e9c8f8b5d2 | 66 | void P_PL_RCV_SC_DATA() |
ee12b079 | 209:63e9c8f8b5d2 | 67 | { |
ee12b079 | 245:da9d1bd999da | 68 | |
ee12b079 | 209:63e9c8f8b5d2 | 69 | } |
ee12b079 | 209:63e9c8f8b5d2 | 70 | |
ee12b079 | 209:63e9c8f8b5d2 | 71 | void P_CDMS_INIT_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 72 | { |
ee12b079 | 209:63e9c8f8b5d2 | 73 | FCTN_CDMS_SD_INIT(); |
ee12b079 | 209:63e9c8f8b5d2 | 74 | } |
ee12b079 | 209:63e9c8f8b5d2 | 75 | |
ee12b079 | 209:63e9c8f8b5d2 | 76 | void CDMS_SD_SW_ON() |
ee12b079 | 209:63e9c8f8b5d2 | 77 | { |
samp1234 | 357:f3d48d62e00e | 78 | wait_ms(100); |
samp1234 | 356:197c93dc2012 | 79 | // SD_CARD_fromuC_ENA3 = 1; |
samp1234 | 356:197c93dc2012 | 80 | // SD_CARD_fromISO_ENA4 = 1; |
ee12b079 | 289:9bd62b69874c | 81 | SD_SW_EN_DS = 1; |
chaithanyarss | 261:1e54415b34d3 | 82 | SD_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 83 | WRITE_TO_EEPROM(2,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 84 | //FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED); |
chaithanyarss | 261:1e54415b34d3 | 85 | gPC.printf("sw on sd\n"); |
ee12b079 | 209:63e9c8f8b5d2 | 86 | } |
ee12b079 | 209:63e9c8f8b5d2 | 87 | |
ee12b079 | 209:63e9c8f8b5d2 | 88 | void CDMS_SD_SW_OFF() |
ee12b079 | 209:63e9c8f8b5d2 | 89 | { |
samp1234 | 356:197c93dc2012 | 90 | // SD_CARD_fromuC_ENA3 = 0; |
samp1234 | 356:197c93dc2012 | 91 | // SD_CARD_fromISO_ENA4 = 0; |
ee12b079 | 289:9bd62b69874c | 92 | SD_SW_EN_DS = 0; |
samp1234 | 356:197c93dc2012 | 93 | SD_STATUS = DEVICE_DISABLED; |
samp1234 | 356:197c93dc2012 | 94 | // SD_STATUS = 0; |
samp1234 | 357:f3d48d62e00e | 95 | //FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED); |
samp1234 | 357:f3d48d62e00e | 96 | WRITE_TO_EEPROM(2,DEVICE_DISABLED); |
samp1234 | 357:f3d48d62e00e | 97 | wait_ms(100); |
chaithanyarss | 261:1e54415b34d3 | 98 | gPC.printf("sw off sd\n"); |
ee12b079 | 209:63e9c8f8b5d2 | 99 | } |
ee12b079 | 209:63e9c8f8b5d2 | 100 | |
ee12b079 | 245:da9d1bd999da | 101 | void CDMS_RTC_ON() |
ee12b079 | 209:63e9c8f8b5d2 | 102 | { |
samp1234 | 357:f3d48d62e00e | 103 | WRITE_TO_EEPROM(6,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 104 | wait_ms(100); |
chaithanyarss | 257:7d404e9dc9e2 | 105 | //FCTN_CDMS_INIT_RTC(); |
chaithanyarss | 257:7d404e9dc9e2 | 106 | SPI_mutex.lock(); |
chaithanyarss | 257:7d404e9dc9e2 | 107 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 108 | gCS_RTC=0; |
samp1234 | 356:197c93dc2012 | 109 | spi.write(0x01); //reading seconds register |
samp1234 | 356:197c93dc2012 | 110 | uint8_t response =spi.write(0x01); |
samp1234 | 356:197c93dc2012 | 111 | response = response & 0x7F; |
samp1234 | 356:197c93dc2012 | 112 | gCS_RTC=1; |
samp1234 | 356:197c93dc2012 | 113 | gCS_RTC=0; |
samp1234 | 353:e1803e801e20 | 114 | spi.write(0x8C); //register address with write flag |
samp1234 | 353:e1803e801e20 | 115 | spi.write(0x00);//enabling halt bit in the seconds register |
samp1234 | 353:e1803e801e20 | 116 | gCS_RTC=1; |
samp1234 | 356:197c93dc2012 | 117 | gCS_RTC=0; |
samp1234 | 356:197c93dc2012 | 118 | spi.write(0x81); //register address with write flag |
samp1234 | 356:197c93dc2012 | 119 | spi.write(response);//disabling stop bit in the seconds register |
samp1234 | 356:197c93dc2012 | 120 | gCS_RTC=1; |
samp1234 | 356:197c93dc2012 | 121 | |
samp1234 | 356:197c93dc2012 | 122 | //EN_RTC = 0x01; |
samp1234 | 355:a5e72222ff26 | 123 | CDMS_RTC_DISABLE =1; |
samp1234 | 357:f3d48d62e00e | 124 | //FCTN_CDMS_WR_FLASH(6,DEVICE_POWERED); |
samp1234 | 354:eb6c863756a8 | 125 | // gPC.printf("0x%08X \n", READ_FROM_EERPOM(6)); |
chaithanyarss | 257:7d404e9dc9e2 | 126 | SPI_mutex.unlock(); |
chaithanyarss | 261:1e54415b34d3 | 127 | gPC.printf("sw on rtc\n"); |
ee12b079 | 209:63e9c8f8b5d2 | 128 | } |
ee12b079 | 209:63e9c8f8b5d2 | 129 | |
ee12b079 | 245:da9d1bd999da | 130 | void CDMS_RTC_OFF() |
ee12b079 | 209:63e9c8f8b5d2 | 131 | { |
chaithanyarss | 257:7d404e9dc9e2 | 132 | SPI_mutex.lock(); |
chaithanyarss | 257:7d404e9dc9e2 | 133 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 134 | gCS_RTC=0; |
samp1234 | 356:197c93dc2012 | 135 | spi.write(0x01); //reading seconds register |
samp1234 | 356:197c93dc2012 | 136 | uint8_t response =spi.write(0x01); |
samp1234 | 356:197c93dc2012 | 137 | response = response + 0x80; |
samp1234 | 356:197c93dc2012 | 138 | gCS_RTC=1; |
samp1234 | 356:197c93dc2012 | 139 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 140 | spi.write(0x81); //register address with write flag |
samp1234 | 356:197c93dc2012 | 141 | spi.write(response);//enabling stop bit in the seconds register + also preserving the second bits in the register |
samp1234 | 353:e1803e801e20 | 142 | gCS_RTC=1; |
samp1234 | 353:e1803e801e20 | 143 | gCS_RTC=0; |
samp1234 | 353:e1803e801e20 | 144 | spi.write(0x8C); //register address with write flag |
samp1234 | 353:e1803e801e20 | 145 | spi.write(0x40);//enabling halt bit in the seconds register |
samp1234 | 353:e1803e801e20 | 146 | gCS_RTC=1; |
samp1234 | 353:e1803e801e20 | 147 | |
samp1234 | 356:197c93dc2012 | 148 | //EN_RTC = 0x00; |
samp1234 | 355:a5e72222ff26 | 149 | CDMS_RTC_DISABLE = 0; |
samp1234 | 357:f3d48d62e00e | 150 | //FCTN_CDMS_WR_FLASH(6,0x00); |
samp1234 | 357:f3d48d62e00e | 151 | WRITE_TO_EEPROM(6,0x00); |
samp1234 | 357:f3d48d62e00e | 152 | wait_ms(100); |
chaithanyarss | 257:7d404e9dc9e2 | 153 | SPI_mutex.unlock(); |
chaithanyarss | 261:1e54415b34d3 | 154 | gPC.printf("sw off rtc\n"); |
ee12b079 | 209:63e9c8f8b5d2 | 155 | } |
ee12b079 | 209:63e9c8f8b5d2 | 156 | |
ee12b079 | 245:da9d1bd999da | 157 | void SW_ON_BAE() |
ee12b079 | 245:da9d1bd999da | 158 | { |
ee12b079 | 289:9bd62b69874c | 159 | BAE_SW_EN_DS = 1; |
chaithanyarss | 261:1e54415b34d3 | 160 | BAE_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 161 | //FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 162 | WRITE_TO_EEPROM(1,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 163 | wait_ms(100); |
chaithanyarss | 261:1e54415b34d3 | 164 | gPC.printf("sw on bae\n"); |
ee12b079 | 245:da9d1bd999da | 165 | } |
ee12b079 | 245:da9d1bd999da | 166 | |
ee12b079 | 245:da9d1bd999da | 167 | void SW_OFF_BAE() |
ee12b079 | 245:da9d1bd999da | 168 | { |
ee12b079 | 289:9bd62b69874c | 169 | BAE_SW_EN_DS = 0; |
samp1234 | 356:197c93dc2012 | 170 | BAE_STATUS = DEVICE_DISABLED; |
samp1234 | 356:197c93dc2012 | 171 | // BAE_STATUS = 0; |
samp1234 | 357:f3d48d62e00e | 172 | //FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED); |
samp1234 | 357:f3d48d62e00e | 173 | WRITE_TO_EEPROM(1,DEVICE_DISABLED); |
samp1234 | 357:f3d48d62e00e | 174 | wait_ms(100); |
chaithanyarss | 261:1e54415b34d3 | 175 | gPC.printf("sw off bae\n"); |
ee12b079 | 245:da9d1bd999da | 176 | } |
ee12b079 | 245:da9d1bd999da | 177 | |
ee12b079 | 245:da9d1bd999da | 178 | void SW_ON_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 179 | { |
chaithanyarss | 261:1e54415b34d3 | 180 | PYLD_DFF_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 181 | PYLD_DFF = 1; |
chaithanyarss | 261:1e54415b34d3 | 182 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 183 | PYLD_DFF_CLK = 1; |
chaithanyarss | 261:1e54415b34d3 | 184 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 185 | PYLD_DFF_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 186 | wait_us(1); |
samp1234 | 356:197c93dc2012 | 187 | PL_BEE_SW_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 188 | //PL_STATE = 0x01; //uncomment - JOel after figuring out PYLD startup state |
samp1234 | 357:f3d48d62e00e | 189 | //WRITE_TO_EEPROM(16,(int32_t)PL_STATE); |
samp1234 | 357:f3d48d62e00e | 190 | //FCTN_CDMS_WR_FLASH(4,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 191 | WRITE_TO_EEPROM(4,DEVICE_POWERED); |
ee12b079 | 245:da9d1bd999da | 192 | } |
ee12b079 | 245:da9d1bd999da | 193 | |
ee12b079 | 245:da9d1bd999da | 194 | void SW_OFF_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 195 | { |
ee12b079 | 245:da9d1bd999da | 196 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 197 | PYLD_DFF = 0; |
ee12b079 | 245:da9d1bd999da | 198 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 199 | PYLD_DFF_CLK = 1; |
ee12b079 | 245:da9d1bd999da | 200 | wait_us(1); |
ee12b079 | 245:da9d1bd999da | 201 | PYLD_DFF_CLK = 0; |
ee12b079 | 245:da9d1bd999da | 202 | wait_us(1); |
samp1234 | 356:197c93dc2012 | 203 | PL_BEE_SW_STATUS = DEVICE_DISABLED; |
samp1234 | 357:f3d48d62e00e | 204 | //FCTN_CDMS_WR_FLASH(4,DEVICE_DISABLED); |
samp1234 | 357:f3d48d62e00e | 205 | PL_STATE = 0x00; |
samp1234 | 357:f3d48d62e00e | 206 | WRITE_TO_EEPROM(16,(int32_t)PL_STATE); |
samp1234 | 357:f3d48d62e00e | 207 | WRITE_TO_EEPROM(4,DEVICE_DISABLED); |
ee12b079 | 245:da9d1bd999da | 208 | } |
ee12b079 | 245:da9d1bd999da | 209 | |
ee12b079 | 245:da9d1bd999da | 210 | void SW_ON_PL_EPS() |
ee12b079 | 245:da9d1bd999da | 211 | { |
chaithanyarss | 261:1e54415b34d3 | 212 | PYLD_EPS_DFF_PWR_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 213 | PYLD_EPS_DFF_PWR = 1; |
chaithanyarss | 261:1e54415b34d3 | 214 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 215 | PYLD_EPS_DFF_PWR_CLK = 1; |
chaithanyarss | 261:1e54415b34d3 | 216 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 217 | PYLD_EPS_DFF_PWR_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 218 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 219 | PL_EPS_LATCH_SW_EN = 1; |
samp1234 | 355:a5e72222ff26 | 220 | |
samp1234 | 356:197c93dc2012 | 221 | //FCTN_CDMS_WR_FLASH(4,1); |
ee12b079 | 245:da9d1bd999da | 222 | } |
ee12b079 | 245:da9d1bd999da | 223 | |
ee12b079 | 209:63e9c8f8b5d2 | 224 | void SW_OFF_PL_EPS() |
ee12b079 | 209:63e9c8f8b5d2 | 225 | { |
chaithanyarss | 261:1e54415b34d3 | 226 | PYLD_EPS_DFF_PWR_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 227 | PYLD_EPS_DFF_PWR = 0; |
chaithanyarss | 261:1e54415b34d3 | 228 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 229 | PYLD_EPS_DFF_PWR_CLK = 1; |
chaithanyarss | 261:1e54415b34d3 | 230 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 231 | PYLD_EPS_DFF_PWR_CLK = 0; |
chaithanyarss | 261:1e54415b34d3 | 232 | wait_us(1); |
chaithanyarss | 261:1e54415b34d3 | 233 | PL_EPS_LATCH_SW_EN = 0; |
samp1234 | 355:a5e72222ff26 | 234 | |
samp1234 | 356:197c93dc2012 | 235 | //FCTN_CDMS_WR_FLASH(4,0); |
ee12b079 | 209:63e9c8f8b5d2 | 236 | } |
ee12b079 | 209:63e9c8f8b5d2 | 237 | |
ee12b079 | 209:63e9c8f8b5d2 | 238 | void SW_ON_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 239 | { |
chaithanyarss | 257:7d404e9dc9e2 | 240 | V_A_EN = 1; |
chaithanyarss | 261:1e54415b34d3 | 241 | EPS_V_A_EN_STATUS = 1; |
samp1234 | 357:f3d48d62e00e | 242 | //FCTN_CDMS_WR_FLASH(0,1); |
samp1234 | 357:f3d48d62e00e | 243 | WRITE_TO_EEPROM(0,1); |
ee12b079 | 209:63e9c8f8b5d2 | 244 | } |
ee12b079 | 209:63e9c8f8b5d2 | 245 | |
ee12b079 | 209:63e9c8f8b5d2 | 246 | void SW_OFF_V_A_EN() |
ee12b079 | 209:63e9c8f8b5d2 | 247 | { |
chaithanyarss | 257:7d404e9dc9e2 | 248 | V_A_EN = 0; |
chaithanyarss | 261:1e54415b34d3 | 249 | EPS_V_A_EN_STATUS = 0; |
samp1234 | 357:f3d48d62e00e | 250 | //FCTN_CDMS_WR_FLASH(0,0); |
samp1234 | 357:f3d48d62e00e | 251 | WRITE_TO_EEPROM(0,0); |
ee12b079 | 209:63e9c8f8b5d2 | 252 | } |
ee12b079 | 209:63e9c8f8b5d2 | 253 | |
ee12b079 | 209:63e9c8f8b5d2 | 254 | void RST_SD() |
ee12b079 | 209:63e9c8f8b5d2 | 255 | { |
samp1234 | 352:022c513aee03 | 256 | SD_CARD_fromuC_ENA3 = 0; |
samp1234 | 352:022c513aee03 | 257 | SD_CARD_fromISO_ENA4 = 0; |
ee12b079 | 289:9bd62b69874c | 258 | SD_SW_EN_DS = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 259 | wait_ms(10); |
samp1234 | 352:022c513aee03 | 260 | SD_CARD_fromuC_ENA3 = 1; |
samp1234 | 352:022c513aee03 | 261 | SD_CARD_fromISO_ENA4 = 1; |
ee12b079 | 289:9bd62b69874c | 262 | SD_SW_EN_DS = 1; |
ee12b079 | 289:9bd62b69874c | 263 | SD_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 264 | //FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 265 | WRITE_TO_EEPROM(2,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 266 | wait_ms(100); |
chaithanyarss | 261:1e54415b34d3 | 267 | gPC.printf("rst sd\n"); |
ee12b079 | 245:da9d1bd999da | 268 | } |
ee12b079 | 245:da9d1bd999da | 269 | |
ee12b079 | 245:da9d1bd999da | 270 | void SW_RST_BAE() |
ee12b079 | 245:da9d1bd999da | 271 | { |
samp1234 | 357:f3d48d62e00e | 272 | BAE_SW_EN_DS = 0; |
samp1234 | 357:f3d48d62e00e | 273 | wait(5); |
samp1234 | 357:f3d48d62e00e | 274 | BAE_SW_EN_DS = 1; |
samp1234 | 353:e1803e801e20 | 275 | |
ee12b079 | 289:9bd62b69874c | 276 | BAE_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 277 | //FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 278 | WRITE_TO_EEPROM(1,DEVICE_POWERED); |
samp1234 | 357:f3d48d62e00e | 279 | wait_ms(100); |
chaithanyarss | 261:1e54415b34d3 | 280 | gPC.printf("rst bae\n"); |
ee12b079 | 245:da9d1bd999da | 281 | } |
ee12b079 | 245:da9d1bd999da | 282 | |
ee12b079 | 245:da9d1bd999da | 283 | void SW_RST_PL_BEE() |
ee12b079 | 245:da9d1bd999da | 284 | { |
samp1234 | 356:197c93dc2012 | 285 | SW_OFF_PL_BEE(); |
ee12b079 | 245:da9d1bd999da | 286 | wait_ms(10); |
samp1234 | 356:197c93dc2012 | 287 | SW_ON_PL_BEE(); |
samp1234 | 356:197c93dc2012 | 288 | //PL_STATUS = DEVICE_POWERED; |
samp1234 | 356:197c93dc2012 | 289 | //FCTN_CDMS_WR_FLASH(16,DEVICE_POWERED); |
ee12b079 | 209:63e9c8f8b5d2 | 290 | } |
ee12b079 | 209:63e9c8f8b5d2 | 291 | |
ee12b079 | 209:63e9c8f8b5d2 | 292 | void RST_BAE() |
ee12b079 | 209:63e9c8f8b5d2 | 293 | { |
ee12b079 | 289:9bd62b69874c | 294 | RESET_TO_BAE = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 295 | wait_ms(10); |
ee12b079 | 289:9bd62b69874c | 296 | RESET_TO_BAE = 1; |
samp1234 | 357:f3d48d62e00e | 297 | BAE_STATUS = DEVICE_POWERED; |
samp1234 | 357:f3d48d62e00e | 298 | |
samp1234 | 357:f3d48d62e00e | 299 | WRITE_TO_EEPROM(1,DEVICE_POWERED); |
ee12b079 | 209:63e9c8f8b5d2 | 300 | } |
ee12b079 | 209:63e9c8f8b5d2 | 301 | |
ee12b079 | 209:63e9c8f8b5d2 | 302 | void RST_PL_BEE() |
ee12b079 | 209:63e9c8f8b5d2 | 303 | { |
ee12b079 | 289:9bd62b69874c | 304 | RESET_TO_PYLD = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 305 | wait_ms(10); |
ee12b079 | 289:9bd62b69874c | 306 | RESET_TO_PYLD = 1; |
ee12b079 | 245:da9d1bd999da | 307 | } |
ee12b079 | 245:da9d1bd999da | 308 | |
ee12b079 | 245:da9d1bd999da | 309 | void CDMS_INTERNAL_RESET() |
ee12b079 | 245:da9d1bd999da | 310 | { |
ee12b079 | 245:da9d1bd999da | 311 | NVIC_SystemReset(); |
ee12b079 | 245:da9d1bd999da | 312 | } |
ee12b079 | 245:da9d1bd999da | 313 | |
ee12b079 | 245:da9d1bd999da | 314 | void EPS_V_A_EN() // This is a reset function |
ee12b079 | 245:da9d1bd999da | 315 | { |
chaithanyarss | 257:7d404e9dc9e2 | 316 | V_A_EN = 0; |
ee12b079 | 245:da9d1bd999da | 317 | wait_ms(10); |
chaithanyarss | 257:7d404e9dc9e2 | 318 | V_A_EN = 1; |
ee12b079 | 245:da9d1bd999da | 319 | } |
ee12b079 | 245:da9d1bd999da | 320 | |
ee12b079 | 245:da9d1bd999da | 321 | void EPS_V_C_EN() // This is a reset function |
ee12b079 | 245:da9d1bd999da | 322 | { |
ee12b079 | 245:da9d1bd999da | 323 | COM_RX_CNTRL = 0; |
ee12b079 | 245:da9d1bd999da | 324 | wait_ms(10); |
ee12b079 | 245:da9d1bd999da | 325 | COM_RX_CNTRL = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 326 | } |
ee12b079 | 209:63e9c8f8b5d2 | 327 | |
ee12b079 | 209:63e9c8f8b5d2 | 328 | void RST_HK_COUNTER() |
ee12b079 | 209:63e9c8f8b5d2 | 329 | { |
ee12b079 | 209:63e9c8f8b5d2 | 330 | firstCount = true; |
samp1234 | 356:197c93dc2012 | 331 | CDMS_HK_MAIN_COUNTER = 0; |
samp1234 | 356:197c93dc2012 | 332 | PL_MAIN_COUNTER = 0; |
samp1234 | 356:197c93dc2012 | 333 | PL_RCV_SC_DATA_COUNTER = 0; |
samp1234 | 356:197c93dc2012 | 334 | COMRX_RESET_COUNTER = 0; |
ee12b079 | 209:63e9c8f8b5d2 | 335 | } |
ee12b079 | 209:63e9c8f8b5d2 | 336 | |
chaithanyarss | 257:7d404e9dc9e2 | 337 | int8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits) |
ee12b079 | 209:63e9c8f8b5d2 | 338 | { |
chaithanyarss | 257:7d404e9dc9e2 | 339 | int8_t p; |
ee12b079 | 209:63e9c8f8b5d2 | 340 | if(SD_SW_EN_DS != DEVICE_POWERED) |
ee12b079 | 209:63e9c8f8b5d2 | 341 | { |
ee12b079 | 209:63e9c8f8b5d2 | 342 | SD_RD_ERROR = 1; |
chaithanyarss | 257:7d404e9dc9e2 | 343 | p = 1; |
ee12b079 | 209:63e9c8f8b5d2 | 344 | } |
ee12b079 | 209:63e9c8f8b5d2 | 345 | else |
ee12b079 | 209:63e9c8f8b5d2 | 346 | { |
ee12b079 | 209:63e9c8f8b5d2 | 347 | p = disk_read_statusbits(sd_statusbits); |
ee12b079 | 209:63e9c8f8b5d2 | 348 | } |
chaithanyarss | 257:7d404e9dc9e2 | 349 | return p; |
ee12b079 | 209:63e9c8f8b5d2 | 350 | } |
ee12b079 | 209:63e9c8f8b5d2 | 351 | |
samp1234 | 356:197c93dc2012 | 352 | void CDMS_CALIB_RTC(uint32_t time) |
ee12b079 | 245:da9d1bd999da | 353 | { |
samp1234 | 356:197c93dc2012 | 354 | gPC.printf("\n\r Hello : %u",time); |
chaithanyarss | 257:7d404e9dc9e2 | 355 | SPI_mutex.lock(); |
chaithanyarss | 257:7d404e9dc9e2 | 356 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 357 | spi.format(8,0); |
chaithanyarss | 257:7d404e9dc9e2 | 358 | spi.frequency(1000000); |
chaithanyarss | 257:7d404e9dc9e2 | 359 | |
samp1234 | 356:197c93dc2012 | 360 | gPC.printf("\n\rseconds: %u",((((((uint8_t)(time) & 0x3F)/10)<<4)+(((uint8_t)(time) & 0x3F)%10)) & 0x7F)); |
samp1234 | 356:197c93dc2012 | 361 | gCS_RTC=0; |
samp1234 | 356:197c93dc2012 | 362 | spi.write(0x81); |
samp1234 | 356:197c93dc2012 | 363 | spi.write((((((uint8_t)(time) & 0x3F)/10)<<4)+(((uint8_t)(time) & 0x3F)%10)) & 0x7F);//set seconds plus stop bit = 0 |
samp1234 | 356:197c93dc2012 | 364 | gCS_RTC=1; |
samp1234 | 356:197c93dc2012 | 365 | |
samp1234 | 356:197c93dc2012 | 366 | gPC.printf("\n\rminutes: %u",(((((uint8_t)(time>>6) & 0x3F)/10)<<4)+(((uint8_t)(time>>6) & 0x3F)%10))); |
chaithanyarss | 257:7d404e9dc9e2 | 367 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 368 | spi.write(0x82); |
samp1234 | 356:197c93dc2012 | 369 | spi.write(((((uint8_t)(time>>6) & 0x3F)/10)<<4)+(((uint8_t)(time>>6) & 0x3F)%10));//set minutes |
chaithanyarss | 257:7d404e9dc9e2 | 370 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 371 | |
samp1234 | 356:197c93dc2012 | 372 | gPC.printf("\n\rhours: %u",(((((uint8_t)(time>>12) & 0x1F)/10)<<4)+(((uint8_t)(time>>12) & 0x1F)%10))); |
chaithanyarss | 257:7d404e9dc9e2 | 373 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 374 | spi.write(0x83); |
samp1234 | 356:197c93dc2012 | 375 | spi.write(((((uint8_t)(time>>12) & 0x1F)/10)<<4)+(((uint8_t)(time>>12) & 0x1F)%10)); //set hours |
chaithanyarss | 257:7d404e9dc9e2 | 376 | gCS_RTC=1; |
ee12b079 | 245:da9d1bd999da | 377 | |
samp1234 | 356:197c93dc2012 | 378 | gPC.printf("\n\rdate : %u",(((((uint8_t)(time>>17) & 0x1F)/10)<<4)+(((uint8_t)(time>>17) & 0x1F)%10))); |
chaithanyarss | 257:7d404e9dc9e2 | 379 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 380 | spi.write(0x85); |
samp1234 | 356:197c93dc2012 | 381 | spi.write(((((uint8_t)(time>>17) & 0x1F)/10)<<4)+(((uint8_t)(time>>17) & 0x1F)%10)); //set date |
chaithanyarss | 257:7d404e9dc9e2 | 382 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 383 | |
samp1234 | 356:197c93dc2012 | 384 | gPC.printf("\n\rmonth : %u",(((((uint8_t)(time>>22) & 0x0F)/10)<<4)+(((uint8_t)(time>>22) & 0x0F)%10))); |
chaithanyarss | 257:7d404e9dc9e2 | 385 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 386 | spi.write(0x86); |
samp1234 | 356:197c93dc2012 | 387 | spi.write(((((uint8_t)(time>>22) & 0x0F)/10)<<4)+(((uint8_t)(time>>22) & 0x0F)%10)); //set month |
chaithanyarss | 257:7d404e9dc9e2 | 388 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 389 | |
samp1234 | 356:197c93dc2012 | 390 | uint8_t temp = ((((uint8_t)(time>>26) & 0xFF)/10)<<4)+(((uint8_t)(time>>26) & 0xFF)%10); |
samp1234 | 356:197c93dc2012 | 391 | gPC.printf("\n\rtemp : %u",((((uint8_t)(time>>26) & 0xFF)/10)<<4)+(((uint8_t)(time>>26) & 0xFF)%10)); |
samp1234 | 356:197c93dc2012 | 392 | uint8_t year = (temp == 0x00)?0x16:(temp == 0x01)?0x17:(temp == 0x02)?0x18:(temp == 0x03)?0x019:0x16; |
chaithanyarss | 257:7d404e9dc9e2 | 393 | gCS_RTC=0; |
chaithanyarss | 257:7d404e9dc9e2 | 394 | spi.write(0x87); |
samp1234 | 356:197c93dc2012 | 395 | spi.write(year); //set year |
chaithanyarss | 257:7d404e9dc9e2 | 396 | gCS_RTC=1; |
chaithanyarss | 257:7d404e9dc9e2 | 397 | gPC.puts("\n\r rtc initalised \n"); |
chaithanyarss | 257:7d404e9dc9e2 | 398 | SPI_mutex.unlock(); |
ee12b079 | 245:da9d1bd999da | 399 | } |
ee12b079 | 245:da9d1bd999da | 400 | |
chaithanyarss | 224:3ac1f91e0ebc | 401 | void CDMS_RESET() |
chaithanyarss | 224:3ac1f91e0ebc | 402 | { |
chaithanyarss | 224:3ac1f91e0ebc | 403 | NVIC_SystemReset(); |
chaithanyarss | 224:3ac1f91e0ebc | 404 | } |
chaithanyarss | 224:3ac1f91e0ebc | 405 | |
ee12b079 | 245:da9d1bd999da | 406 | /* |
ee12b079 | 245:da9d1bd999da | 407 | //void CDMS_INTERNAL_RESET() |
ee12b079 | 209:63e9c8f8b5d2 | 408 | { |
ee12b079 | 209:63e9c8f8b5d2 | 409 | |
ee12b079 | 245:da9d1bd999da | 410 | } |
chaithanyarss | 257:7d404e9dc9e2 | 411 | */ |
chaithanyarss | 257:7d404e9dc9e2 | 412 | |
chaithanyarss | 257:7d404e9dc9e2 | 413 | //===============================MMS RAM functions================================== |
chaithanyarss | 257:7d404e9dc9e2 | 414 | |
chaithanyarss | 257:7d404e9dc9e2 | 415 | void FCTN_CDMS_RD_L_RAM(Base_tm *); |
chaithanyarss | 257:7d404e9dc9e2 | 416 | |
chaithanyarss | 257:7d404e9dc9e2 | 417 | void FCTN_CDMS_RD_L_RAM(Base_tm *tm_pointer) |
chaithanyarss | 257:7d404e9dc9e2 | 418 | { |
spacelab | 330:6ac9661f2e10 | 419 | uint32_t time = FCTN_CDMS_RD_RTC() >> 7; //Reading Time from RTC |
spacelab | 330:6ac9661f2e10 | 420 | for(int i = 124; i<128; i++) |
spacelab | 330:6ac9661f2e10 | 421 | CDMS_HEALTH_DATA[i] = time >> (127-i)*8; |
samp1234 | 356:197c93dc2012 | 422 | CDMS_HEALTH_DATA[87] = (uint8_t)(RSSI_MAX*10); |
samp1234 | 356:197c93dc2012 | 423 | CDMS_HEALTH_DATA[103] = (uint8_t)(COM_PA_TMP_IN_TX); |
ee12b079 | 301:701ac67649b7 | 424 | for(int i=0;i<128;i++) |
chaithanyarss | 303:b49b486a7107 | 425 | { |
chaithanyarss | 303:b49b486a7107 | 426 | //tm_pointer->TM_string[i] = 0; |
chaithanyarss | 303:b49b486a7107 | 427 | tm_pointer->TM_string[i+4] = CDMS_HEALTH_DATA[i]; |
chaithanyarss | 303:b49b486a7107 | 428 | } |
spacelab | 330:6ac9661f2e10 | 429 | |
ee12b079 | 322:7d906d34aaff | 430 | } |
ee12b079 | 322:7d906d34aaff | 431 | |
ee12b079 | 322:7d906d34aaff | 432 | void FCTN_CDMS_MAX_MIN(Base_tm *tm_pointer) |
ee12b079 | 322:7d906d34aaff | 433 | { |
chaithanyarss | 333:cddef120cae3 | 434 | tm_pointer->TM_string[4] = MAX_COM_ADF_TMP+40; |
samp1234 | 356:197c93dc2012 | 435 | tm_pointer->TM_string[5] = (uint8_t)min_max_data.CDMS_temp_max; |
chaithanyarss | 333:cddef120cae3 | 436 | tm_pointer->TM_string[6] = (uint8_t)(MAX_RSSI_VOLTAGE*10); |
ee12b079 | 322:7d906d34aaff | 437 | |
ee12b079 | 322:7d906d34aaff | 438 | for(int i=0;i<16;i++) |
ee12b079 | 322:7d906d34aaff | 439 | { |
ee12b079 | 322:7d906d34aaff | 440 | //tm_pointer->TM_string[i] = 0; |
chaithanyarss | 333:cddef120cae3 | 441 | tm_pointer->TM_string[i+7] = (uint8_t)(min_max_data.temp_max[i]); |
chaithanyarss | 333:cddef120cae3 | 442 | } |
chaithanyarss | 333:cddef120cae3 | 443 | |
chaithanyarss | 333:cddef120cae3 | 444 | tm_pointer->TM_string[23] = MIN_COM_ADF_TMP+40; |
samp1234 | 356:197c93dc2012 | 445 | tm_pointer->TM_string[24] = (uint8_t)min_max_data.CDMS_temp_min; |
chaithanyarss | 333:cddef120cae3 | 446 | tm_pointer->TM_string[25] = (uint8_t)(MIN_RSSI_VOLTAGE*10); |
chaithanyarss | 333:cddef120cae3 | 447 | |
chaithanyarss | 333:cddef120cae3 | 448 | for(int i=0;i<16;i++) |
chaithanyarss | 333:cddef120cae3 | 449 | { |
chaithanyarss | 333:cddef120cae3 | 450 | //tm_pointer->TM_string[i] = 0; |
chaithanyarss | 333:cddef120cae3 | 451 | tm_pointer->TM_string[i+26] = (uint8_t)(min_max_data.temp_min[i]); |
ee12b079 | 322:7d906d34aaff | 452 | } |
ee12b079 | 322:7d906d34aaff | 453 | |
samp1234 | 356:197c93dc2012 | 454 | tm_pointer->TM_string[42] = GPIO_FAULTS>>8; |
samp1234 | 356:197c93dc2012 | 455 | tm_pointer->TM_string[43] = (GPIO_FAULTS<<3) & 0x00FF; |
ee12b079 | 322:7d906d34aaff | 456 | |
ee12b079 | 322:7d906d34aaff | 457 | TIME_LATEST_RTC= FCTN_CDMS_RD_RTC() >> 7; |
ee12b079 | 322:7d906d34aaff | 458 | for(int i = 0; i<4; i++) |
chaithanyarss | 328:2242ebc71be8 | 459 | tm_pointer->TM_string[44+i] = TIME_LATEST_RTC >> (3-i)*8; |
chaithanyarss | 328:2242ebc71be8 | 460 | } |
chaithanyarss | 328:2242ebc71be8 | 461 | |
samp1234 | 357:f3d48d62e00e | 462 | void FCTN_CDMS_SCP_M0a(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 463 | { |
samp1234 | 357:f3d48d62e00e | 464 | for(uint8_t i=0; i<24; i++) |
samp1234 | 357:f3d48d62e00e | 465 | rmcpy(tm_pointer->TM_string+4*i+4, scp_threshold_m0+i, 4); |
samp1234 | 357:f3d48d62e00e | 466 | for(uint8_t i=24; i<32; i++) |
samp1234 | 357:f3d48d62e00e | 467 | rmcpy(tm_pointer->TM_string+4*i+4, scp_threshold_m0+i+8, 4); |
samp1234 | 357:f3d48d62e00e | 468 | |
samp1234 | 357:f3d48d62e00e | 469 | for(uint8_t i=0; i<128; i++) |
samp1234 | 357:f3d48d62e00e | 470 | gPC.printf("\r %d\n",tm_pointer->TM_string[i]); |
samp1234 | 357:f3d48d62e00e | 471 | |
samp1234 | 357:f3d48d62e00e | 472 | |
samp1234 | 357:f3d48d62e00e | 473 | } |
samp1234 | 357:f3d48d62e00e | 474 | |
samp1234 | 357:f3d48d62e00e | 475 | void FCTN_CDMS_SCP_M0b(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 476 | { |
samp1234 | 357:f3d48d62e00e | 477 | for(uint8_t i=0; i<12; i++) |
samp1234 | 357:f3d48d62e00e | 478 | rmcpy(tm_pointer->TM_string+4*i+4, scp_threshold_m0+i+40, 4); |
samp1234 | 357:f3d48d62e00e | 479 | |
samp1234 | 357:f3d48d62e00e | 480 | } |
samp1234 | 357:f3d48d62e00e | 481 | |
samp1234 | 357:f3d48d62e00e | 482 | void FCTN_CDMS_SCP_M1a(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 483 | { |
samp1234 | 357:f3d48d62e00e | 484 | for(uint8_t i=0; i<32; i++) |
samp1234 | 357:f3d48d62e00e | 485 | rmcpy(tm_pointer->TM_string+4*i+4, scp_threshold_m1+i, 4); |
samp1234 | 357:f3d48d62e00e | 486 | |
samp1234 | 357:f3d48d62e00e | 487 | } |
samp1234 | 357:f3d48d62e00e | 488 | |
samp1234 | 357:f3d48d62e00e | 489 | void FCTN_CDMS_SCP_M1b(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 490 | { |
samp1234 | 357:f3d48d62e00e | 491 | for(uint8_t i=0; i<20; i++) |
samp1234 | 357:f3d48d62e00e | 492 | rmcpy(tm_pointer->TM_string+4*i+4, scp_threshold_m1+i+32, 4); |
samp1234 | 357:f3d48d62e00e | 493 | |
samp1234 | 357:f3d48d62e00e | 494 | } |
samp1234 | 357:f3d48d62e00e | 495 | |
samp1234 | 357:f3d48d62e00e | 496 | void FCTN_CDMS_SCP_SFP_SUM(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 497 | { |
samp1234 | 357:f3d48d62e00e | 498 | rmcpy(tm_pointer->TM_string+4*0+4, scp_threshold_m0_1+7, 4); |
samp1234 | 357:f3d48d62e00e | 499 | rmcpy(tm_pointer->TM_string+4*1+4, scp_threshold_m0_1+5, 4); |
samp1234 | 357:f3d48d62e00e | 500 | rmcpy(tm_pointer->TM_string+4*2+4, scp_threshold_m0_1+8, 4); |
samp1234 | 357:f3d48d62e00e | 501 | rmcpy(tm_pointer->TM_string+4*3+4, scp_threshold_m0_1+6, 4); |
samp1234 | 357:f3d48d62e00e | 502 | for(uint8_t i=0; i<5; i++) |
samp1234 | 357:f3d48d62e00e | 503 | rmcpy(tm_pointer->TM_string+4*(i+4)+4, scp_threshold_m0_1+i, 4); |
samp1234 | 357:f3d48d62e00e | 504 | rmcpy(tm_pointer->TM_string+4*9+4, scp_sfp_threshold_m0_2+0, 4); |
samp1234 | 357:f3d48d62e00e | 505 | rmcpy(tm_pointer->TM_string+4*10+4, scp_sfp_threshold_m0_2+1, 4); |
samp1234 | 357:f3d48d62e00e | 506 | rmcpy(tm_pointer->TM_string+4*11+4, scp_sfp_threshold_m0_2+2, 4); |
samp1234 | 357:f3d48d62e00e | 507 | |
samp1234 | 357:f3d48d62e00e | 508 | } |
samp1234 | 357:f3d48d62e00e | 509 | |
samp1234 | 357:f3d48d62e00e | 510 | void FCTN_CDMS_SFP_M0a(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 511 | { |
samp1234 | 357:f3d48d62e00e | 512 | for(uint8_t i=0; i<24; i++) |
samp1234 | 357:f3d48d62e00e | 513 | rmcpy(tm_pointer->TM_string+4*i+4, sfp_threshold_m0+i, 4); |
samp1234 | 357:f3d48d62e00e | 514 | for(uint8_t i=24; i<32; i++) |
samp1234 | 357:f3d48d62e00e | 515 | rmcpy(tm_pointer->TM_string+4*i+4, sfp_threshold_m0+i+8, 4); |
samp1234 | 357:f3d48d62e00e | 516 | |
samp1234 | 357:f3d48d62e00e | 517 | } |
samp1234 | 357:f3d48d62e00e | 518 | |
samp1234 | 357:f3d48d62e00e | 519 | void FCTN_CDMS_SFP_M0b(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 520 | { |
samp1234 | 357:f3d48d62e00e | 521 | for(uint8_t i=0; i<12; i++) |
samp1234 | 357:f3d48d62e00e | 522 | rmcpy(tm_pointer->TM_string+4*i+4, sfp_threshold_m0+i+40, 4); |
samp1234 | 357:f3d48d62e00e | 523 | |
samp1234 | 357:f3d48d62e00e | 524 | } |
samp1234 | 357:f3d48d62e00e | 525 | |
samp1234 | 357:f3d48d62e00e | 526 | void FCTN_CDMS_SFP_M1a(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 527 | { |
samp1234 | 357:f3d48d62e00e | 528 | for(uint8_t i=0; i<32; i++) |
samp1234 | 357:f3d48d62e00e | 529 | rmcpy(tm_pointer->TM_string+4*i+4, sfp_threshold_m1+i, 4); |
samp1234 | 357:f3d48d62e00e | 530 | |
samp1234 | 357:f3d48d62e00e | 531 | } |
samp1234 | 357:f3d48d62e00e | 532 | |
samp1234 | 357:f3d48d62e00e | 533 | void FCTN_CDMS_SFP_M1b(Base_tm *tm_pointer) |
samp1234 | 357:f3d48d62e00e | 534 | { |
samp1234 | 357:f3d48d62e00e | 535 | for(uint8_t i=0; i<20; i++) |
samp1234 | 357:f3d48d62e00e | 536 | rmcpy(tm_pointer->TM_string+4*i+4, sfp_threshold_m1+i+32, 4); |
samp1234 | 357:f3d48d62e00e | 537 | |
samp1234 | 357:f3d48d62e00e | 538 | } |
samp1234 | 357:f3d48d62e00e | 539 | |
chaithanyarss | 328:2242ebc71be8 | 540 | #endif |