mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-25 08:17:28 +02:00
fix(esp_modem): Console example to use configurable flow-ctrl
This commit is contained in:
@ -101,6 +101,20 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Pin to unlock the SIM
|
Pin to unlock the SIM
|
||||||
|
|
||||||
|
choice EXAMPLE_FLOW_CONTROL
|
||||||
|
bool "Set preferred modem control flow"
|
||||||
|
default EXAMPLE_FLOW_CONTROL_NONE
|
||||||
|
help
|
||||||
|
Set the modem's preferred control flow
|
||||||
|
|
||||||
|
config EXAMPLE_FLOW_CONTROL_NONE
|
||||||
|
bool "No control flow"
|
||||||
|
config EXAMPLE_FLOW_CONTROL_SW
|
||||||
|
bool "SW control flow"
|
||||||
|
config EXAMPLE_FLOW_CONTROL_HW
|
||||||
|
bool "HW control flow"
|
||||||
|
endchoice
|
||||||
|
|
||||||
menu "UART Configuration"
|
menu "UART Configuration"
|
||||||
config EXAMPLE_MODEM_UART_TX_PIN
|
config EXAMPLE_MODEM_UART_TX_PIN
|
||||||
int "TXD Pin Number"
|
int "TXD Pin Number"
|
||||||
|
@ -26,6 +26,14 @@
|
|||||||
#include "console_helper.hpp"
|
#include "console_helper.hpp"
|
||||||
#include "my_module_dce.hpp"
|
#include "my_module_dce.hpp"
|
||||||
|
|
||||||
|
#if defined(CONFIG_EXAMPLE_FLOW_CONTROL_NONE)
|
||||||
|
#define EXAMPLE_FLOW_CONTROL ESP_MODEM_FLOW_CONTROL_NONE
|
||||||
|
#elif defined(CONFIG_EXAMPLE_FLOW_CONTROL_SW)
|
||||||
|
#define EXAMPLE_FLOW_CONTROL ESP_MODEM_FLOW_CONTROL_SW
|
||||||
|
#elif defined(CONFIG_EXAMPLE_FLOW_CONTROL_HW)
|
||||||
|
#define EXAMPLE_FLOW_CONTROL ESP_MODEM_FLOW_CONTROL_HW
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CHECK_ERR(cmd, success_action) do { \
|
#define CHECK_ERR(cmd, success_action) do { \
|
||||||
auto err = cmd; \
|
auto err = cmd; \
|
||||||
if (err == command_result::OK) { \
|
if (err == command_result::OK) { \
|
||||||
@ -69,7 +77,7 @@ extern "C" void app_main(void)
|
|||||||
dte_config.uart_config.rx_io_num = CONFIG_EXAMPLE_MODEM_UART_RX_PIN;
|
dte_config.uart_config.rx_io_num = CONFIG_EXAMPLE_MODEM_UART_RX_PIN;
|
||||||
dte_config.uart_config.rts_io_num = CONFIG_EXAMPLE_MODEM_UART_RTS_PIN;
|
dte_config.uart_config.rts_io_num = CONFIG_EXAMPLE_MODEM_UART_RTS_PIN;
|
||||||
dte_config.uart_config.cts_io_num = CONFIG_EXAMPLE_MODEM_UART_CTS_PIN;
|
dte_config.uart_config.cts_io_num = CONFIG_EXAMPLE_MODEM_UART_CTS_PIN;
|
||||||
dte_config.uart_config.flow_control = ESP_MODEM_FLOW_CONTROL_HW;
|
dte_config.uart_config.flow_control = EXAMPLE_FLOW_CONTROL;
|
||||||
dte_config.uart_config.rx_buffer_size = CONFIG_EXAMPLE_MODEM_UART_RX_BUFFER_SIZE;
|
dte_config.uart_config.rx_buffer_size = CONFIG_EXAMPLE_MODEM_UART_RX_BUFFER_SIZE;
|
||||||
dte_config.uart_config.tx_buffer_size = CONFIG_EXAMPLE_MODEM_UART_TX_BUFFER_SIZE;
|
dte_config.uart_config.tx_buffer_size = CONFIG_EXAMPLE_MODEM_UART_TX_BUFFER_SIZE;
|
||||||
dte_config.uart_config.event_queue_size = CONFIG_EXAMPLE_MODEM_UART_EVENT_QUEUE_SIZE;
|
dte_config.uart_config.event_queue_size = CONFIG_EXAMPLE_MODEM_UART_EVENT_QUEUE_SIZE;
|
||||||
|
Reference in New Issue
Block a user