ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
tusb_console.h File Reference
#include "esp_err.h"
Include dependency graph for tusb_console.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

esp_err_t esp_tusb_init_console (int cdc_intf)
 Redirect output to the USB serial.
esp_err_t esp_tusb_deinit_console (int cdc_intf)
 Switch log to the default output.

Function Documentation

◆ esp_tusb_deinit_console()

esp_err_t esp_tusb_deinit_console ( int cdc_intf)

Switch log to the default output.

Parameters
cdc_intf- interface number of TinyUSB's CDC
Returns
esp_err_t

Definition at line 110 of file tusb_console.c.

111{
112 ESP_RETURN_ON_ERROR(restore_std_streams(&con.in, &con.out, &con.err), TAG, "Failed to restore STD streams");
114 return ESP_OK;
115}
#define ESP_RETURN_ON_ERROR(x, log_tag, format,...)
#define ESP_OK
Definition esp_err.h:23
static const char * TAG
Definition main/main.c:31
static console_handle_t con
static esp_err_t restore_std_streams(FILE **f_in, FILE **f_out, FILE **f_err)
Restore output to default.
esp_err_t esp_vfs_tusb_cdc_unregister(char const *path)
Unregister TinyUSB CDC from VFS.

References con, ESP_OK, ESP_RETURN_ON_ERROR, esp_vfs_tusb_cdc_unregister(), restore_std_streams(), and TAG.

Here is the call graph for this function:

◆ esp_tusb_init_console()

esp_err_t esp_tusb_init_console ( int cdc_intf)

Redirect output to the USB serial.

Parameters
cdc_intf- interface number of TinyUSB's CDC
Returns
esp_err_t - ESP_OK, ESP_FAIL or an error code

Definition at line 102 of file tusb_console.c.

103{
104 /* Registering TUSB at VFS */
106 ESP_RETURN_ON_ERROR(redirect_std_streams_to(&con.in, &con.out, &con.err, VFS_TUSB_PATH_DEFAULT), TAG, "Failed to redirect STD streams");
107 return ESP_OK;
108}
static esp_err_t redirect_std_streams_to(FILE **f_in, FILE **f_out, FILE **f_err, const char *path)
Reopen standard streams using a new path.
#define VFS_TUSB_PATH_DEFAULT
Definition vfs_tinyusb.h:16
esp_err_t esp_vfs_tusb_cdc_register(int cdc_intf, char const *path)
Register TinyUSB CDC at VFS with path.

References con, ESP_OK, ESP_RETURN_ON_ERROR, esp_vfs_tusb_cdc_register(), redirect_std_streams_to(), TAG, and VFS_TUSB_PATH_DEFAULT.

Here is the call graph for this function: