Espressif ESP32-S2 Programming Manual page 493

Table of Contents

Advertisement

Chapter 2. API Reference
• Name of CDC device if it is On
• Serial number
If you want to use own descriptors with extended modification, you can define them during the driver installation
process
Install Driver
To initialize the driver, users should call tinyusb_driver_install(). The driver' s configuration is specified
in a
tinyusb_config_t
Note that the
tinyusb_config_t
tusb_cfg = { 0 }) or partially (as shown below). For any member that is initialized to 0 or NULL,
the driver will use its default configuration values for that member (see example below)
tinyusb_config_t partial_init
.descriptor
=
NULL;
.string_descriptor
.external_phy
=
}
USB Serial Device (CDC-ACM)
If the CDC option is enabled in Menuconfig, the USB Serial Device could be initialized with
tusb_cdc_acm_init()
below).
tinyusb_config_cdcacm_t amc_cfg
.usb_dev
=
TINYUSB_USBDEV_0,
.cdc_port
=
TINYUSB_CDC_ACM_0,
.rx_unread_buf_sz
.callback_rx
=
NULL,
.callback_rx_wanted_char
.callback_line_state_changed
.callback_line_coding_changed
};
tusb_cdc_acm_init(&amc_cfg);
To specify callbacks you can either set the pointer to your
ration structure or call
tinyusb_cdcacm_register_callback()
USB Serial Console
The driver allows to redirect all standard application strings (stdin/out/err) to the USB Serial
Device and return them to UART using
functions.
Application Examples
The table below describes the code examples available in the directory peripherals/usb/.
Code Example
peripherals/usb/tusb_console
peripherals/usb/tusb_sample_descriptor
peripherals/usb/tusb_serial_device
Espressif Systems
structure that is passed as an argument to tinyusb_driver_install().
structure can be zero initialized (e.g. tinyusb_config_t
=
{
//Uses default descriptor specified in Menuconfig
=
NULL;
//Uses default string specified in Menuconfig
false;
according to the settings from
=
{
=
64,
=
NULL,
=
NULL,
=
NULL
esp_tusb_init_console()/esp_tusb_deinit_console()
Description
How to set up ESP32-S2 chip to get log output via Serial Device connec-
tion
How to set up ESP32-S2 chip to work as a Generic USB Device with a
user-defined descriptor
How to set up ESP32-S2 chip to work as a USB Serial Device
Submit Document Feedback
tinyusb_config_cdcacm_t
tusb_cdcacm_callback_t
after initialization.
482
(see example
function in the configu-
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF