From a26455d1202806f5ccecc41d90ea85117d296833 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Mon, 22 Aug 2022 16:09:40 +0800 Subject: [PATCH] openthread: add a configuration for selecting RCP UART TX_RX --- .../openthread/ot_rcp/main/Kconfig.projbuild | 21 +++++++++++++++++++ .../openthread/ot_rcp/main/esp_ot_config.h | 12 +++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 examples/openthread/ot_rcp/main/Kconfig.projbuild diff --git a/examples/openthread/ot_rcp/main/Kconfig.projbuild b/examples/openthread/ot_rcp/main/Kconfig.projbuild new file mode 100644 index 0000000000..3bff9f0920 --- /dev/null +++ b/examples/openthread/ot_rcp/main/Kconfig.projbuild @@ -0,0 +1,21 @@ +menu "OpenThread RCP Example" + + config OPENTHREAD_UART_PIN_MANUAL + bool "Configure RCP UART pin manually" + default n + help + Select this to choose UART pin manually + + config OPENTHREAD_UART_RX_PIN + int "The number of RX pin" + depends on OPENTHREAD_UART_PIN_MANUAL + default 4 + range 0 25 + + config OPENTHREAD_UART_TX_PIN + int "The number of TX pin" + depends on OPENTHREAD_UART_PIN_MANUAL + default 5 + range 0 25 + +endmenu diff --git a/examples/openthread/ot_rcp/main/esp_ot_config.h b/examples/openthread/ot_rcp/main/esp_ot_config.h index 3006f4aa40..a54e23c0cf 100644 --- a/examples/openthread/ot_rcp/main/esp_ot_config.h +++ b/examples/openthread/ot_rcp/main/esp_ot_config.h @@ -20,6 +20,14 @@ .radio_mode = RADIO_MODE_NATIVE, \ } +#if CONFIG_OPENTHREAD_UART_PIN_MANUAL +#define OPENTHREAD_RCP_UART_RX_PIN CONFIG_OPENTHREAD_UART_RX_PIN +#define OPENTHREAD_RCP_UART_TX_PIN CONFIG_OPENTHREAD_UART_TX_PIN +#else +#define OPENTHREAD_RCP_UART_RX_PIN UART_PIN_NO_CHANGE +#define OPENTHREAD_RCP_UART_TX_PIN UART_PIN_NO_CHANGE +#endif + #define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \ { \ .host_connection_mode = HOST_CONNECTION_MODE_RCP_UART, \ @@ -35,8 +43,8 @@ .rx_flow_ctrl_thresh = 0, \ .source_clk = UART_SCLK_DEFAULT, \ }, \ - .rx_pin = UART_PIN_NO_CHANGE, \ - .tx_pin = UART_PIN_NO_CHANGE, \ + .rx_pin = OPENTHREAD_RCP_UART_RX_PIN, \ + .tx_pin = OPENTHREAD_RCP_UART_TX_PIN, \ }, \ }