kopia lustrzana https://github.com/micropython/micropython
extmod/nimble: Allow modbluetooth binding to hook "sent HCI packet".
rodzic
53dfb279da
commit
edfb5d56c8
|
@ -27,6 +27,7 @@
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "nimble/ble.h"
|
#include "nimble/ble.h"
|
||||||
|
#include "extmod/nimble/modbluetooth_nimble.h"
|
||||||
#include "extmod/nimble/hal/hal_uart.h"
|
#include "extmod/nimble/hal/hal_uart.h"
|
||||||
#include "extmod/nimble/nimble/nimble_npl_os.h"
|
#include "extmod/nimble/nimble/nimble_npl_os.h"
|
||||||
#include "extmod/mpbthci.h"
|
#include "extmod/mpbthci.h"
|
||||||
|
@ -74,6 +75,11 @@ void hal_uart_start_tx(uint32_t port) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mp_bluetooth_hci_uart_write(mp_bluetooth_hci_cmd_buf, len);
|
mp_bluetooth_hci_uart_write(mp_bluetooth_hci_cmd_buf, len);
|
||||||
|
|
||||||
|
if (len > 0) {
|
||||||
|
// Allow modbluetooth bindings to hook "sent packet" (e.g. to unstall l2cap channels).
|
||||||
|
mp_bluetooth_nimble_sent_hci_packet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hal_uart_close(uint32_t port) {
|
int hal_uart_close(uint32_t port) {
|
||||||
|
|
|
@ -1392,6 +1392,9 @@ int mp_bluetooth_gattc_exchange_mtu(uint16_t conn_handle) {
|
||||||
|
|
||||||
#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
|
#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
|
||||||
|
|
||||||
|
void mp_bluetooth_nimble_sent_hci_packet(void) {
|
||||||
|
}
|
||||||
|
|
||||||
#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
|
#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
|
||||||
|
|
||||||
// Fortunately NimBLE uses mbuf chains correctly with L2CAP COC (rather than
|
// Fortunately NimBLE uses mbuf chains correctly with L2CAP COC (rather than
|
||||||
|
|
|
@ -71,5 +71,8 @@ void mp_bluetooth_nimble_port_start(void);
|
||||||
// Tell the port to stop its background task.
|
// Tell the port to stop its background task.
|
||||||
void mp_bluetooth_nimble_port_shutdown(void);
|
void mp_bluetooth_nimble_port_shutdown(void);
|
||||||
|
|
||||||
|
// --- Called by the HCI UART layer to let us know when packets have been sent.
|
||||||
|
void mp_bluetooth_nimble_sent_hci_packet(void);
|
||||||
|
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_EXTMOD_NIMBLE_MODBLUETOOTH_NIMBLE_H
|
#endif // MICROPY_INCLUDED_EXTMOD_NIMBLE_MODBLUETOOTH_NIMBLE_H
|
||||||
|
|
Ładowanie…
Reference in New Issue