working version
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Diff: EEPROM.h
- Revision:
- 353:e1803e801e20
- Parent:
- 352:022c513aee03
--- a/EEPROM.h Mon Feb 06 16:36:46 2017 +0000 +++ b/EEPROM.h Tue Feb 21 06:30:56 2017 +0000 @@ -6,7 +6,7 @@ #define check 10 EEPROM e2prom(ee_sda, ee_scl, 0, EEPROM::T24C512); -int32_t INITIAL_EEPROM[32] = {1,1,1,1,1,0,0,0,0,35001,0xff,300,85,20,20,3,80000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; +int32_t INITIAL_EEPROM[32] = {1,1,1,1,1,0,0,0,0,35001,0xff,300,85,20,20,3,8000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; uint32_t flasharray_thres[32]; void WRITE_TO_EEPROM(uint32_t address, int32_t data_block) @@ -34,10 +34,10 @@ void INIT_EEPROM() { - int32_t test_buffer; - e2prom.ready(); - e2prom.read(2,test_buffer); - if(test_buffer == 0) + // int32_t test_buffer; + // e2prom.ready(); + // e2prom.read(2,test_buffer); + /* if(test_buffer == 0) { for(int i=0;i<32;i++) WRITE_TO_EEPROM( i, INITIAL_EEPROM[i]); @@ -45,7 +45,7 @@ e2prom.write(2,1); gPC.printf("starting flash"); } - + */ gPC.printf("Reading intial parametrs from flash\n"); EPS_V_A_EN_STATUS = READ_FROM_EERPOM(0); // ok BAE_STATUS = READ_FROM_EERPOM(1); //ok @@ -53,7 +53,8 @@ PL_STATUS = READ_FROM_EERPOM(3); //ok PL_EPS_LATCH_SW_EN = READ_FROM_EERPOM(4); //ok RTC_INIT_STATUS = READ_FROM_EERPOM(5); - // CDMS_RTC_DISABLE = READ_FROM_EERPOM(6); + CDMS_RTC_DISABLE = READ_FROM_EERPOM(6); + EN_RTC = CDMS_RTC_DISABLE&0x01; CDMS_RESET_COUNTER = READ_FROM_EERPOM(7); //ok // TIME_LATEST_CDSMS_RESET = READ_FROM_EERPOM(8); // COM_TC_BYTES_LIMIT = READ_FROM_EERPOM(9); @@ -64,6 +65,16 @@ // COM_SESSION_TIMEOUT = READ_FROM_EERPOM(14); // COM_RSSI_MIN = READ_FROM_EERPOM(15); SD_LIB_BLK_CURRENT = READ_FROM_EERPOM(16); + // added by samp + if (CDMS_RTC_DISABLE ==0) + { + gCS_RTC=0; + spi.write(0x8C); //register address with write flag + spi.write(0x40);//enabling halt bit in the seconds register + gCS_RTC=1; + + } + } #endif \ No newline at end of file