Skip to content

Commit

Permalink
ESP32 support chip shell for custom UART which can be set in sdkconfig (
Browse files Browse the repository at this point in the history
#25135)

* CHG: Support chip shell for custom UART which can be set in sdkconfig file (CONFIG_ESP_CONSOLE_UART_CUSTOM)

* ESP32 add chip_cli task for custom uart (CONFIG_ESP_CONSOLE_UART_CUSTOM)

* Wrong used preoprocessor define
  • Loading branch information
benjaminnestler authored and pull[bot] committed Aug 8, 2023
1 parent c2a2060 commit 5485407
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/platform/esp32/shell_extension/launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void LaunchShell()
#if CONFIG_HEAP_TRACING_STANDALONE || CONFIG_HEAP_TASK_TRACKING
idf::chip::RegisterHeapTraceCommands();
#endif // CONFIG_HEAP_TRACING_STANDALONE || CONFIG_HEAP_TASK_TRACKING
#if CONFIG_ESP_CONSOLE_UART_DEFAULT
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
xTaskCreate(&MatterShellTask, "chip_cli", 2048, NULL, 5, NULL);
#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
// Increase task stack size when using usb serial jtag
Expand Down
10 changes: 5 additions & 5 deletions src/lib/shell/streamer_esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <lib/core/CHIPError.h>
#include <stdio.h>
#include <string.h>
#if CONFIG_ESP_CONSOLE_UART_DEFAULT
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
#include "driver/uart.h"
#endif
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
Expand Down Expand Up @@ -55,15 +55,15 @@ int streamer_esp32_init(streamer_t * streamer)
fflush(stdout);
fsync(fileno(stdout));
setvbuf(stdin, NULL, _IONBF, 0);
#if CONFIG_ESP_CONSOLE_UART_DEFAULT
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
esp_vfs_dev_uart_port_set_rx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CR);
esp_vfs_dev_uart_port_set_tx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CRLF);
if (!uart_is_driver_installed(CONFIG_ESP_CONSOLE_UART_NUM))
{
ESP_ERROR_CHECK(uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0));
}
uart_config_t uart_config = {
.baud_rate = 115200,
.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
Expand All @@ -77,7 +77,7 @@ int streamer_esp32_init(streamer_t * streamer)
};
ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config));
esp_vfs_dev_uart_use_driver(0);
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM

#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
Expand Down Expand Up @@ -121,7 +121,7 @@ ssize_t streamer_esp32_read(streamer_t * streamer, char * buf, size_t len)

ssize_t streamer_esp32_write(streamer_t * streamer, const char * buf, size_t len)
{
#if CONFIG_ESP_CONSOLE_UART_DEFAULT
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
return uart_write_bytes(CONFIG_ESP_CONSOLE_UART_NUM, buf, len);
#endif
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
Expand Down

0 comments on commit 5485407

Please sign in to comment.