diff options
| author | iabdalkader <i.abdalkader@gmail.com> | 2023-04-10 18:16:38 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-09-15 16:43:15 +1000 |
| commit | 1976781d33547d32c72971e8a9d6bb598d6fa93e (patch) | |
| tree | 55e8e8a5806c9db7a87f2ca78fdee4eaaffdc4de | |
| parent | 6abe3e1714ca32524358e1e1ddde16872d7d7cea (diff) | |
rp2/mpbthciport: Fix HCI UART config.
Fixes are:
- The baudrate argument is a keyword arg, it was passed before as a
positional arg.
- Use the port and baudrate arguments passed from higher level code instead
of the hard-coded port ID and baudrate, which would allow HCI drivers to
change baudrates.
- Increase UART char timeout and RX buffer size.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
| -rw-r--r-- | ports/rp2/mpbthciport.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ports/rp2/mpbthciport.c b/ports/rp2/mpbthciport.c index 9a24ebdc3..772236092 100644 --- a/ports/rp2/mpbthciport.c +++ b/ports/rp2/mpbthciport.c @@ -87,16 +87,18 @@ int mp_bluetooth_hci_uart_init(uint32_t port, uint32_t baudrate) { debug_printf("mp_bluetooth_hci_uart_init\n"); mp_obj_t args[] = { - MP_OBJ_NEW_SMALL_INT(MICROPY_HW_BLE_UART_ID), - MP_OBJ_NEW_SMALL_INT(MICROPY_HW_BLE_UART_BAUDRATE), + MP_OBJ_NEW_SMALL_INT(port), + MP_OBJ_NEW_QSTR(MP_QSTR_baudrate), MP_OBJ_NEW_SMALL_INT(baudrate), MP_OBJ_NEW_QSTR(MP_QSTR_flow), MP_OBJ_NEW_SMALL_INT((1 | 2)), MP_OBJ_NEW_QSTR(MP_QSTR_timeout), MP_OBJ_NEW_SMALL_INT(1000), + MP_OBJ_NEW_QSTR(MP_QSTR_timeout_char), MP_OBJ_NEW_SMALL_INT(200), + MP_OBJ_NEW_QSTR(MP_QSTR_rxbuf), MP_OBJ_NEW_SMALL_INT(768), }; // This is a statically-allocated UART (see machine_uart.c), and doesn't // contain any heap pointers other than the ringbufs (which are already // root pointers), so no need to track this as a root pointer. - mp_bthci_uart = MP_OBJ_TYPE_GET_SLOT(&machine_uart_type, make_new)((mp_obj_t)&machine_uart_type, 2, 2, args); + mp_bthci_uart = MP_OBJ_TYPE_GET_SLOT(&machine_uart_type, make_new)((mp_obj_t)&machine_uart_type, 1, 5, args); // Start the HCI polling to process any initial events/packets. mp_bluetooth_hci_start_polling(); |
