mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-24 18:46:33 +08:00
feature(uart_driver_install): To fit some modules, add invalid parameters in uart_driver_install
This commit is contained in:
@ -917,7 +917,7 @@ esp_err_t uart_flush_input(uart_port_t uart_num)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_buffer_size, int queue_size, QueueHandle_t *uart_queue)
|
esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_buffer_size, int queue_size, QueueHandle_t *uart_queue, int no_use)
|
||||||
{
|
{
|
||||||
esp_err_t r;
|
esp_err_t r;
|
||||||
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG);
|
||||||
|
@ -422,12 +422,13 @@ esp_err_t uart_intr_config(uart_port_t uart_num, uart_intr_config_t *uart_intr_c
|
|||||||
* @param queue_size UART event queue size/depth.
|
* @param queue_size UART event queue size/depth.
|
||||||
* @param uart_queue UART event queue handle (out param). On success, a new queue handle is written here to provide
|
* @param uart_queue UART event queue handle (out param). On success, a new queue handle is written here to provide
|
||||||
* access to UART events. If set to NULL, driver will not use an event queue.
|
* access to UART events. If set to NULL, driver will not use an event queue.
|
||||||
|
* @param no_use Invalid parameters, just to fit some modules.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_ERR_INVALID_ARG Parameter error
|
* - ESP_ERR_INVALID_ARG Parameter error
|
||||||
*/
|
*/
|
||||||
esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_buffer_size, int queue_size, QueueHandle_t *uart_queue);
|
esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_buffer_size, int queue_size, QueueHandle_t *uart_queue, int no_use);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Uninstall UART driver.
|
* @brief Uninstall UART driver.
|
||||||
|
@ -46,7 +46,7 @@ static void echo_task()
|
|||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
|
||||||
};
|
};
|
||||||
uart_param_config(UART_NUM_0, &uart_config);
|
uart_param_config(UART_NUM_0, &uart_config);
|
||||||
uart_driver_install(UART_NUM_0, BUF_SIZE * 2, 0, 0, NULL);
|
uart_driver_install(UART_NUM_0, BUF_SIZE * 2, 0, 0, NULL, 0);
|
||||||
|
|
||||||
// Configure a temporary buffer for the incoming data
|
// Configure a temporary buffer for the incoming data
|
||||||
uint8_t *data = (uint8_t *) malloc(BUF_SIZE);
|
uint8_t *data = (uint8_t *) malloc(BUF_SIZE);
|
||||||
|
@ -120,7 +120,7 @@ void app_main()
|
|||||||
uart_param_config(EX_UART_NUM, &uart_config);
|
uart_param_config(EX_UART_NUM, &uart_config);
|
||||||
|
|
||||||
// Install UART driver, and get the queue.
|
// Install UART driver, and get the queue.
|
||||||
uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 100, &uart0_queue);
|
uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 100, &uart0_queue, 0);
|
||||||
|
|
||||||
// Create a task to handler UART event from ISR
|
// Create a task to handler UART event from ISR
|
||||||
xTaskCreate(uart_event_task, "uart_event_task", 2048, NULL, 12, NULL);
|
xTaskCreate(uart_event_task, "uart_event_task", 2048, NULL, 12, NULL);
|
||||||
|
@ -30,7 +30,7 @@ static void uart_select_task()
|
|||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
|
||||||
};
|
};
|
||||||
uart_param_config(UART_NUM_0, &uart_config);
|
uart_param_config(UART_NUM_0, &uart_config);
|
||||||
uart_driver_install(UART_NUM_0, 2*1024, 0, 0, NULL);
|
uart_driver_install(UART_NUM_0, 2*1024, 0, 0, NULL, 0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -56,7 +56,7 @@ static void initialize_console()
|
|||||||
|
|
||||||
/* Install UART driver for interrupt-driven reads and writes */
|
/* Install UART driver for interrupt-driven reads and writes */
|
||||||
ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
||||||
256, 0, 0, NULL) );
|
256, 0, 0, NULL, 0) );
|
||||||
|
|
||||||
/* Tell VFS to use UART driver */
|
/* Tell VFS to use UART driver */
|
||||||
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
||||||
|
@ -52,7 +52,7 @@ static void initialize_console()
|
|||||||
|
|
||||||
/* Install UART driver for interrupt-driven reads and writes */
|
/* Install UART driver for interrupt-driven reads and writes */
|
||||||
ESP_ERROR_CHECK(uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
ESP_ERROR_CHECK(uart_driver_install(CONFIG_CONSOLE_UART_NUM,
|
||||||
256, 0, 0, NULL));
|
256, 0, 0, NULL, 0));
|
||||||
|
|
||||||
/* Tell VFS to use UART driver */
|
/* Tell VFS to use UART driver */
|
||||||
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM);
|
||||||
|
Reference in New Issue
Block a user