modify flash erase func

This commit is contained in:
ethan.du 2020-08-11 11:40:52 +08:00
parent 33aaf0e8b6
commit 96cd1d3c30
2 changed files with 4 additions and 3 deletions

View File

@ -91,7 +91,8 @@ int HAL_FLASH_Write_Byte(_IN_ uint32_t sddr,_IN_ uint32_t data)
else
return SUCCESS_RET;
}
int HAL_FLASH_Erase_Sector(_IN_ uint8_t sector, _IN_ int sector_num)
int HAL_FLASH_Erase_Sector(_IN_ uint8_t sector, _IN_ uint32_t sector_num)
{
uint32_t flash_error;
HAL_StatusTypeDef ret;
@ -106,7 +107,7 @@ int HAL_FLASH_Erase_Sector(_IN_ uint8_t sector, _IN_ int sector_num)
ret = HAL_FLASHEx_Erase(&flash_erase, &flash_error);
FLASH_WaitForLastOperation(50000);
HAL_FLASH_Lock();
if(ret == HAL_ERROR){
if(HAL_ERROR == ret){
printf("erase sector in flash failed!\r\n");
return FAILURE_RET;
}

View File

@ -106,7 +106,7 @@ int HAL_FLASH_Erase_Sector(_IN_ uint8_t sector, _IN_ uint32_t sector_num)
ret = HAL_FLASHEx_Erase(&flash_erase, &flash_error);
FLASH_WaitForLastOperation(50000);
HAL_FLASH_Lock();
if(ret == HAL_ERROR){
if(HAL_ERROR == ret){
printf("erase sector in flash failed!\r\n");
return FAILURE_RET;
}