mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
extmod/machine_i2c: Call MICROPY_PY_EVENT_HOOK during i2c.scan().
Avoiding a watchdog reset during i2c.scan() if the hardware is not properly set up (eg on esp8266), and also allowing to stop the scan with a KeyboardInterrupt. Fixes issue #8876.
This commit is contained in:
@@ -328,6 +328,9 @@ STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
|
||||
if (ret == 0) {
|
||||
mp_obj_list_append(list, MP_OBJ_NEW_SMALL_INT(addr));
|
||||
}
|
||||
#ifdef MICROPY_EVENT_POLL_HOOK
|
||||
MICROPY_EVENT_POLL_HOOK
|
||||
#endif
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user