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:
- 261:1e54415b34d3
- Parent:
- 257:7d404e9dc9e2
- Child:
- 262:752c8689944a
--- a/FMS_all.h Tue Jul 12 17:54:30 2016 +0000
+++ b/FMS_all.h Thu Jul 14 13:07:30 2016 +0000
@@ -40,7 +40,6 @@
void RST_HK_COUNTER();
int8_t CDMS_RD_SD_HK(uint8_t *);
-void CDMS_RD_RTC(uint64_t *);
void CDMS_CALIB_RTC(uint8_t *);
void TOTAL_RESET_WITH_CDMS();
@@ -83,11 +82,19 @@
void CDMS_SD_SW_ON()
{
SD_SW_EN_DS = 0;
+ SD_STATUS = DEVICE_POWERED;
+ CDMS_SD_SW_STATUS = DEVICE_POWERED;
+ FCTN_CDMS_WR_FLASH(2,DEVICE_POWERED);
+ gPC.printf("sw on sd\n");
}
void CDMS_SD_SW_OFF()
{
SD_SW_EN_DS = 1;
+ SD_STATUS = DEVICE_DISABLED;
+ CDMS_SD_SW_STATUS = DEVICE_DISABLED;
+ FCTN_CDMS_WR_FLASH(2,DEVICE_DISABLED);
+ gPC.printf("sw off sd\n");
}
void CDMS_RTC_ON()
@@ -99,6 +106,7 @@
spi.write(0x81); //register address with write flag
spi.write(0x00);//disabling stop bit in the seconds register
SPI_mutex.unlock();
+ gPC.printf("sw on rtc\n");
}
void CDMS_RTC_OFF()
@@ -109,27 +117,39 @@
spi.write(0x81); //register address with write flag
spi.write(0x80);//enabling stop bit in the seconds register
SPI_mutex.unlock();
+ gPC.printf("sw off rtc\n");
}
void SW_ON_BAE()
{
BAE_SW_EN_DS = 0;
+ BAE_STATUS = DEVICE_POWERED;
+ BAE_SW_STATUS = DEVICE_POWERED;
+ FCTN_CDMS_WR_FLASH(1,DEVICE_POWERED);
+ gPC.printf("sw on bae\n");
}
void SW_OFF_BAE()
{
BAE_SW_EN_DS = 1;
+ BAE_STATUS = DEVICE_DISABLED;
+ BAE_SW_STATUS = DEVICE_DISABLED;
+ FCTN_CDMS_WR_FLASH(1,DEVICE_DISABLED);
+ gPC.printf("sw off bae\n");
}
void SW_ON_PL_BEE()
{
- PYLD_DFF_CLK = 0;\
- PYLD_DFF = 1;\
- wait_us(1);\
- PYLD_DFF_CLK = 1;\
- wait_us(1);\
- PYLD_DFF_CLK = 0;\
- wait_us(1);\
+ PYLD_DFF_CLK = 0;
+ PYLD_DFF = 1;
+ wait_us(1);
+ PYLD_DFF_CLK = 1;
+ wait_us(1);
+ PYLD_DFF_CLK = 0;
+ wait_us(1);
+ PL_STATUS = DEVICE_POWERED;
+ PL_BEE_SW_STATUS = DEVICE_POWERED;
+ FCTN_CDMS_WR_FLASH(3,DEVICE_POWERED);
}
void SW_OFF_PL_BEE()
@@ -141,38 +161,49 @@
wait_us(1);
PYLD_DFF_CLK = 0;
wait_us(1);
+ PL_STATUS = DEVICE_DISABLED;
+ PL_BEE_SW_STATUS = DEVICE_DISABLED;
+ FCTN_CDMS_WR_FLASH(3,DEVICE_DISABLED);
}
void SW_ON_PL_EPS()
{
- PYLD_EPS_DFF_PWR_CLK = 0;\
- PYLD_EPS_DFF_PWR = 1;\
- wait_us(1);\
- PYLD_EPS_DFF_PWR_CLK = 1;\
- wait_us(1);\
- PYLD_EPS_DFF_PWR_CLK = 0;\
- wait_us(1);\
+ PYLD_EPS_DFF_PWR_CLK = 0;
+ PYLD_EPS_DFF_PWR = 1;
+ wait_us(1);
+ PYLD_EPS_DFF_PWR_CLK = 1;
+ wait_us(1);
+ PYLD_EPS_DFF_PWR_CLK = 0;
+ wait_us(1);
+ PL_EPS_LATCH_SW_EN = 1;
+ FCTN_CDMS_WR_FLASH(4,1);
}
void SW_OFF_PL_EPS()
{
- PYLD_EPS_DFF_PWR_CLK = 0;\
- PYLD_EPS_DFF_PWR = 0;\
- wait_us(1);\
- PYLD_EPS_DFF_PWR_CLK = 1;\
- wait_us(1);\
- PYLD_EPS_DFF_PWR_CLK = 0;\
- wait_us(1);\
+ PYLD_EPS_DFF_PWR_CLK = 0;
+ PYLD_EPS_DFF_PWR = 0;
+ wait_us(1);
+ PYLD_EPS_DFF_PWR_CLK = 1;
+ wait_us(1);
+ PYLD_EPS_DFF_PWR_CLK = 0;
+ wait_us(1);
+ PL_EPS_LATCH_SW_EN = 0;
+ FCTN_CDMS_WR_FLASH(4,0);
}
void SW_ON_V_A_EN()
{
V_A_EN = 1;
+ EPS_V_A_EN_STATUS = 1;
+ FCTN_CDMS_WR_FLASH(0,1);
}
void SW_OFF_V_A_EN()
{
V_A_EN = 0;
+ EPS_V_A_EN_STATUS = 0;
+ FCTN_CDMS_WR_FLASH(0,0);
}
void RST_SD()
@@ -180,6 +211,7 @@
SD_SW_EN_DS = 1;
wait_ms(10);
SD_SW_EN_DS = 0;
+ gPC.printf("rst sd\n");
}
void SW_RST_BAE()
@@ -187,6 +219,7 @@
BAE_SW_EN_DS = 1;
wait_ms(10);
BAE_SW_EN_DS = 0;
+ gPC.printf("rst bae\n");
}
void SW_RST_PL_BEE()
@@ -254,12 +287,7 @@
return p;
}
-void CDMS_RD_RTC(uint64_t *time)
-{
- *time = FCTN_CDMS_RD_RTC();
-}
-
-void CDMS_CALIB_RTC(uint64_t *time)
+void CDMS_CALIB_RTC(uint64_t time)
{
SPI_mutex.lock();
gCS_RTC=1;
@@ -268,27 +296,27 @@
gCS_RTC=0;
spi.write(0x82);
- spi.write(time[0]);//set minutes
+ spi.write((uint8_t)time);//set minutes
gCS_RTC=1;
gCS_RTC=0;
spi.write(0x83);
- spi.write(time[1] & 0x3F); //set hours
+ spi.write((uint8_t)(time>>8) & 0x3F); //set hours
gCS_RTC=1;
gCS_RTC=0;
spi.write(0x85);
- spi.write(time[2] & 0x3F); //set date
+ spi.write((uint8_t)(time>>16) & 0x3F); //set date
gCS_RTC=1;
gCS_RTC=0;
spi.write(0x86);
- spi.write(time[3] & 0x1F); //set month
+ spi.write((uint8_t)(time>>24) & 0x1F); //set month
gCS_RTC=1;
gCS_RTC=0;
spi.write(0x87);
- spi.write(time[4]); //set year to 00(2000)
+ spi.write((uint8_t)(time>>32)); //set year to 00(2000)
gCS_RTC=1;
gPC.puts("\n\r rtc initalised \n");
SPI_mutex.unlock();
