/**
* @简述 返回 FLASH 状态.
* @参数 没有
* @返回 FLASH 状态: 返回值可以是: FLASH_BUSY, FLASH_ERROR_PG,
* FLASH_ERROR_WRP 或 FLASH_COMPLETE
*/
FLASH_Status FLASH_GetStatus(void)
{
FLASH_Status flashstatus = FLASH_COMPLETE;
if((FLASH->SR & FLASH_FLAG_BSY) == FLASH_FLAG_BSY)
{
flashstatus = FLASH_BUSY;
}
else
{
if((FLASH->SR & FLASH_FLAG_PGERR) != 0)
{
flashstatus = FLASH_ERROR_PG;
}
else
{
if((FLASH->SR & FLASH_FLAG_WRPRTERR) != 0 )
{
flashstatus = FLASH_ERROR_WRP;
}
else
{
flashstatus = FLASH_COMPLETE;
}
}
}
/* 返回 FLASH 状态 */
return flashstatus;
} |