bool Log_read(void) { int nsize = eflashlog.read(LOG_EEPROM, (uint8_t*)&logtable, sizeof(logtable)); if( nsize == sizeof(logtable) ) return true; return false; }
void alarm_init() { flash.read(ALARM_FLAG_FLASH_ADDR,&alarm_flag,1); if(alarm_flag != ALARM_FLAG) { alarm_flag = ALARM_FLAG; memset(alarm,0,sizeof(alarm)); for(int i = 0; i < 20; i++) { alarm[i].dt.year = 15; alarm[i].dt.month = 11; alarm[i].dt.date = 30; } flash.write(ALARM_FLASH_ADDR,(uint8_t *)alarm,sizeof(alarm)); flash.write(ALARM_FLAG_FLASH_ADDR,&alarm_flag,1); } else { load_alarm(); } }
void load_alarm() { flash.read(ALARM_FLASH_ADDR,(uint8_t *)alarm,sizeof(alarm)); }