Wen-ting Lo
/
STM32F303RE_LPG
Basic
Diff: LPG_FlashIAP/LPG_FlashIAP.cpp
- Revision:
- 2:e90526c0bcbe
- Child:
- 3:cb954c31709f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LPG_FlashIAP/LPG_FlashIAP.cpp Tue Apr 23 03:42:26 2019 +0000 @@ -0,0 +1,22 @@ +#include "LPG_FlashIAP.h" + +FlashIAP flash; + +void LPG_FlashIAP_InitIAP() +{ + flash.init(); +} + + +void LPG_FlashIAP_WriteToFlash(char* buffer, uint32_t addr) +{ + int sector = flash.get_page_size(); + flash.erase(addr,flash.get_sector_size(addr)); + flash.program(buffer,addr,sector); + flash.deinit(); +} + +void LPG_FlashIAP_ReadFromFlash(char* buffer) +{ + flash.read(buffer,(uint32_t)0x0800BF00/*0x08000010*/,sizeof(uint32_t)); +} \ No newline at end of file