Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA eeprom mbed-rtos mbed
Fork of CDMS_QM_03MAR2017_Flash_with_obsrs by
Diff: FMS_all.h
- Revision:
- 256:0f9aeeaf5a1d
- Parent:
- 255:642ea552ac77
--- a/FMS_all.h Mon Jul 11 14:33:02 2016 +0000
+++ b/FMS_all.h Tue Jul 12 09:05:25 2016 +0000
@@ -1,5 +1,8 @@
/*===================================================FMS Functions=================================================*/
+
+void STANDBY_PRCS();
+
//Run processes
void P_PL_INIT();
void P_PL_MAIN();
@@ -34,12 +37,17 @@
void EPS_V_C_EN();
void RST_HK_COUNTER();
-uint8_t CDMS_RD_SD_HK(uint8_t *);
+int8_t CDMS_RD_SD_HK(uint8_t *);
void CDMS_RD_RTC(uint64_t *);
-void CDMS_CALIB_RTC();
+void CDMS_CALIB_RTC(uint8_t *);
void TOTAL_RESET_WITH_CDMS();
+void STANDBY_PRCS()
+{
+
+}
+
void P_PL_INIT()
{
@@ -207,9 +215,7 @@
void SYS_PWR_RESET() // Have to be decided with EPS team.
{
- /*sys_pwr_rst = 0;
- wait_ms(10);
- sys_pwr_rst = 1;*/
+ sys_pwr_rst = 1;
}
void EPS_V_A_EN() // This is a reset function
@@ -231,25 +237,19 @@
firstCount = true;
}
-uint8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits)
+int8_t CDMS_RD_SD_HK(uint8_t *sd_statusbits)
{
- uint8_t p;
- uint8_t ACK;
+ int8_t p;
if(SD_SW_EN_DS != DEVICE_POWERED)
{
- ACK = 0x89;
SD_RD_ERROR = 1;
- //Generate TM
+ p = 1;
}
else
{
p = disk_read_statusbits(sd_statusbits);
- if(p == 0)
- ACK = 0xA0;
- else
- ACK = 0x89;
}
- return ACK;
+ return p;
}
void CDMS_RD_RTC(uint64_t *time)
@@ -257,9 +257,39 @@
*time = FCTN_CDMS_RD_RTC();
}
-void CDMS_CALIB_RTC()
+void CDMS_CALIB_RTC(uint64_t *time)
{
+ SPI_mutex.lock();
+ gCS_RTC=1;
+ spi.format(8,0);
+ spi.frequency(1000000);
+
+ gCS_RTC=0;
+ spi.write(0x82);
+ spi.write(time[0]);//set minutes
+ gCS_RTC=1;
+
+ gCS_RTC=0;
+ spi.write(0x83);
+ spi.write(time[1] & 0x3F); //set hours
+ gCS_RTC=1;
+ gCS_RTC=0;
+ spi.write(0x85);
+ spi.write(time[2] & 0x3F); //set date
+ gCS_RTC=1;
+
+ gCS_RTC=0;
+ spi.write(0x86);
+ spi.write(time[3] & 0x1F); //set month
+ gCS_RTC=1;
+
+ gCS_RTC=0;
+ spi.write(0x87);
+ spi.write(time[4]); //set year to 00(2000)
+ gCS_RTC=1;
+ gPC.puts("\n\r rtc initalised \n");
+ SPI_mutex.unlock();
}
void CDMS_RESET()
