/* Waits for a Flash operation to complete or a TIMEOUT to occur.  */
FLASH_STS FLASH_WaitForLastOpt(uint32_t Timeout)
/* Waits for a Flash operation to complete or a TIMEOUT to occur.  */
FLASH_STS FLASH_WaitForLastOpt(uint32_t Timeout)
{
    FLASH_STS status = FLASH_COMPL;
    status = FLASH_GetSTS();
    while ((status == FLASH_BUSY) && (Timeout != 0x00))
    {
        status = FLASH_GetSTS();
        Timeout--;
    }
    if (Timeout == 0x00)
    {
        status = FLASH_TIMEOUT;
    }
    return status;
}