feat: add config to disable ble hci uart flow control

This commit is contained in:
zhiweijian
2023-09-22 16:14:01 +08:00
parent 51ebdfcbfa
commit 5677692187
5 changed files with 31 additions and 2 deletions

View File

@@ -7,4 +7,10 @@ menu "Example Configuration"
help
UART Baudrate for HCI. Please use standard baudrate.
config EXAMPLE_HCI_UART_FLOW_CTRL_ENABLE
bool "Enable HCI UART flow control"
default y
help
Enable/disable HCI UART flow control
endmenu

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -29,6 +29,12 @@ static const char *tag = "UHCI";
#define GPIO_OUTPUT_PIN_SEL ((1ULL<<GPIO_UART_TXD_OUT) | (1ULL<<GPIO_UART_RTS_OUT))
#define GPIO_INPUT_PIN_SEL ((1ULL<<GPIO_UART_RXD_IN) | (1ULL<<GPIO_UART_CTS_IN))
#ifdef CONFIG_EXAMPLE_HCI_UART_FLOW_CTRL_ENABLE
#define HCI_UART_FLOW_CTRL_ENABLE CONFIG_EXAMPLE_HCI_UART_FLOW_CTRL_ENABLE
#else
#define HCI_UART_FLOW_CTRL_ENABLE FALSE
#endif
// Operation functions for HCI UART Transport Layer
static bool hci_uart_tl_init(void);
static void hci_uart_tl_deinit(void);
@@ -203,7 +209,11 @@ void uhci_uart_install(void)
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
#if (HCI_UART_FLOW_CTRL_ENABLE == TRUE)
.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS,
#else
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
#endif
.rx_flow_ctrl_thresh = UART_RX_THRS,
.source_clk = UART_SCLK_DEFAULT,
};
@@ -284,4 +294,5 @@ void app_main(void)
"--Baudrate: %d", UART_HCI_NUM,
GPIO_UART_TXD_OUT, GPIO_UART_RXD_IN, GPIO_UART_RTS_OUT, GPIO_UART_CTS_IN,
CONFIG_EXAMPLE_HCI_UART_BAUDRATE);
}