bool LoadPara(sPara* pp) { const u16 LEN8=sizeof(sPara)-PSUB; const u16 LEN16=LEN8/2+LEN8%2; bool r=false; sPara *pInitData; u16 p[LEN16]; STMFLASH_Read(PARA_ADDR,p,LEN16); pInitData = (sPara*)p; if(pInitData->TaiFlag == TAILFLAG) { if(GetCheckSum((u8*)pInitData,LEN8)) { LoadDefaultPara(pp); }else { *pp = *((sPara*)p); r=true; } }else { LoadDefaultPara(pp); } return r; }
理解问题bool LoadPara(sPara* pp) { const u16 LEN8=sizeof(sPara)-PSUB; const u16 LEN16=LEN8/2+LEN8%2; bool r=false; sPara *pInitData; u16 p[LEN16]; STMFLASH_Read(PARA_ADDR,p,LEN16); pInitData = (sPara*)p; if(pInitData->TaiFlag == TAILFLAG) { if(GetCheckSum((u8*)pInitData,LEN8)) { LoadDefaultPara(pp); }else { *pp = *((sPara*)p); r=true; } }else { LoadDefaultPara(pp); } return r; }
已完成理解「bool LoadPara(sPara* pp) { const u16 LEN8=sizeof(sPara)-PSUB; const u16 LEN16=LEN8/2+LEN8%2; bool r=false; sPara *pInitData; u16 p[LEN16]; STMFLASH_Read(PARA_ADDR,p,LEN16); pInitData = (sPara*)p; if(pInitData->TaiFlag == TAILFLAG) { if(GetCheckSum((u8*)pInitData,LEN8)) { LoadDefaultPara(pp); }else { *pp = *((sPara*)p); r=true; } }else { LoadDefaultPara(pp); } return r; }」
展开阅读网页