diff options
Diffstat (limited to 'esp8266/esp_mphal.c')
-rw-r--r-- | esp8266/esp_mphal.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c index 25f1a9322f..9f090a0973 100644 --- a/esp8266/esp_mphal.c +++ b/esp8266/esp_mphal.c @@ -166,21 +166,24 @@ static int call_dupterm_read(void) { read_m[2] = MP_OBJ_NEW_SMALL_INT(1); mp_obj_t res = mp_call_method_n_kw(1, 0, read_m); if (res == mp_const_none) { + nlr_pop(); return -2; } mp_buffer_info_t bufinfo; mp_get_buffer_raise(res, &bufinfo, MP_BUFFER_READ); if (bufinfo.len == 0) { - MP_STATE_PORT(term_obj) = NULL; - mp_printf(&mp_plat_print, "dupterm: EOF received, deactivating\n"); + mp_uos_deactivate("dupterm: EOF received, deactivating\n", MP_OBJ_NULL); + nlr_pop(); return -1; } nlr_pop(); + if (*(byte*)bufinfo.buf == interrupt_char) { + mp_keyboard_interrupt(); + return -2; + } return *(byte*)bufinfo.buf; } else { - MP_STATE_PORT(term_obj) = NULL; - mp_printf(&mp_plat_print, "dupterm: Exception in read() method, deactivating: "); - mp_obj_print_exception(&mp_plat_print, nlr.ret_val); + mp_uos_deactivate("dupterm: Exception in read() method, deactivating: ", nlr.ret_val); } return -1; @@ -213,7 +216,7 @@ void mp_hal_signal_dupterm_input(void) { system_os_post(DUPTERM_TASK_ID, 0, 0); } -void mp_hal_pin_config_od(mp_hal_pin_obj_t pin_id) { +void mp_hal_pin_open_drain(mp_hal_pin_obj_t pin_id) { const pyb_pin_obj_t *pin = &pyb_pin_obj[pin_id]; if (pin->phys_port == 16) { |