ports: Provide mp_hal_stdio_poll for sys.stdio polling where needed.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "py/stream.h"
|
||||
#include "py/mphal.h"
|
||||
#include "board.h"
|
||||
|
||||
@@ -51,6 +52,14 @@ void mp_hal_set_interrupt_char(int c) {
|
||||
interrupt_char = c;
|
||||
}
|
||||
|
||||
uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
|
||||
uintptr_t ret = 0;
|
||||
if ((poll_flags & MP_STREAM_POLL_RD) && uart_rx_any()) {
|
||||
ret |= MP_STREAM_POLL_RD;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mp_hal_stdin_rx_chr(void) {
|
||||
for (;;) {
|
||||
if (uart_rx_any()) {
|
||||
|
||||
Reference in New Issue
Block a user