OSStatus MICOReadConfiguration(mico_Context_t *inContext)
{
  uint32_t configInFlash;
  OSStatus err = kNoErr;
  configInFlash = PARA_START_ADDRESS;
  err = MicoFlashRead(MICO_FLASH_FOR_PARA, &configInFlash, (uint8_t *)&inContext->flashContentInRam, sizeof(flash_content_t));
  seedNum = inContext->flashContentInRam.micoSystemConfig.seed;
  if(seedNum == -1) seedNum = 0;

  if(inContext->flashContentInRam.appConfig.configDataVer != CONFIGURATION_VERSION){
    err = MICORestoreDefault(inContext);
    require_noerr(err, exit);
    MicoSystemReboot();
  }

  if(inContext->flashContentInRam.micoSystemConfig.dhcpEnable == DHCP_Disable){
    strcpy((char *)inContext->micoStatus.localIp, inContext->flashContentInRam.micoSystemConfig.localIp);
    strcpy((char *)inContext->micoStatus.netMask, inContext->flashContentInRam.micoSystemConfig.netMask);
    strcpy((char *)inContext->micoStatus.gateWay, inContext->flashContentInRam.micoSystemConfig.gateWay);
    strcpy((char *)inContext->micoStatus.dnsServer, inContext->flashContentInRam.micoSystemConfig.dnsServer);
  }

exit: 
  return err;
}
예제 #2
0
void PlatformEasyLinkButtonLongPressedCallback(void)
{
  mico_log_trace();
  MICORestoreDefault(context);
  context->micoStatus.sys_state = eState_Software_Reset;
  require(context->micoStatus.sys_state_change_sem, exit);
  mico_rtos_set_semaphore(&context->micoStatus.sys_state_change_sem);
exit: 
  return;
}
예제 #3
0
USED void PlatformEasyLinkButtonLongPressedCallback(void)
{
  mico_log_trace();
  
  context->flashContentInRam.micoSystemConfig.configured = wLanUnConfigured;
  MICORestoreDefault(context);
  
  context->micoStatus.sys_state = eState_Software_Reset;
  require(context->micoStatus.sys_state_change_sem, exit);
  mico_rtos_set_semaphore(&context->micoStatus.sys_state_change_sem);
exit: 
  return;
}