EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #495 background imageLoading...
Page #495 background image
Chapter 2. API Reference
Header File
components/tinyusb/additions/include/tusb_cdc_acm.h
Functions
esp_err_t tusb_cdc_acm_init(const tinyusb_config_cdcacm_t *cfg)
Initialize CDC ACM. Initialization will be finished with the tud_cdc_line_state_cb callback.
Return esp_err_t
Parameters
cfg: - init configuration structure
esp_err_t tinyusb_cdcacm_register_callback(tinyusb_cdcacm_itf_t itf, cdcacm_event_type_t
event_type, tusb_cdcacm_callback_t callback)
Register a callback invoking on CDC event. If the callback had been already registered, it will be overwritten.
Return esp_err_t - ESP_OK or ESP_ERR_INVALID_ARG
Parameters
itf: - number of a CDC object
event_type: - type of registered event for a callback
callback: - callback function
esp_err_t tinyusb_cdcacm_unregister_callback(tinyusb_cdcacm_itf_t itf, cd-
cacm_event_type_t event_type)
Unregister a callback invoking on CDC event.
Return esp_err_t - ESP_OK or ESP_ERR_INVALID_ARG
Parameters
itf: - number of a CDC object
event_type: - type of registered event for a callback
size_t tinyusb_cdcacm_write_queue_char(tinyusb_cdcacm_itf_t itf, char ch)
Sent one character to a write buffer.
Return size_t - amount of queued bytes
Parameters
itf: - number of a CDC object
ch: - character to send
size_t tinyusb_cdcacm_write_queue(tinyusb_cdcacm_itf_t itf, const uint8_t *in_buf, size_t
in_size)
Write data to write buffer from a byte array.
Return size_t - amount of queued bytes
Parameters
itf: - number of a CDC object
in_buf: - a source array
in_size: - size to write from arr_src
esp_err_t tinyusb_cdcacm_write_flush(tinyusb_cdcacm_itf_t itf, uint32_t timeout_ticks)
Send all data from a write buffer. Use tinyusb_cdcacm_write_queue to add data to the buffer.
WARNING! TinyUSB can block output Endpoint for several RX callbacks, after will do additional flush af-
ter the each trasfer. That can leads to the situation when you requested a flush, but it will fail until ont of
the next callbacks ends. SO USING OF THE FLUSH WITH TIMEOUTS IN CALLBACKS IS NOT RE-
COMENDED - YOU CAN GET A LOCK FOR THE TIMEOUT
Return esp_err_t - ESP_OK if (timeout_ticks > 0) and and flush was successful, ESP_ERR_TIMEOUT if
timeout occurred3 or flush was successful with (timeout_ticks == 0) ESP_FAIL if flush was unsuccessful
Parameters
itf: - number of a CDC object
timeout_ticks: - waiting until flush will be considered as failed
esp_err_t tinyusb_cdcacm_read(tinyusb_cdcacm_itf_t itf, uint8_t *out_buf, size_t out_buf_sz, size_t
*rx_data_size)
Read a content to the array, and defines its size to the sz_store.
Espressif Systems 484
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish