File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 2727#include "py/runtime.h"
2828#include "py/mphal.h"
2929#include "nimble/ble.h"
30+ #include "extmod/nimble/modbluetooth_nimble.h"
3031#include "extmod/nimble/hal/hal_uart.h"
3132#include "extmod/nimble/nimble/nimble_npl_os.h"
3233#include "extmod/mpbthci.h"
@@ -74,6 +75,11 @@ void hal_uart_start_tx(uint32_t port) {
7475 #endif
7576
7677 mp_bluetooth_hci_uart_write (mp_bluetooth_hci_cmd_buf , len );
78+
79+ if (len > 0 ) {
80+ // Allow modbluetooth bindings to hook "sent packet" (e.g. to unstall l2cap channels).
81+ mp_bluetooth_nimble_sent_hci_packet ();
82+ }
7783}
7884
7985int hal_uart_close (uint32_t port ) {
Original file line number Diff line number Diff line change @@ -1392,6 +1392,9 @@ int mp_bluetooth_gattc_exchange_mtu(uint16_t conn_handle) {
13921392
13931393#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
13941394
1395+ void mp_bluetooth_nimble_sent_hci_packet (void ) {
1396+ }
1397+
13951398#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
13961399
13971400// Fortunately NimBLE uses mbuf chains correctly with L2CAP COC (rather than
Original file line number Diff line number Diff line change @@ -71,5 +71,8 @@ void mp_bluetooth_nimble_port_start(void);
7171// Tell the port to stop its background task.
7272void mp_bluetooth_nimble_port_shutdown (void );
7373
74+ // --- Called by the HCI UART layer to let us know when packets have been sent.
75+ void mp_bluetooth_nimble_sent_hci_packet (void );
76+
7477
7578#endif // MICROPY_INCLUDED_EXTMOD_NIMBLE_MODBLUETOOTH_NIMBLE_H
You can’t perform that action at this time.
0 commit comments