nrf: ble_uart: Add scheduler and power management support

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
wasp-os
Daniel Thompson 2020-06-30 22:58:25 +01:00
parent 9840d3c596
commit d8c3988cf1
1 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,7 @@
#include "ringbuffer.h"
#include "mphalport.h"
#include "lib/utils/interrupt_char.h"
#include "py/runtime.h"
#include "wdt.h"
#if MICROPY_PY_BLE_NUS
@ -93,15 +94,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();
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;