diff options
author | Damien George <damien.p.george@gmail.com> | 2016-04-01 14:53:01 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-01 14:53:01 +0300 |
commit | 6a051a8e0ba6b16001c72df0b77697caba2756c4 (patch) | |
tree | d75a6bf40050862e0991cfa1b20874fabf25f65a /esp8266/uart.c | |
parent | fb6cc96951f14bdb059e37ffde09b9b73a5a756f (diff) | |
download | micropython-6a051a8e0ba6b16001c72df0b77697caba2756c4.tar.gz micropython-6a051a8e0ba6b16001c72df0b77697caba2756c4.zip |
esp8266/uart: Get ctrl-C working now that event-based REPL is disabled.
Diffstat (limited to 'esp8266/uart.c')
-rw-r--r-- | esp8266/uart.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/esp8266/uart.c b/esp8266/uart.c index ed5e1d9979..0d180aa55b 100644 --- a/esp8266/uart.c +++ b/esp8266/uart.c @@ -38,6 +38,11 @@ static os_event_t uart_evt_queue[16]; static void uart0_rx_intr_handler(void *para); +void soft_reset(void); +void mp_keyboard_interrupt(void); + +int interrupt_char; + /****************************************************************************** * FunctionName : uart_config * Description : Internal used function @@ -168,7 +173,11 @@ static void uart0_rx_intr_handler(void *para) { while (READ_PERI_REG(UART_STATUS(uart_no)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) { uint8 RcvChar = READ_PERI_REG(UART_FIFO(uart_no)) & 0xff; - ringbuf_put(&input_buf, RcvChar); + if (RcvChar == interrupt_char) { + mp_keyboard_interrupt(); + } else { + ringbuf_put(&input_buf, RcvChar); + } } mp_hal_signal_input(); @@ -237,10 +246,6 @@ void ICACHE_FLASH_ATTR uart_reattach() { #include "py/obj.h" #include "lib/utils/pyexec.h" -void soft_reset(void); -void mp_keyboard_interrupt(void); - -int interrupt_char; #if MICROPY_REPL_EVENT_DRIVEN void uart_task_handler(os_event_t *evt) { if (pyexec_repl_active) { |