Ejemplo n.º 1
0
void mp_hal_delay_ms(mp_uint_t ms) {
    if (ms <= 0) {
        return;
    }
    // Wraparound of tick is taken care of by 2's complement arithmetic
    uint64_t start = system_timer_current_time();
    while (system_timer_current_time() - start < (uint64_t)ms) {
        // Check for any pending events, like a KeyboardInterrupt
        mp_handle_pending();
        // Enter sleep mode, waiting for (at least) the SysTick interrupt
        __WFI();
    }
}
Ejemplo n.º 2
0
void ets_event_poll(void) {
    ets_loop_iter();
    mp_handle_pending();
}