diff options
| author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2022-05-25 12:41:51 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-06-03 11:53:28 +1000 |
| commit | 91fb9e7888d5babb6e52427eeb67fcd052a30a10 (patch) | |
| tree | 79f2a86d3c1a07b02acf8225edbab796393b3a08 /extmod/mpbthci.h | |
| parent | 19c680ff579c5d250d8929959b392f236286bb66 (diff) | |
extmod/nimble: Add support for reading whole HCI UART packets.
This can improve efficiency for Bluetooth systems that already process
whole packets at the lower layers.
Diffstat (limited to 'extmod/mpbthci.h')
| -rw-r--r-- | extmod/mpbthci.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/extmod/mpbthci.h b/extmod/mpbthci.h index 699723803..c10f99c3d 100644 --- a/extmod/mpbthci.h +++ b/extmod/mpbthci.h @@ -27,6 +27,9 @@ #ifndef MICROPY_INCLUDED_EXTMOD_MPBTHCI_H #define MICROPY_INCLUDED_EXTMOD_MPBTHCI_H +#define MICROPY_PY_BLUETOOTH_HCI_READ_MODE_BYTE (0) +#define MICROPY_PY_BLUETOOTH_HCI_READ_MODE_PACKET (1) + // --- Optionally can be implemented by the driver. --------------------------- // Start/stop the HCI controller. @@ -46,7 +49,13 @@ int mp_bluetooth_hci_uart_init(uint32_t port, uint32_t baudrate); int mp_bluetooth_hci_uart_deinit(void); int mp_bluetooth_hci_uart_set_baudrate(uint32_t baudrate); int mp_bluetooth_hci_uart_any(void); -int mp_bluetooth_hci_uart_readchar(void); int mp_bluetooth_hci_uart_write(const uint8_t *buf, size_t len); +// Used for mode: MICROPY_PY_BLUETOOTH_HCI_READ_MODE_BYTE +int mp_bluetooth_hci_uart_readchar(void); + +// Used for mode: MICROPY_PY_BLUETOOTH_HCI_READ_MODE_PACKET +typedef void (*mp_bluetooth_hci_uart_readchar_t)(uint8_t chr); +int mp_bluetooth_hci_uart_readpacket(mp_bluetooth_hci_uart_readchar_t handler); + #endif // MICROPY_INCLUDED_EXTMOD_MPBTHCI_H |
