summaryrefslogtreecommitdiff
path: root/esp8266
diff options
context:
space:
mode:
Diffstat (limited to 'esp8266')
-rw-r--r--esp8266/esp_mphal.c10
-rw-r--r--esp8266/esp_mphal.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c
index c78b3600f..3fd2c636d 100644
--- a/esp8266/esp_mphal.c
+++ b/esp8266/esp_mphal.c
@@ -30,6 +30,7 @@
#include "uart.h"
#include "esp_mphal.h"
#include "user_interface.h"
+#include "ets_alt_task.h"
#include "py/obj.h"
#include "py/mpstate.h"
@@ -105,6 +106,15 @@ void mp_hal_set_interrupt_char(int c) {
interrupt_char = c;
}
+void ets_event_poll(void) {
+ ets_loop_iter();
+ if (MP_STATE_VM(mp_pending_exception) != NULL) {
+ mp_obj_t obj = MP_STATE_VM(mp_pending_exception);
+ MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
+ nlr_raise(obj);
+ }
+}
+
void __assert_func(const char *file, int line, const char *func, const char *expr) {
printf("assert:%s:%d:%s: %s\n", file, line, func, expr);
nlr_raise(mp_obj_new_exception_msg(&mp_type_AssertionError,
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h
index b335470de..4edf266a5 100644
--- a/esp8266/esp_mphal.h
+++ b/esp8266/esp_mphal.h
@@ -39,5 +39,6 @@ uint32_t mp_hal_get_cpu_freq(void);
#define UART_TASK_ID 0
void uart_task_init();
+void ets_event_poll(void);
#endif // _INCLUDED_MPHAL_H_