aboutsummaryrefslogtreecommitdiff
path: root/ports/nrf/mphalport.c
diff options
context:
space:
mode:
authorDamien George2019-10-08 16:38:04 +1100
committerDamien George2019-10-08 16:38:04 +1100
commit2863dcdf4f9f1fc421c7b745195259fbf46250a2 (patch)
treee7f14f52b53346027f5e289d654345d85817a4ff /ports/nrf/mphalport.c
parent04fe62d06f0e0e56e7dc40bdf9883c7a2f2eac6a (diff)
nrf: Add support to activate MICROPY_PY_SYS_STDFILES.
Fixes issue #5162.
Diffstat (limited to 'ports/nrf/mphalport.c')
-rw-r--r--ports/nrf/mphalport.c10
1 files changed, 10 insertions, 0 deletions
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))) {