Skip to content

Commit 0b26efe

Browse files
robert-hhdpgeorge
authored andcommitted
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 micropython#8876.
1 parent af100b7 commit 0b26efe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

extmod/machine_i2c.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
328328
if (ret == 0) {
329329
mp_obj_list_append(list, MP_OBJ_NEW_SMALL_INT(addr));
330330
}
331+
#ifdef MICROPY_EVENT_POLL_HOOK
332+
MICROPY_EVENT_POLL_HOOK
333+
#endif
331334
}
332335
return list;
333336
}

0 commit comments

Comments
 (0)