/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.  */
FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.  */
FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
{
    FLASH_Status status = FLASH_COMPLETE;
    assert_param(IS_OB_IWDG_SOURCE(OB_IWDG));
    assert_param(IS_OB_STOP_SOURCE(OB_STOP));
    assert_param(IS_OB_STDBY_SOURCE(OB_STDBY));
    status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
    if (status == FLASH_COMPLETE)
    {
        FLASH->CR |= FLASH_CR_OPTPG;
        OB->USER = (uint16_t)((uint16_t)(OB_IWDG | OB_STOP) | (uint16_t)(OB_STDBY | 0xF8));
        status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
        if (status != FLASH_TIMEOUT)
        {
            FLASH->CR &= ~FLASH_CR_OPTPG;
        }
    }
    return status;
}