Files
snapclient/components/protocol_examples_common/stdin_out.c
Carlos 7b24787e73 - major change, use lwip netconn instead of socket API to reduce RAM footprint
o flac works, opus and pcm are untested and not working
- improve on resyncing issues
- add wifi logger component submodule
- optimize stack sizes
2021-10-16 22:07:37 +02:00

33 lines
1.2 KiB
C

/* Common functions for protocol examples, to configure stdin and stdout.
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "driver/uart.h"
#include "esp_err.h"
#include "esp_vfs_dev.h"
#include "protocol_examples_common.h"
#include "sdkconfig.h"
esp_err_t
example_configure_stdin_stdout (void)
{
// Initialize VFS & UART so we can use std::cout/cin
setvbuf (stdin, NULL, _IONBF, 0);
/* Install UART driver for interrupt-driven reads and writes */
ESP_ERROR_CHECK (uart_driver_install (
(uart_port_t)CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0));
/* Tell VFS to use UART driver */
esp_vfs_dev_uart_use_driver (CONFIG_ESP_CONSOLE_UART_NUM);
esp_vfs_dev_uart_port_set_rx_line_endings (CONFIG_ESP_CONSOLE_UART_NUM,
ESP_LINE_ENDINGS_CR);
/* Move the caret to the beginning of the next line on '\n' */
esp_vfs_dev_uart_port_set_tx_line_endings (CONFIG_ESP_CONSOLE_UART_NUM,
ESP_LINE_ENDINGS_CRLF);
return ESP_OK;
}