summaryrefslogtreecommitdiff
path: root/esp8266/main.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-01 14:02:36 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-01 14:02:36 +0300
commit785cf9a61f373ee871b4181c499d9d99ad081615 (patch)
treee33d4e6811c616e03e0e0e71c2f9ffee259c1903 /esp8266/main.c
parent777232c9a5ce15ca7c7b0b3c52dd2a3b00bb1acc (diff)
esp8266: Support dedicated REPL loop (aka pull-style).
Event-driven loop (push-style) is still supported and default (controlled by MICROPY_REPL_EVENT_DRIVEN setting, as expected). Dedicated loop worked even without adding ets_loop_iter(), though that needs to be revisited later.
Diffstat (limited to 'esp8266/main.c')
-rw-r--r--esp8266/main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/esp8266/main.c b/esp8266/main.c
index bb282462f..de9df7413 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -62,15 +62,38 @@ void soft_reset(void) {
mp_hal_stdout_tx_str("PYB: soft reboot\r\n");
mp_hal_delay_us(10000); // allow UART to flush output
mp_reset();
+ #if MICROPY_REPL_EVENT_DRIVEN
pyexec_event_repl_init();
+ #endif
}
void init_done(void) {
+ #if MICROPY_REPL_EVENT_DRIVEN
uart_task_init();
+ #endif
mp_reset();
mp_hal_stdout_tx_str("\r\n");
+ #if MICROPY_REPL_EVENT_DRIVEN
pyexec_event_repl_init();
+ #endif
dupterm_task_init();
+
+ #if !MICROPY_REPL_EVENT_DRIVEN
+soft_reset:
+ for (;;) {
+ if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
+ if (pyexec_raw_repl() != 0) {
+ break;
+ }
+ } else {
+ if (pyexec_friendly_repl() != 0) {
+ break;
+ }
+ }
+ }
+ soft_reset();
+ goto soft_reset;
+ #endif
}
void user_init(void) {