File tree Expand file tree Collapse file tree 4 files changed +28
-28
lines changed Expand file tree Collapse file tree 4 files changed +28
-28
lines changed Original file line number Diff line number Diff line change @@ -149,31 +149,6 @@ void mp_hal_signal_input(void) {
149
149
#endif
150
150
}
151
151
152
- void mp_hal_uart_rx_intr (int uart_no ) {
153
- int ch ;
154
- mp_obj_t term = MP_STATE_PORT (term_obj );
155
- bool uart_term = (term == NULL || term == MP_STATE_PORT (pyb_uart_objs )[uart_no ]);
156
-
157
- for (;;) {
158
- if ((ch = uart_rx_one_char (uart_no )) == -1 ) {
159
- break ;
160
- }
161
- if (uart_term ) {
162
- if (ch == mp_interrupt_char ) {
163
- mp_keyboard_interrupt ();
164
- } else {
165
- ringbuf_put (& input_buf , ch );
166
- }
167
- } else {
168
- void mp_uart_stuff_rx (mp_obj_t self_in , byte ch );
169
- mp_uart_stuff_rx (MP_STATE_PORT (pyb_uart_objs )[uart_no ],ch );
170
- }
171
- }
172
- if (uart_term ) {
173
- mp_hal_signal_input ();
174
- }
175
- }
176
-
177
152
178
153
static int call_dupterm_read (void ) {
179
154
if (MP_STATE_PORT (term_obj ) == NULL ) {
Original file line number Diff line number Diff line change @@ -37,8 +37,6 @@ extern const struct _mp_print_t mp_debug_print;
37
37
extern ringbuf_t input_buf ;
38
38
// Call this after putting data to input_buf
39
39
void mp_hal_signal_input (void );
40
- // Call this to put characters into connected uart buffer if repl connected
41
- void mp_hal_uart_rx_intr (int uart_no );
42
40
// Call this when data is available in dupterm object
43
41
void mp_hal_signal_dupterm_input (void );
44
42
Original file line number Diff line number Diff line change @@ -248,6 +248,30 @@ void mp_uart_stuff_rx(mp_obj_t self_in, byte ch) {
248
248
ringbuf_put (& self -> rxbuf ,ch );
249
249
}
250
250
251
+ void uart_handle_rx () {
252
+ int ch ;
253
+ mp_obj_t term = MP_STATE_PORT (term_obj );
254
+ bool uart_term = (term == NULL || term == MP_STATE_PORT (pyb_uart_objs )[0 ]);
255
+
256
+ for (;;) {
257
+ if ((ch = uart_rx_one_char (0 )) == -1 ) {
258
+ break ;
259
+ }
260
+ if (uart_term ) {
261
+ if (ch == mp_interrupt_char ) {
262
+ mp_keyboard_interrupt ();
263
+ } else {
264
+ ringbuf_put (& input_buf , ch );
265
+ }
266
+ } else {
267
+ mp_uart_stuff_rx (MP_STATE_PORT (pyb_uart_objs )[0 ], ch );
268
+ }
269
+ }
270
+ if (uart_term ) {
271
+ mp_hal_signal_input ();
272
+ }
273
+ }
274
+
251
275
// Waits at most timeout microseconds for at least 1 char to become ready for reading.
252
276
// Returns true if something available, false if not.
253
277
STATIC bool uart_rx_wait (pyb_uart_obj_t * self , uint32_t timeout_us ) {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ static void uart0_rx_intr_handler(void *para);
38
38
39
39
void soft_reset (void );
40
40
void mp_keyboard_interrupt (void );
41
+ void uart_handle_rx ();
41
42
42
43
/******************************************************************************
43
44
* FunctionName : uart_config
@@ -167,7 +168,9 @@ static void uart0_rx_intr_handler(void *para) {
167
168
} else if (UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG (UART_INT_ST (uart_no )) & UART_RXFIFO_TOUT_INT_ST )) {
168
169
read_chars :
169
170
ETS_UART_INTR_DISABLE ();
170
- mp_hal_uart_rx_intr (uart_no );
171
+
172
+ uart_handle_rx ();
173
+
171
174
// Clear pending FIFO interrupts
172
175
WRITE_PERI_REG (UART_INT_CLR (UART_REPL ), UART_RXFIFO_TOUT_INT_CLR | UART_RXFIFO_FULL_INT_ST );
173
176
ETS_UART_INTR_ENABLE ();
You can’t perform that action at this time.
0 commit comments