#ifndef __cfg_c #define __cfg_c #include "cfg.h" #include "astro.h" #include "int.h" prog_char row_update_ok[17] = "UPDATE OK \0"; prog_char row_noinit[17] = "NOT INITIALIZED \0"; prog_char row_error[17] = "ERROR \0"; CONFIG cfg; unsigned char loadCfg(unsigned char nr ){ double ftmp1; if( RTCGetCfgRAM((BYTE *)&cfg, RTCDEVICEID, (BYTE)sizeof(cfg) * nr, (WORD)sizeof( cfg )) == RTC_SUCCESSFUL ){ cCurrentStarTime(); ftmp1 = LAST / NORMSEC_0400_STPART; il_last = (long)ftmp1; if( cfg.init != 123 ){ LCDPos(0,0); LCDWriteP((char *)&row_noinit); Delay1ms( 800 ); } return(1); } LCDPos(0,0); LCDWriteP((char *)&row_error); Delay1ms( 2000 ); return(0); } void storeCfg(unsigned char nr ){ cfg.init = 123; if( RTCPutCfgRAM((BYTE *)&cfg, RTCDEVICEID, (BYTE)sizeof(cfg) * nr, (WORD)sizeof( cfg )) == RTC_SUCCESSFUL ){ LCDPos(0,0); LCDWriteP((char *)&row_update_ok); Delay1ms( 800 ); return; } LCDPos(0,0); LCDWriteP((char *)&row_error); Delay1ms( 2000 ); } #endif