summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/nrf/Makefile3
-rw-r--r--ports/nrf/mphalport.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 1b70851eb..aa6c189aa 100644
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -156,6 +156,7 @@ SRC_LIB += $(addprefix lib/,\
libc/string0.c \
mp-readline/readline.c \
utils/pyexec.c \
+ utils/sys_stdio_mphal.c \
utils/interrupt_char.c \
timeutils/timeutils.c \
)
@@ -342,7 +343,7 @@ $(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
$(Q)$(SIZE) $@
# List of sources for qstr extraction
-SRC_QSTR += $(SRC_C) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES)
+SRC_QSTR += $(SRC_C) $(SRC_LIB) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
diff --git a/ports/nrf/mphalport.c b/ports/nrf/mphalport.c
index a050df147..bf8969708 100644
--- a/ports/nrf/mphalport.c
+++ b/ports/nrf/mphalport.c
@@ -30,6 +30,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "py/runtime.h"
+#include "py/stream.h"
#include "uart.h"
#include "nrfx_errors.h"
#include "nrfx_config.h"
@@ -53,6 +54,15 @@ void mp_hal_set_interrupt_char(int c) {
#endif
#if !MICROPY_PY_BLE_NUS
+uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
+ uintptr_t ret = 0;
+ if ((poll_flags & MP_STREAM_POLL_RD) && MP_STATE_PORT(board_stdio_uart) != NULL
+ && uart_rx_any(MP_STATE_PORT(board_stdio_uart))) {
+ ret |= MP_STREAM_POLL_RD;
+ }
+ return ret;
+}
+
int mp_hal_stdin_rx_chr(void) {
for (;;) {
if (MP_STATE_PORT(board_stdio_uart) != NULL && uart_rx_any(MP_STATE_PORT(board_stdio_uart))) {