extmod/modbluetooth: Add ble.hci_cmd(ogf, ocf, req, resp) function.
This allows sending arbitrary HCI commands and getting the response. The return value of the function is the status of the command. This is intended for debugging and not to be a part of the public API, and must be enabled via mpconfigboard.h. It's currently only implemented for NimBLE bindings. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
committed by
Damien George
parent
49dd9ba1a5
commit
aa136b4d78
@@ -60,6 +60,12 @@
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (0)
|
||||
#endif
|
||||
|
||||
// Optionally enable support for the `hci_cmd` function allowing
|
||||
// Python to directly low-level HCI commands.
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD (0)
|
||||
#endif
|
||||
|
||||
// This is used to protect the ringbuffer.
|
||||
// A port may no-op this if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS is enabled.
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENTER
|
||||
@@ -387,6 +393,10 @@ int mp_bluetooth_l2cap_send(uint16_t conn_handle, uint16_t cid, const uint8_t *b
|
||||
int mp_bluetooth_l2cap_recvinto(uint16_t conn_handle, uint16_t cid, uint8_t *buf, size_t *len);
|
||||
#endif // MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
|
||||
|
||||
#if MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD
|
||||
int mp_bluetooth_hci_cmd(uint16_t ogf, uint16_t ocf, const uint8_t *req, size_t req_len, uint8_t *resp, size_t resp_len, uint8_t *status);
|
||||
#endif // MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// API implemented by modbluetooth (called by port-specific implementations):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user