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: SimpleDMA eeprom mbed-rtos mbed FreescaleIAP
Fork of CDMS_CODE by
E2PROM.h
- Committer:
- chaithanyarss
- Date:
- 2017-01-22
- Revision:
- 345:cdde554477cd
- Parent:
- 344:1675dbde0bae
File content as of revision 345:cdde554477cd:
#ifndef EEPROM_H
#define EEPROM_H
#define ee_scl PIN86
#define ee_sda PIN87
#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};
void WRITE_TO_EEPROM(uint32_t address, int32_t data_block)
{
e2prom.write(address*4+10,data_block);
}
uint32_t READ_FROM_EERPOM(uint32_t address)
{
int32_t data;
e2prom.read(address*4+10, data);
return (uint32_t)data;
}
void INIT_EEPROM()
{
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]);
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);
BAE_STATUS = READ_FROM_EERPOM(1);
SD_STATUS = READ_FROM_EERPOM(2);
PL_STATUS = READ_FROM_EERPOM(3);
PL_EPS_LATCH_SW_EN = READ_FROM_EERPOM(4);
RTC_INIT_STATUS = READ_FROM_EERPOM(5);
CDMS_RTC_DISABLE = READ_FROM_EERPOM(6);
CDMS_RESET_COUNTER = READ_FROM_EERPOM(7);
TIME_LATEST_CDSMS_RESET = READ_FROM_EERPOM(8);
COM_TC_BYTES_LIMIT = READ_FROM_EERPOM(9);
COM_RX_CURRENT_MAX = READ_FROM_EERPOM(10);
COM_RX_DISABLE_TIMEOUT = READ_FROM_EERPOM(11);
COM_PA_TMP_HIGH = READ_FROM_EERPOM(12);
COM_PA_RECOVERY_TIMEOUT = READ_FROM_EERPOM(13);
COM_SESSION_TIMEOUT = READ_FROM_EERPOM(14);
COM_RSSI_MIN = READ_FROM_EERPOM(15);
SD_LIB_BLK_CURRENT = READ_FROM_EERPOM(16);
}
void THRES_WRITE_TO EEPROM(uint16_t mid, int8_t*data)
{
if(mid <11 & mid >1)
{
e2prom.write((mid-1)*128,data,128);
}
}
#endif
