Merge pull request #50 from ucloud/feature_modify_flash_erase_func

modify flash erase func
This commit is contained in:
ethanDu1 2020-08-11 11:41:37 +08:00 committed by GitHub
commit d149908791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}