
Basic
LPG_FlashIAP/LPG_FlashIAP.cpp
- Committer:
- lwtroach
- Date:
- 2019-04-24
- Branch:
- Flash_Exam
- Revision:
- 7:e556528beeba
- Parent:
- LPG_FlashIAP_Processing/LPG_FlashIAP_Processing.cpp@ 6:86eea1bcf499
- Child:
- 9:4731ae675a01
File content as of revision 7:e556528beeba:
#include "LPG_FlashIAP.h" FlashIAP flash; void LPG_FlashIAP_InitIAP() { flash.init(); } void LPG_FlashIAP_WriteToFlash(char* buffer, uint32_t addr,RawSerial DebugPort) { /* 目前無法erase成功,手動erase後可以寫入 */ int sector = flash.get_sector_size(addr); int eraseResult = flash.erase(addr,sector); DebugPort.printf("eraseResult : %s\r\n",((eraseResult==0)?"Sucess":"Fail")); int programResult = flash.program(buffer,addr,sector); DebugPort.printf("programResult : %s\r\n",((programResult==0)?"Sucess":"Fail")); flash.deinit(); } void LPG_FlashIAP_ReadFromFlash(char* buffer,uint32_t addr) { flash.read(buffer,addr,sizeof(uint32_t)); }