stm32f1xx_hal_sram.c: Fix that SRAM state not set correctly

Fixes SRAM HAL code always set `State` to `HAL_SRAM_STATE_READY` even `WriteOperation` is not set.
This commit is contained in:
Jisu Yu 2023-07-11 10:57:10 +09:00 committed by GitHub
parent bdec2f6b06
commit bd0201714b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -215,7 +215,10 @@ HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FSMC_NORSRAM_TimingTy
__FSMC_NORSRAM_ENABLE(hsram->Instance, hsram->Init.NSBank);
/* Initialize the SRAM controller state */
hsram->State = HAL_SRAM_STATE_READY;
if (hsram->Init.WriteOperation == FSMC_WRITE_OPERATION_DISABLE)
hsram->State = HAL_SRAM_STATE_PROTECTED;
else
hsram->State = HAL_SRAM_STATE_READY;
return HAL_OK;
}