diff options
| author | robert-hh <robert@hammelrath.com> | 2022-08-28 18:14:53 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-08-31 12:06:11 +1000 |
| commit | 0b26efe73dd3396bdc2b77651a78d9f2edeb9004 (patch) | |
| tree | fbc63f50306d01d004c2885f5711c0d6b76a16d0 | |
| parent | af100b70290d20d7e9c3e7d49713e3916b6f05b6 (diff) | |
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.
| -rw-r--r-- | extmod/machine_i2c.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c index 2aa217914..ff597b58c 100644 --- a/extmod/machine_i2c.c +++ b/extmod/machine_i2c.c @@ -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; } |
