Basic

Dependencies:   MQTT

LPG_FlashIAP/LPG_FlashIAP.cpp

Committer:
lwtroach
Date:
2019-04-23
Revision:
2:e90526c0bcbe
Child:
3:cb954c31709f

File content as of revision 2:e90526c0bcbe:

#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));
}