From 62abafd5184816584c7edc17b1bf25c0eeeba989 Mon Sep 17 00:00:00 2001 From: Chen Wu Date: Tue, 30 Jan 2024 14:45:15 +0800 Subject: [PATCH] feat: Supported configurable uart commands --- components/at/CMakeLists.txt | 3 ++ components/at/src/at_uart_cmd.c | 2 +- main/interface/uart/Kconfig | 55 ++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/components/at/CMakeLists.txt b/components/at/CMakeLists.txt index 545e438c..e0810eee 100644 --- a/components/at/CMakeLists.txt +++ b/components/at/CMakeLists.txt @@ -11,6 +11,9 @@ list(APPEND srcs "src/at_default_config.c") list(APPEND srcs "src/at_init.c") list(APPEND srcs "src/at_workaround.c") list(APPEND srcs "src/at_cmd_register.c") +if (CONFIG_AT_UART_COMMAND_SUPPORT) + list(APPEND srcs "src/at_uart_cmd.c") +endif() if (CONFIG_BOOTLOADER_COMPRESSED_ENABLED) list(APPEND srcs "src/at_compress_ota.c") endif() diff --git a/components/at/src/at_uart_cmd.c b/components/at/src/at_uart_cmd.c index 7d881e91..bf4b5119 100644 --- a/components/at/src/at_uart_cmd.c +++ b/components/at/src/at_uart_cmd.c @@ -8,7 +8,7 @@ #include #include "sdkconfig.h" -#ifdef CONFIG_AT_BASE_ON_UART +#ifdef CONFIG_AT_UART_COMMAND_SUPPORT #include "driver/uart.h" #include "hal/uart_types.h" #include "freertos/FreeRTOS.h" diff --git a/main/interface/uart/Kconfig b/main/interface/uart/Kconfig index c12c5188..ce1b864b 100644 --- a/main/interface/uart/Kconfig +++ b/main/interface/uart/Kconfig @@ -2,33 +2,38 @@ config AT_BASE_ON_UART bool "AT through UART" if AT_BASE_ON_UART -menu "AT uart settings" -config AT_UART_DEFAULT_DATABITS - int "the uart data bits for AT port, the range is [5, 8]" - default 8 - range 5 8 - depends on AT_BASE_ON_UART + config AT_UART_COMMAND_SUPPORT + bool "Support UART AT commands" + default "y" -config AT_UART_DEFAULT_STOPBITS - int "the uart stop bit for AT port, the range is [1, 3]" - help - 1: 1-bit stop bit; 2: 1.5-bit stop bit; 3: 2-bit stop bit - default 1 - range 1 3 + menu "AT uart settings" + config AT_UART_DEFAULT_DATABITS + int "the uart data bits for AT port, the range is [5, 8]" + default 8 + range 5 8 + depends on AT_BASE_ON_UART -config AT_UART_DEFAULT_PARITY_BITS - int "the uart parity bit for AT port, the range is [0, 2]" - help - 0: None; 1: Odd; 2: Even - default 0 - range 0 2 + config AT_UART_DEFAULT_STOPBITS + int "the uart stop bit for AT port, the range is [1, 3]" + help + 1: 1-bit stop bit; 2: 1.5-bit stop bit; 3: 2-bit stop bit + default 1 + range 1 3 + + config AT_UART_DEFAULT_PARITY_BITS + int "the uart parity bit for AT port, the range is [0, 2]" + help + 0: None; 1: Odd; 2: Even + default 0 + range 0 2 + + config AT_UART_DEFAULT_FLOW_CONTROL + int "the uart flow control for AT port, the range is [0, 3]" + help + 0: flow control is disabled; 1: enable RTS; 2: enable CTS; 3: enable RTS and CTS + default 1 + range 0 3 + endmenu -config AT_UART_DEFAULT_FLOW_CONTROL - int "the uart flow control for AT port, the range is [0, 3]" - help - 0: flow control is disabled; 1: enable RTS; 2: enable CTS; 3: enable RTS and CTS - default 1 - range 0 3 -endmenu endif