summaryrefslogtreecommitdiff
path: root/ports/stm32/btstack.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/btstack.c')
-rw-r--r--ports/stm32/btstack.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ports/stm32/btstack.c b/ports/stm32/btstack.c
index f7669d1fc..cbb15a86c 100644
--- a/ports/stm32/btstack.c
+++ b/ports/stm32/btstack.c
@@ -165,8 +165,9 @@ STATIC void btstack_uart_process(void) {
// Append any new bytes to the recv buffer, notifying bstack if we've got
// the number of bytes it was looking for.
- while (uart_rx_any(&mp_bluetooth_hci_uart_obj) && recv_idx < recv_len) {
- recv_buf[recv_idx++] = uart_rx_char(&mp_bluetooth_hci_uart_obj);
+ int chr;
+ while (recv_idx < recv_len && (chr = mp_bluetooth_hci_uart_readchar()) >= 0) {
+ recv_buf[recv_idx++] = chr;
if (recv_idx == recv_len) {
recv_idx = 0;
recv_len = 0;