Files
esp-protocols/esp_modem/include/esp_modem_config.h

115 lines
3.6 KiB
C
Raw Normal View History

2021-03-29 19:34:45 +02:00
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2021-03-08 15:10:15 +01:00
//
2021-03-29 19:34:45 +02:00
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
2021-03-08 15:10:15 +01:00
//
2021-03-29 19:34:45 +02:00
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2021-03-08 15:10:15 +01:00
2021-03-29 19:34:45 +02:00
#ifndef _ESP_MODEM_CONFIG_H_
#define _ESP_MODEM_CONFIG_H_
2021-03-08 15:10:15 +01:00
#include "driver/uart.h"
2021-03-28 13:38:20 +02:00
#include "esp_modem_dce_config.h"
2021-03-08 15:10:15 +01:00
2021-04-14 17:57:42 +02:00
/**
* @defgroup ESP_MODEM_CONFIG
* @brief Configuration structures for DTE and DCE
*/
/** @addtogroup ESP_MODEM_CONFIG
* @{
*/
2021-03-08 15:10:15 +01:00
/**
* @brief Modem flow control type
*
*/
typedef enum {
ESP_MODEM_FLOW_CONTROL_NONE = 0,
ESP_MODEM_FLOW_CONTROL_SW,
ESP_MODEM_FLOW_CONTROL_HW
} esp_modem_flow_ctrl_t;
2021-04-14 17:57:42 +02:00
/**
* @brief DTE configuration structure
*
*/
2021-04-18 19:14:22 +02:00
struct esp_modem_uart_term_config {
2021-03-08 15:10:15 +01:00
uart_port_t port_num; /*!< UART port number */
uart_word_length_t data_bits; /*!< Data bits of UART */
uart_stop_bits_t stop_bits; /*!< Stop bits of UART */
uart_parity_t parity; /*!< Parity type */
esp_modem_flow_ctrl_t flow_control; /*!< Flow control type */
int baud_rate; /*!< Communication baud rate */
int tx_io_num; /*!< TXD Pin Number */
int rx_io_num; /*!< RXD Pin Number */
int rts_io_num; /*!< RTS Pin Number */
int cts_io_num; /*!< CTS Pin Number */
int rx_buffer_size; /*!< UART RX Buffer Size */
int tx_buffer_size; /*!< UART TX Buffer Size */
int event_queue_size; /*!< UART Event Queue Size */
uint32_t event_task_stack_size; /*!< UART Event Task Stack size */
int event_task_priority; /*!< UART Event Task Priority */
};
struct esp_modem_vfs_term_config {
int port_num;
const char* dev_name;
int rx_buffer_size;
int tx_buffer_size;
int baud_rate;
int tx_io_num;
int rx_io_num;
uint32_t task_stack_size;
int task_prio;
};
2021-04-18 19:14:22 +02:00
struct esp_modem_dte_config {
size_t dte_buffer_size;
union {
struct esp_modem_uart_term_config uart_config;
struct esp_modem_vfs_term_config vfs_config;
};
2021-04-18 19:14:22 +02:00
};
2021-03-08 15:10:15 +01:00
/**
* @brief ESP Modem DTE Default Configuration
*
*/
2021-04-18 19:14:22 +02:00
#define ESP_MODEM_DTE_DEFAULT_CONFIG() \
{ \
.dte_buffer_size = 512, \
.uart_config = { \
.port_num = UART_NUM_1, \
.data_bits = UART_DATA_8_BITS, \
.stop_bits = UART_STOP_BITS_1, \
.parity = UART_PARITY_DISABLE, \
.flow_control = ESP_MODEM_FLOW_CONTROL_NONE,\
.baud_rate = 115200, \
.tx_io_num = 25, \
.rx_io_num = 26, \
.rts_io_num = 27, \
.cts_io_num = 23, \
.rx_buffer_size = 4096, \
2021-04-18 19:14:22 +02:00
.tx_buffer_size = 512, \
.event_queue_size = 30, \
.event_task_stack_size = 4096, \
.event_task_priority = 20, \
2021-04-18 19:14:22 +02:00
} \
2021-03-08 15:10:15 +01:00
}
typedef struct esp_modem_dte_config esp_modem_dte_config_t;
2021-04-14 17:57:42 +02:00
/**
* @}
*/
2021-03-29 19:34:45 +02:00
#endif // _ESP_MODEM_CONFIG_H_