/* Wait while the safe mode pin is being held high and blink the system led with the specified period  */
static bool wait_while_blinking(uint32_t wait_time, uint32_t period, bool force_wait)
/* Wait while the safe mode pin is being held high and blink the system led with the specified period  */
static bool wait_while_blinking(uint32_t wait_time, uint32_t period, bool force_wait)
{
        MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, ~MAP_GPIOPinRead(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN));
        UtilsDelay(UTILS_DELAY_US_TO_COUNT(period * 1000));
    }
    return MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN) ? true : false;
}