summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
Diffstat (limited to 'extmod')
-rw-r--r--extmod/modbluetooth_hci.h1
-rw-r--r--extmod/nimble/nimble/npl_os.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/extmod/modbluetooth_hci.h b/extmod/modbluetooth_hci.h
index 6d44761a4..d6b432d22 100644
--- a/extmod/modbluetooth_hci.h
+++ b/extmod/modbluetooth_hci.h
@@ -50,6 +50,7 @@ extern pyb_uart_obj_t mp_bluetooth_hci_uart_obj;
int mp_bluetooth_hci_uart_init(uint32_t port);
int mp_bluetooth_hci_uart_activate(void);
int mp_bluetooth_hci_uart_set_baudrate(uint32_t baudrate);
+int mp_bluetooth_hci_uart_readchar(void);
int mp_bluetooth_hci_uart_write(const uint8_t *buf, size_t len);
#endif // MICROPY_INCLUDED_EXTMOD_MODBLUETOOTH_HCI_H
diff --git a/extmod/nimble/nimble/npl_os.c b/extmod/nimble/nimble/npl_os.c
index 57ab689e6..620dcb0ae 100644
--- a/extmod/nimble/nimble/npl_os.c
+++ b/extmod/nimble/nimble/npl_os.c
@@ -235,7 +235,11 @@ ble_npl_error_t ble_npl_sem_pend(struct ble_npl_sem *sem, ble_npl_time_t timeout
if (sem->count == 0) {
uint32_t t0 = mp_hal_ticks_ms();
while (sem->count == 0 && mp_hal_ticks_ms() - t0 < timeout) {
+ // This function may be called at thread-level, so execute
+ // mp_bluetooth_nimble_hci_uart_process at raised priority.
+ MICROPY_PY_BLUETOOTH_ENTER
mp_bluetooth_nimble_hci_uart_process();
+ MICROPY_PY_BLUETOOTH_EXIT
if (sem->count != 0) {
break;
}