Skip to content

Commit 6a051a8

Browse files
dpgeorgepfalcon
authored andcommitted
esp8266/uart: Get ctrl-C working now that event-based REPL is disabled.
1 parent fb6cc96 commit 6a051a8

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

esp8266/uart.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ static os_event_t uart_evt_queue[16];
3838

3939
static void uart0_rx_intr_handler(void *para);
4040

41+
void soft_reset(void);
42+
void mp_keyboard_interrupt(void);
43+
44+
int interrupt_char;
45+
4146
/******************************************************************************
4247
* FunctionName : uart_config
4348
* Description : Internal used function
@@ -168,7 +173,11 @@ static void uart0_rx_intr_handler(void *para) {
168173

169174
while (READ_PERI_REG(UART_STATUS(uart_no)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) {
170175
uint8 RcvChar = READ_PERI_REG(UART_FIFO(uart_no)) & 0xff;
171-
ringbuf_put(&input_buf, RcvChar);
176+
if (RcvChar == interrupt_char) {
177+
mp_keyboard_interrupt();
178+
} else {
179+
ringbuf_put(&input_buf, RcvChar);
180+
}
172181
}
173182

174183
mp_hal_signal_input();
@@ -237,10 +246,6 @@ void ICACHE_FLASH_ATTR uart_reattach() {
237246
#include "py/obj.h"
238247
#include "lib/utils/pyexec.h"
239248

240-
void soft_reset(void);
241-
void mp_keyboard_interrupt(void);
242-
243-
int interrupt_char;
244249
#if MICROPY_REPL_EVENT_DRIVEN
245250
void uart_task_handler(os_event_t *evt) {
246251
if (pyexec_repl_active) {

0 commit comments

Comments
 (0)