diff options
author | Damien George <damien.p.george@gmail.com> | 2020-03-10 01:47:16 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-03-10 01:53:42 +1100 |
commit | e965363b6b66785ff088c4e998a7e80783bdd97c (patch) | |
tree | 715ea19688b298c1966cf7291d566b3952425a89 /ports/stm32/btstack.c | |
parent | d7259f6b1c746d352c658bf94a4e0d4c92712ba5 (diff) |
stm32: Refactor Bluetooth HCI RX to be independent of transport layer.
Now all HCI specific code (eg UART vs WB55 internal messaging) is confined
to modbluetooth_hci.c.
Diffstat (limited to 'ports/stm32/btstack.c')
-rw-r--r-- | ports/stm32/btstack.c | 5 |
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; |