-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
esp8266/uart: rework uart io structure so it can work with dupterm() and be used to disable stdio #2891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp8266/uart: rework uart io structure so it can work with dupterm() and be used to disable stdio #2891
Changes from 4 commits
941568b
293f40a
d31d4b6
2cb4b5c
3753d28
a9c8f8d
1916cef
d325cc2
8f8fc5f
ab2301b
fcf1aa4
b2a8bcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,20 @@ void mp_hal_signal_input(void) { | |
#endif | ||
} | ||
|
||
void mp_hal_uart_rx_intr(int uart_no) { | ||
int ch; | ||
for (;;) { | ||
if ((ch = uart_rx_one_char(uart_no))==-1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the correct spacing? if ((ch = uart_rx_one_char(uart_no)) == -1) |
||
break; | ||
if (ch == mp_interrupt_char) | ||
mp_keyboard_interrupt(); | ||
else | ||
ringbuf_put(&input_buf, ch); | ||
} | ||
mp_hal_signal_input(); | ||
} | ||
|
||
|
||
static int call_dupterm_read(void) { | ||
if (MP_STATE_PORT(term_obj) == NULL) { | ||
return -1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,10 @@ extern const struct _mp_print_t mp_debug_print; | |
extern ringbuf_t input_buf; | ||
// Call this after putting data to input_buf | ||
void mp_hal_signal_input(void); | ||
// Call this to put characters into connected uart buffer if repl connected | ||
void mp_hal_uart_rx_intr(int uart_no); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way this function is currently implemented, it handles chars even if REPL is not connected. |
||
|
||
|
||
// Call this when data is available in dupterm object | ||
void mp_hal_signal_dupterm_input(void); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this belongs in machine_uart.c, since it's specific to UART behaviour. Also, since UART1 can't receive it doesn't need to take an argument.