From 3dfcef31775bf34a01f8ca2dc35c3359dfad14a6 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Tue, 30 Jun 2020 22:58:25 +0100 Subject: [PATCH] nrf: ble_uart: Add scheduler and power management support Signed-off-by: Daniel Thompson --- ports/nrf/drivers/bluetooth/ble_uart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ports/nrf/drivers/bluetooth/ble_uart.c b/ports/nrf/drivers/bluetooth/ble_uart.c index c58ebe4a9..3988dc300 100644 --- a/ports/nrf/drivers/bluetooth/ble_uart.c +++ b/ports/nrf/drivers/bluetooth/ble_uart.c @@ -98,15 +98,21 @@ static ubluepy_advertise_data_t m_adv_data_uart_service; static ubluepy_advertise_data_t m_adv_data_eddystone_url; #endif // BLUETOOTH_WEBBLUETOOTH_REPL +static void relax(void) { + mp_handle_pending(true); + wdt_feed(false); + __WFI(); +} + int mp_hal_stdin_rx_chr(void) { wdt_feed(false); while (!ble_uart_enabled()) { // wait for connection - wdt_feed(false); + relax(); } while (isBufferEmpty(mp_rx_ring_buffer)) { - wdt_feed(false); + relax(); } uint8_t byte;