Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Committer:
ee12b079
Date:
Sun Sep 04 11:12:00 2016 +0000
Revision:
301:701ac67649b7
Parent:
289:9bd62b69874c
Child:
303:b49b486a7107
Correcting CDMS_HK

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chaithanyarss 257:7d404e9dc9e2 1
chaithanyarss 257:7d404e9dc9e2 2 // Includes MMS RAM functions also
chaithanyarss 257:7d404e9dc9e2 3
chaithanyarss 257:7d404e9dc9e2 4 /*===================================================FMS Functions=================================================*/
chaithanyarss 257:7d404e9dc9e2 5
ee12b079 209:63e9c8f8b5d2 6
ee12b079 245:da9d1bd999da 7 //Run processes
ee12b079 209:63e9c8f8b5d2 8 void P_PL_INIT();
ee12b079 209:63e9c8f8b5d2 9 void P_PL_MAIN();
ee12b079 209:63e9c8f8b5d2 10 void P_COM_INIT();
ee12b079 209:63e9c8f8b5d2 11 void P_CDMS_HK_MAIN();
ee12b079 209:63e9c8f8b5d2 12 void P_PL_RCV_SC_DATA();
ee12b079 209:63e9c8f8b5d2 13 void P_CDMS_INIT_SD();
ee12b079 245:da9d1bd999da 14
ee12b079 245:da9d1bd999da 15 // Switch ON/OFF functions
ee12b079 209:63e9c8f8b5d2 16 void CDMS_SD_SW_ON();
ee12b079 209:63e9c8f8b5d2 17 void CDMS_SD_SW_OFF();
ee12b079 245:da9d1bd999da 18 void CDMS_RTC_ON();
ee12b079 245:da9d1bd999da 19 void CDMS_RTC_OFF();
ee12b079 209:63e9c8f8b5d2 20 void SW_ON_BAE();
ee12b079 209:63e9c8f8b5d2 21 void SW_OFF_BAE();
ee12b079 209:63e9c8f8b5d2 22 void SW_ON_PL_BEE();
ee12b079 209:63e9c8f8b5d2 23 void SW_OFF_PL_BEE();
ee12b079 209:63e9c8f8b5d2 24 void SW_ON_PL_EPS();
ee12b079 209:63e9c8f8b5d2 25 void SW_OFF_PL_EPS();
ee12b079 209:63e9c8f8b5d2 26 void SW_ON_V_A_EN();
ee12b079 209:63e9c8f8b5d2 27 void SW_OFF_V_A_EN();
ee12b079 245:da9d1bd999da 28
ee12b079 245:da9d1bd999da 29 // RST functions
ee12b079 209:63e9c8f8b5d2 30 void RST_SD();
ee12b079 245:da9d1bd999da 31 void SW_RST_BAE();
ee12b079 245:da9d1bd999da 32 void SW_RST_PL_BEE();
ee12b079 209:63e9c8f8b5d2 33 void RST_BAE();
ee12b079 209:63e9c8f8b5d2 34 void RST_PL_BEE();
chaithanyarss 257:7d404e9dc9e2 35 void CDMS_RESET();
ee12b079 245:da9d1bd999da 36 void SYS_PWR_RESET(); // Have to be decided with EPS team.
aniruddhv 262:752c8689944a 37 void sys_pwr_reset(void const *args);
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
aniruddhv 262:752c8689944a 46 void sys_pwr_reset(void const *args){
aniruddhv 262:752c8689944a 47 SYS_PWR_RESET();
aniruddhv 262:752c8689944a 48 }
ee12b079 245:da9d1bd999da 49
ee12b079 209:63e9c8f8b5d2 50 void P_PL_INIT()
ee12b079 209:63e9c8f8b5d2 51 {
ee12b079 209:63e9c8f8b5d2 52
ee12b079 209:63e9c8f8b5d2 53 }
ee12b079 209:63e9c8f8b5d2 54
ee12b079 209:63e9c8f8b5d2 55 void P_PL_MAIN()
ee12b079 209:63e9c8f8b5d2 56 {
chaithanyarss 257:7d404e9dc9e2 57 FCTN_CDMS_PL_MAIN((void *)NULL);
ee12b079 209:63e9c8f8b5d2 58 }
ee12b079 209:63e9c8f8b5d2 59
ee12b079 209:63e9c8f8b5d2 60 void P_COM_INIT()
ee12b079 209:63e9c8f8b5d2 61 {
ee12b079 245:da9d1bd999da 62 P_COM_INIT;
ee12b079 209:63e9c8f8b5d2 63 }
ee12b079 209:63e9c8f8b5d2 64
ee12b079 209:63e9c8f8b5d2 65 void P_CDMS_HK_MAIN()
ee12b079 209:63e9c8f8b5d2 66 {
ee12b079 245:da9d1bd999da 67 FCTN_CDMS_HK_MAIN((void *)NULL);
ee12b079 209:63e9c8f8b5d2 68 }
ee12b079 209:63e9c8f8b5d2 69
ee12b079 209:63e9c8f8b5d2 70 void P_PL_RCV_SC_DATA()
ee12b079 209:63e9c8f8b5d2 71 {
ee12b079 245:da9d1bd999da 72
ee12b079 209:63e9c8f8b5d2 73 }
ee12b079 209:63e9c8f8b5d2 74
ee12b079 209:63e9c8f8b5d2 75 void P_CDMS_INIT_SD()
ee12b079 209:63e9c8f8b5d2 76 {
ee12b079 209:63e9c8f8b5d2 77 FCTN_CDMS_SD_INIT();
ee12b079 209:63e9c8f8b5d2 78 }
ee12b079 209:63e9c8f8b5d2 79
ee12b079 209:63e9c8f8b5d2 80 void CDMS_SD_SW_ON()
ee12b079 209:63e9c8f8b5d2 81 {
ee12b079 289:9bd62b69874c 82 SD_SW_EN_DS = 1;
chaithanyarss 261:1e54415b34d3 83 SD_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 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 {
ee12b079 289:9bd62b69874c 90 SD_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 91 SD_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 92 FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED);
chaithanyarss 261:1e54415b34d3 93 gPC.printf("sw off sd\n");
ee12b079 209:63e9c8f8b5d2 94 }
ee12b079 209:63e9c8f8b5d2 95
ee12b079 245:da9d1bd999da 96 void CDMS_RTC_ON()
ee12b079 209:63e9c8f8b5d2 97 {
chaithanyarss 257:7d404e9dc9e2 98 //FCTN_CDMS_INIT_RTC();
chaithanyarss 257:7d404e9dc9e2 99 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 100 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 101 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 102 spi.write(0x81); //register address with write flag
chaithanyarss 257:7d404e9dc9e2 103 spi.write(0x00);//disabling stop bit in the seconds register
chaithanyarss 257:7d404e9dc9e2 104 SPI_mutex.unlock();
chaithanyarss 261:1e54415b34d3 105 gPC.printf("sw on rtc\n");
ee12b079 209:63e9c8f8b5d2 106 }
ee12b079 209:63e9c8f8b5d2 107
ee12b079 245:da9d1bd999da 108 void CDMS_RTC_OFF()
ee12b079 209:63e9c8f8b5d2 109 {
chaithanyarss 257:7d404e9dc9e2 110 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 111 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 112 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 113 spi.write(0x81); //register address with write flag
chaithanyarss 257:7d404e9dc9e2 114 spi.write(0x80);//enabling stop bit in the seconds register
chaithanyarss 257:7d404e9dc9e2 115 SPI_mutex.unlock();
chaithanyarss 261:1e54415b34d3 116 gPC.printf("sw off rtc\n");
ee12b079 209:63e9c8f8b5d2 117 }
ee12b079 209:63e9c8f8b5d2 118
ee12b079 245:da9d1bd999da 119 void SW_ON_BAE()
ee12b079 245:da9d1bd999da 120 {
ee12b079 289:9bd62b69874c 121 BAE_SW_EN_DS = 1;
chaithanyarss 261:1e54415b34d3 122 BAE_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 123 FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
chaithanyarss 261:1e54415b34d3 124 gPC.printf("sw on bae\n");
ee12b079 245:da9d1bd999da 125 }
ee12b079 245:da9d1bd999da 126
ee12b079 245:da9d1bd999da 127 void SW_OFF_BAE()
ee12b079 245:da9d1bd999da 128 {
ee12b079 289:9bd62b69874c 129 BAE_SW_EN_DS = 0;
chaithanyarss 261:1e54415b34d3 130 BAE_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 131 FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED);
chaithanyarss 261:1e54415b34d3 132 gPC.printf("sw off bae\n");
ee12b079 245:da9d1bd999da 133 }
ee12b079 245:da9d1bd999da 134
ee12b079 245:da9d1bd999da 135 void SW_ON_PL_BEE()
ee12b079 245:da9d1bd999da 136 {
chaithanyarss 261:1e54415b34d3 137 PYLD_DFF_CLK = 0;
chaithanyarss 261:1e54415b34d3 138 PYLD_DFF = 1;
chaithanyarss 261:1e54415b34d3 139 wait_us(1);
chaithanyarss 261:1e54415b34d3 140 PYLD_DFF_CLK = 1;
chaithanyarss 261:1e54415b34d3 141 wait_us(1);
chaithanyarss 261:1e54415b34d3 142 PYLD_DFF_CLK = 0;
chaithanyarss 261:1e54415b34d3 143 wait_us(1);
chaithanyarss 261:1e54415b34d3 144 PL_STATUS = DEVICE_POWERED;
chaithanyarss 261:1e54415b34d3 145 FCTN_CDMS_WR_FLASH(3,DEVICE_POWERED);
ee12b079 245:da9d1bd999da 146 }
ee12b079 245:da9d1bd999da 147
ee12b079 245:da9d1bd999da 148 void SW_OFF_PL_BEE()
ee12b079 245:da9d1bd999da 149 {
ee12b079 245:da9d1bd999da 150 PYLD_DFF_CLK = 0;
ee12b079 245:da9d1bd999da 151 PYLD_DFF = 0;
ee12b079 245:da9d1bd999da 152 wait_us(1);
ee12b079 245:da9d1bd999da 153 PYLD_DFF_CLK = 1;
ee12b079 245:da9d1bd999da 154 wait_us(1);
ee12b079 245:da9d1bd999da 155 PYLD_DFF_CLK = 0;
ee12b079 245:da9d1bd999da 156 wait_us(1);
chaithanyarss 261:1e54415b34d3 157 PL_STATUS = DEVICE_DISABLED;
chaithanyarss 261:1e54415b34d3 158 FCTN_CDMS_WR_FLASH(3,DEVICE_DISABLED);
ee12b079 245:da9d1bd999da 159 }
ee12b079 245:da9d1bd999da 160
ee12b079 245:da9d1bd999da 161 void SW_ON_PL_EPS()
ee12b079 245:da9d1bd999da 162 {
chaithanyarss 261:1e54415b34d3 163 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 164 PYLD_EPS_DFF_PWR = 1;
chaithanyarss 261:1e54415b34d3 165 wait_us(1);
chaithanyarss 261:1e54415b34d3 166 PYLD_EPS_DFF_PWR_CLK = 1;
chaithanyarss 261:1e54415b34d3 167 wait_us(1);
chaithanyarss 261:1e54415b34d3 168 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 169 wait_us(1);
chaithanyarss 261:1e54415b34d3 170 PL_EPS_LATCH_SW_EN = 1;
chaithanyarss 261:1e54415b34d3 171 FCTN_CDMS_WR_FLASH(4,1);
ee12b079 245:da9d1bd999da 172 }
ee12b079 245:da9d1bd999da 173
ee12b079 209:63e9c8f8b5d2 174 void SW_OFF_PL_EPS()
ee12b079 209:63e9c8f8b5d2 175 {
chaithanyarss 261:1e54415b34d3 176 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 177 PYLD_EPS_DFF_PWR = 0;
chaithanyarss 261:1e54415b34d3 178 wait_us(1);
chaithanyarss 261:1e54415b34d3 179 PYLD_EPS_DFF_PWR_CLK = 1;
chaithanyarss 261:1e54415b34d3 180 wait_us(1);
chaithanyarss 261:1e54415b34d3 181 PYLD_EPS_DFF_PWR_CLK = 0;
chaithanyarss 261:1e54415b34d3 182 wait_us(1);
chaithanyarss 261:1e54415b34d3 183 PL_EPS_LATCH_SW_EN = 0;
chaithanyarss 261:1e54415b34d3 184 FCTN_CDMS_WR_FLASH(4,0);
ee12b079 209:63e9c8f8b5d2 185 }
ee12b079 209:63e9c8f8b5d2 186
ee12b079 209:63e9c8f8b5d2 187 void SW_ON_V_A_EN()
ee12b079 209:63e9c8f8b5d2 188 {
chaithanyarss 257:7d404e9dc9e2 189 V_A_EN = 1;
chaithanyarss 261:1e54415b34d3 190 EPS_V_A_EN_STATUS = 1;
chaithanyarss 261:1e54415b34d3 191 FCTN_CDMS_WR_FLASH(0,1);
ee12b079 209:63e9c8f8b5d2 192 }
ee12b079 209:63e9c8f8b5d2 193
ee12b079 209:63e9c8f8b5d2 194 void SW_OFF_V_A_EN()
ee12b079 209:63e9c8f8b5d2 195 {
chaithanyarss 257:7d404e9dc9e2 196 V_A_EN = 0;
chaithanyarss 261:1e54415b34d3 197 EPS_V_A_EN_STATUS = 0;
chaithanyarss 261:1e54415b34d3 198 FCTN_CDMS_WR_FLASH(0,0);
ee12b079 209:63e9c8f8b5d2 199 }
ee12b079 209:63e9c8f8b5d2 200
ee12b079 209:63e9c8f8b5d2 201 void RST_SD()
ee12b079 209:63e9c8f8b5d2 202 {
ee12b079 289:9bd62b69874c 203 SD_SW_EN_DS = 0;
ee12b079 209:63e9c8f8b5d2 204 wait_ms(10);
ee12b079 289:9bd62b69874c 205 SD_SW_EN_DS = 1;
ee12b079 289:9bd62b69874c 206 SD_STATUS = DEVICE_POWERED;
ee12b079 289:9bd62b69874c 207 FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED);
chaithanyarss 261:1e54415b34d3 208 gPC.printf("rst sd\n");
ee12b079 245:da9d1bd999da 209 }
ee12b079 245:da9d1bd999da 210
ee12b079 245:da9d1bd999da 211 void SW_RST_BAE()
ee12b079 245:da9d1bd999da 212 {
ee12b079 289:9bd62b69874c 213 BAE_SW_EN_DS = 0;
ee12b079 245:da9d1bd999da 214 wait_ms(10);
ee12b079 289:9bd62b69874c 215 BAE_SW_EN_DS = 1;
ee12b079 289:9bd62b69874c 216 BAE_STATUS = DEVICE_POWERED;
ee12b079 289:9bd62b69874c 217 FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
chaithanyarss 261:1e54415b34d3 218 gPC.printf("rst bae\n");
ee12b079 245:da9d1bd999da 219 }
ee12b079 245:da9d1bd999da 220
ee12b079 245:da9d1bd999da 221 void SW_RST_PL_BEE()
ee12b079 245:da9d1bd999da 222 {
ee12b079 289:9bd62b69874c 223 PYLD_DFF = 0;
ee12b079 245:da9d1bd999da 224 wait_ms(10);
ee12b079 289:9bd62b69874c 225 PYLD_DFF = 1;
ee12b079 289:9bd62b69874c 226 PL_STATUS = DEVICE_POWERED;
ee12b079 289:9bd62b69874c 227 FCTN_CDMS_WR_FLASH(3,DEVICE_POWERED);
ee12b079 209:63e9c8f8b5d2 228 }
ee12b079 209:63e9c8f8b5d2 229
ee12b079 209:63e9c8f8b5d2 230 void RST_BAE()
ee12b079 209:63e9c8f8b5d2 231 {
ee12b079 289:9bd62b69874c 232 RESET_TO_BAE = 0;
ee12b079 209:63e9c8f8b5d2 233 wait_ms(10);
ee12b079 289:9bd62b69874c 234 RESET_TO_BAE = 1;
ee12b079 209:63e9c8f8b5d2 235 }
ee12b079 209:63e9c8f8b5d2 236
ee12b079 209:63e9c8f8b5d2 237 void RST_PL_BEE()
ee12b079 209:63e9c8f8b5d2 238 {
ee12b079 289:9bd62b69874c 239 RESET_TO_PYLD = 0;
ee12b079 209:63e9c8f8b5d2 240 wait_ms(10);
ee12b079 289:9bd62b69874c 241 RESET_TO_PYLD = 1;
ee12b079 245:da9d1bd999da 242 }
ee12b079 245:da9d1bd999da 243
ee12b079 245:da9d1bd999da 244 void CDMS_INTERNAL_RESET()
ee12b079 245:da9d1bd999da 245 {
ee12b079 245:da9d1bd999da 246 NVIC_SystemReset();
ee12b079 245:da9d1bd999da 247 }
ee12b079 245:da9d1bd999da 248
ee12b079 245:da9d1bd999da 249 void SYS_PWR_RESET() // Have to be decided with EPS team.
ee12b079 245:da9d1bd999da 250 {
ee12b079 287:a387337491f7 251 //sys_pwr_rst = 1;
ee12b079 245:da9d1bd999da 252 }
ee12b079 245:da9d1bd999da 253
ee12b079 245:da9d1bd999da 254 void EPS_V_A_EN() // This is a reset function
ee12b079 245:da9d1bd999da 255 {
chaithanyarss 257:7d404e9dc9e2 256 V_A_EN = 0;
ee12b079 245:da9d1bd999da 257 wait_ms(10);
chaithanyarss 257:7d404e9dc9e2 258 V_A_EN = 1;
ee12b079 245:da9d1bd999da 259 }
ee12b079 245:da9d1bd999da 260
ee12b079 245:da9d1bd999da 261 void EPS_V_C_EN() // This is a reset function
ee12b079 245:da9d1bd999da 262 {
ee12b079 245:da9d1bd999da 263 COM_RX_CNTRL = 0;
ee12b079 245:da9d1bd999da 264 wait_ms(10);
ee12b079 245:da9d1bd999da 265 COM_RX_CNTRL = 1;
ee12b079 209:63e9c8f8b5d2 266 }
ee12b079 209:63e9c8f8b5d2 267
ee12b079 209:63e9c8f8b5d2 268 void RST_HK_COUNTER()
ee12b079 209:63e9c8f8b5d2 269 {
ee12b079 209:63e9c8f8b5d2 270 firstCount = true;
ee12b079 209:63e9c8f8b5d2 271 }
ee12b079 209:63e9c8f8b5d2 272
chaithanyarss 257:7d404e9dc9e2 273 int8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits)
ee12b079 209:63e9c8f8b5d2 274 {
chaithanyarss 257:7d404e9dc9e2 275 int8_t p;
ee12b079 209:63e9c8f8b5d2 276 if(SD_SW_EN_DS != DEVICE_POWERED)
ee12b079 209:63e9c8f8b5d2 277 {
ee12b079 209:63e9c8f8b5d2 278 SD_RD_ERROR = 1;
chaithanyarss 257:7d404e9dc9e2 279 p = 1;
ee12b079 209:63e9c8f8b5d2 280 }
ee12b079 209:63e9c8f8b5d2 281 else
ee12b079 209:63e9c8f8b5d2 282 {
ee12b079 209:63e9c8f8b5d2 283 p = disk_read_statusbits(sd_statusbits);
ee12b079 209:63e9c8f8b5d2 284 }
chaithanyarss 257:7d404e9dc9e2 285 return p;
ee12b079 209:63e9c8f8b5d2 286 }
ee12b079 209:63e9c8f8b5d2 287
chaithanyarss 261:1e54415b34d3 288 void CDMS_CALIB_RTC(uint64_t time)
ee12b079 245:da9d1bd999da 289 {
chaithanyarss 257:7d404e9dc9e2 290 SPI_mutex.lock();
chaithanyarss 257:7d404e9dc9e2 291 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 292 spi.format(8,0);
chaithanyarss 257:7d404e9dc9e2 293 spi.frequency(1000000);
chaithanyarss 257:7d404e9dc9e2 294
chaithanyarss 257:7d404e9dc9e2 295 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 296 spi.write(0x82);
chaithanyarss 261:1e54415b34d3 297 spi.write((uint8_t)time);//set minutes
chaithanyarss 257:7d404e9dc9e2 298 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 299
chaithanyarss 257:7d404e9dc9e2 300 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 301 spi.write(0x83);
chaithanyarss 261:1e54415b34d3 302 spi.write((uint8_t)(time>>8) & 0x3F); //set hours
chaithanyarss 257:7d404e9dc9e2 303 gCS_RTC=1;
ee12b079 245:da9d1bd999da 304
chaithanyarss 257:7d404e9dc9e2 305 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 306 spi.write(0x85);
chaithanyarss 261:1e54415b34d3 307 spi.write((uint8_t)(time>>16) & 0x3F); //set date
chaithanyarss 257:7d404e9dc9e2 308 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 309
chaithanyarss 257:7d404e9dc9e2 310 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 311 spi.write(0x86);
chaithanyarss 261:1e54415b34d3 312 spi.write((uint8_t)(time>>24) & 0x1F); //set month
chaithanyarss 257:7d404e9dc9e2 313 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 314
chaithanyarss 257:7d404e9dc9e2 315 gCS_RTC=0;
chaithanyarss 257:7d404e9dc9e2 316 spi.write(0x87);
chaithanyarss 261:1e54415b34d3 317 spi.write((uint8_t)(time>>32)); //set year to 00(2000)
chaithanyarss 257:7d404e9dc9e2 318 gCS_RTC=1;
chaithanyarss 257:7d404e9dc9e2 319 gPC.puts("\n\r rtc initalised \n");
chaithanyarss 257:7d404e9dc9e2 320 SPI_mutex.unlock();
ee12b079 245:da9d1bd999da 321 }
ee12b079 245:da9d1bd999da 322
chaithanyarss 224:3ac1f91e0ebc 323 void CDMS_RESET()
chaithanyarss 224:3ac1f91e0ebc 324 {
chaithanyarss 224:3ac1f91e0ebc 325 NVIC_SystemReset();
chaithanyarss 224:3ac1f91e0ebc 326 }
chaithanyarss 224:3ac1f91e0ebc 327
ee12b079 245:da9d1bd999da 328 /*
ee12b079 245:da9d1bd999da 329 //void CDMS_INTERNAL_RESET()
ee12b079 209:63e9c8f8b5d2 330 {
ee12b079 209:63e9c8f8b5d2 331
ee12b079 245:da9d1bd999da 332 }
chaithanyarss 257:7d404e9dc9e2 333 */
chaithanyarss 257:7d404e9dc9e2 334
chaithanyarss 257:7d404e9dc9e2 335 //===============================MMS RAM functions==================================
chaithanyarss 257:7d404e9dc9e2 336
chaithanyarss 257:7d404e9dc9e2 337 void FCTN_CDMS_RD_L_RAM(Base_tm *);
chaithanyarss 257:7d404e9dc9e2 338
chaithanyarss 257:7d404e9dc9e2 339 void FCTN_CDMS_RD_L_RAM(Base_tm *tm_pointer)
chaithanyarss 257:7d404e9dc9e2 340 {
ee12b079 301:701ac67649b7 341 for(int i=0;i<128;i++)
ee12b079 301:701ac67649b7 342 tm_pointer->TM_string[i+4] = CDMS_HEALTH_DATA[i];
ee12b079 289:9bd62b69874c 343 }