aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/nimble.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/nimble.c')
-rw-r--r--ports/stm32/nimble.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/ports/stm32/nimble.c b/ports/stm32/nimble.c
index ff78a0a1a..1f4aa4b2c 100644
--- a/ports/stm32/nimble.c
+++ b/ports/stm32/nimble.c
@@ -67,28 +67,13 @@ void mp_bluetooth_nimble_port_start(void) {
ble_hs_start();
}
-#if defined(STM32WB)
-
-#include "rfcore.h"
-
-void mp_bluetooth_nimble_hci_uart_rx(hal_uart_rx_cb_t rx_cb, void *rx_arg) {
- // Protect in case it's called from ble_npl_sem_pend at thread-level
- MICROPY_PY_LWIP_ENTER
- rfcore_ble_check_msg(rx_cb, rx_arg);
- MICROPY_PY_LWIP_EXIT
-}
-
-#else
-
-#include "uart.h"
-
void mp_bluetooth_nimble_hci_uart_rx(hal_uart_rx_cb_t rx_cb, void *rx_arg) {
bool host_wake = mp_bluetooth_hci_controller_woken();
- while (uart_rx_any(&mp_bluetooth_hci_uart_obj)) {
- uint8_t data = uart_rx_char(&mp_bluetooth_hci_uart_obj);
+ int chr;
+ while ((chr = mp_bluetooth_hci_uart_readchar()) >= 0) {
//printf("UART RX: %02x\n", data);
- rx_cb(rx_arg, data);
+ rx_cb(rx_arg, chr);
}
if (host_wake) {
@@ -96,8 +81,6 @@ void mp_bluetooth_nimble_hci_uart_rx(hal_uart_rx_cb_t rx_cb, void *rx_arg) {
}
}
-#endif // defined(STM32WB)
-
void mp_bluetooth_nimble_hci_uart_tx_strn(const char *str, uint len) {
mp_bluetooth_hci_uart_write((const uint8_t *)str, len);
}