HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
{
uint32_t error;
uint32_t eccerr;
/* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
Even if the FLASH operation fails, the BUSY flag will be reset and an error
flag will be set */
uint32_t timeout = HAL_GetTick() + Timeout;
/* Wait if any operation is ongoing */
while (__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY) != 0x00U)
{
if (HAL_GetTick() >= timeout)
{
return HAL_TIMEOUT;
}
}
这里的 if (HAL_GetTick() >= timeout)怎么理解?
貌似是1MS的基准,如果是FLASH_WaitForLastOperation(1000),就是等待1秒时间吗?
那么HAL_GetTick() >= timeout等同于上一刻的HAL_GetTick() >= HAL_GetTick() + Timeout,意义是啥? |