diff options
author | Damien George <damien.p.george@gmail.com> | 2018-04-23 17:06:40 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-04-23 17:06:40 +1000 |
commit | 513e5372155bed86285aa38ce828390c65d52761 (patch) | |
tree | 846a21fde8d08503c0d640fd0b20d0480bcd04b4 | |
parent | d870a4e835cf1474db7f58b3df78c11e3e7e34bc (diff) |
stm32/uart: Allow ctrl-C to issue keyboard intr when REPL is over UART.
-rw-r--r-- | ports/stm32/uart.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index a8b5d7dca..0621dc725 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -32,8 +32,10 @@ #include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" +#include "lib/utils/interrupt_char.h" #include "uart.h" #include "irq.h" +#include "pendsv.h" /// \moduleref pyb /// \class UART - duplex serial communication bus @@ -506,6 +508,11 @@ void uart_irq_handler(mp_uint_t uart_id) { int data = self->uart.Instance->DR; // clears UART_FLAG_RXNE #endif data &= self->char_mask; + // Handle interrupt coming in on a UART REPL + if (data == mp_interrupt_char && self == MP_STATE_PORT(pyb_stdio_uart)) { + pendsv_kbd_intr(); + return; + } if (self->char_width == CHAR_WIDTH_9BIT) { ((uint16_t*)self->read_buf)[self->read_buf_head] = data; } else { |