nrf: ble_uart: Add scheduler and power management support
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>wasp-os
parent
9840d3c596
commit
d8c3988cf1
|
@ -31,6 +31,7 @@
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "mphalport.h"
|
#include "mphalport.h"
|
||||||
#include "lib/utils/interrupt_char.h"
|
#include "lib/utils/interrupt_char.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
#include "wdt.h"
|
#include "wdt.h"
|
||||||
|
|
||||||
#if MICROPY_PY_BLE_NUS
|
#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;
|
static ubluepy_advertise_data_t m_adv_data_eddystone_url;
|
||||||
#endif // BLUETOOTH_WEBBLUETOOTH_REPL
|
#endif // BLUETOOTH_WEBBLUETOOTH_REPL
|
||||||
|
|
||||||
|
static void relax(void) {
|
||||||
|
mp_handle_pending();
|
||||||
|
wdt_feed(false);
|
||||||
|
__WFI();
|
||||||
|
}
|
||||||
|
|
||||||
int mp_hal_stdin_rx_chr(void) {
|
int mp_hal_stdin_rx_chr(void) {
|
||||||
wdt_feed(false);
|
wdt_feed(false);
|
||||||
|
|
||||||
while (!ble_uart_enabled()) {
|
while (!ble_uart_enabled()) {
|
||||||
// wait for connection
|
// wait for connection
|
||||||
wdt_feed(false);
|
relax();
|
||||||
}
|
}
|
||||||
while (isBufferEmpty(mp_rx_ring_buffer)) {
|
while (isBufferEmpty(mp_rx_ring_buffer)) {
|
||||||
wdt_feed(false);
|
relax();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
|
|
Loading…
Reference in New Issue