diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2021-01-22 17:30:25 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-01-22 18:15:12 +1100 |
commit | aa136b4d78c7f81e63bde20ae17ab69bbbf456db (patch) | |
tree | a58ffd937bebd1d830db637152ca9e72f9c1c7fd /extmod/modbluetooth.h | |
parent | 49dd9ba1a5e50c400a3cfd604dd884bf9fea628c (diff) |
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>
Diffstat (limited to 'extmod/modbluetooth.h')
-rw-r--r-- | extmod/modbluetooth.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/extmod/modbluetooth.h b/extmod/modbluetooth.h index f14033de3..c96427fcb 100644 --- a/extmod/modbluetooth.h +++ b/extmod/modbluetooth.h @@ -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): |