working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Revision:
255:642ea552ac77
Parent:
245:da9d1bd999da
Child:
256:0f9aeeaf5a1d
--- a/FMS_all.h	Mon Jul 11 12:30:41 2016 +0000
+++ b/FMS_all.h	Mon Jul 11 14:33:02 2016 +0000
@@ -1,4 +1,5 @@
 
+/*===================================================FMS Functions=================================================*/
 //Run processes
 void P_PL_INIT();
 void P_PL_MAIN();
@@ -27,7 +28,7 @@
 void SW_RST_PL_BEE();
 void RST_BAE();
 void RST_PL_BEE();
-void CDMS_INTERNAL_RESET();
+void CDMS_RESET();
 void SYS_PWR_RESET();  // Have to be decided with EPS team.
 void EPS_V_A_EN();
 void EPS_V_C_EN();
@@ -36,7 +37,7 @@
 uint8_t CDMS_RD_SD_HK(uint8_t *);
 void CDMS_RD_RTC(uint64_t *);
 void CDMS_CALIB_RTC();
-void CDMS_RESET();
+void TOTAL_RESET_WITH_CDMS();
 
 
 void P_PL_INIT()
@@ -46,7 +47,7 @@
 
 void P_PL_MAIN()
 {
-   // FCTN_CDMS_PL_MAIN((void *)NULL);
+   FCTN_CDMS_PL_MAIN((void *)NULL);
 }
 
 void P_COM_INIT()
@@ -81,12 +82,23 @@
 
 void CDMS_RTC_ON()
 {
-    
+    //FCTN_CDMS_INIT_RTC();
+    SPI_mutex.lock();
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x81); //register address with write flag
+    spi.write(0x00);//disabling stop bit in the seconds register
+    SPI_mutex.unlock();
 }
 
 void CDMS_RTC_OFF()
 {
-    
+    SPI_mutex.lock();
+    gCS_RTC=1;
+    gCS_RTC=0;
+    spi.write(0x81); //register address with write flag
+    spi.write(0x80);//enabling stop bit in the seconds register
+    SPI_mutex.unlock();
 }
 
 void SW_ON_BAE()
@@ -145,14 +157,12 @@
 
 void SW_ON_V_A_EN()
 {
-    TRXY_PWR_CNTRL = 1;
-    TRZ_PWR_CNTRL = 1;
+    V_A_EN = 1;
 }
 
 void SW_OFF_V_A_EN()
 {
-    TRXY_PWR_CNTRL = 0;
-    TRZ_PWR_CNTRL = 0;    
+    V_A_EN = 0;
 }
 
 void RST_SD()
@@ -197,16 +207,16 @@
 
 void SYS_PWR_RESET()  // Have to be decided with EPS team.
 {
-    
+    /*sys_pwr_rst = 0;
+    wait_ms(10);
+    sys_pwr_rst = 1;*/
 }
 
 void EPS_V_A_EN()     // This is a reset function
 {
-    TRXY_PWR_CNTRL = 0;
-    TRZ_PWR_CNTRL = 0;
+    V_A_EN = 0;
     wait_ms(10);
-    TRXY_PWR_CNTRL = 1;
-    TRZ_PWR_CNTRL = 1;
+    V_A_EN = 1;
 }
 
 void EPS_V_C_EN()     // This is a reset function
@@ -262,4 +272,4 @@
 {
     
 }
-*/
\ No newline at end of file
+*/