vfs: support vfs uart set line endings with specified uart number (release/v4.0)

This commit is contained in:
houwenxiang
2020-06-09 17:00:47 +08:00
committed by kooho
parent 0dc46879c5
commit d9660fcf9c
14 changed files with 81 additions and 23 deletions

View File

@@ -972,6 +972,26 @@ void esp_vfs_dev_uart_register()
ESP_ERROR_CHECK(esp_vfs_register("/dev/uart", &vfs, NULL));
}
int esp_vfs_dev_uart_port_set_rx_line_endings(int uart_num, esp_line_endings_t mode)
{
if (uart_num < 0 || uart_num >= UART_NUM) {
errno = EBADF;
return -1;
}
s_ctx[uart_num]->rx_mode = mode;
return 0;
}
int esp_vfs_dev_uart_port_set_tx_line_endings(int uart_num, esp_line_endings_t mode)
{
if (uart_num < 0 || uart_num >= UART_NUM) {
errno = EBADF;
return -1;
}
s_ctx[uart_num]->tx_mode = mode;
return 0;
}
void esp_vfs_dev_uart_set_rx_line_endings(esp_line_endings_t mode)
{
for (int i = 0; i < UART_NUM; ++i) {