Espressif ESP32-S2 Programming Manual page 495

Table of Contents

Advertisement

Chapter 2. API Reference
Header File
components/tinyusb/additions/include/tusb_cdc_acm.h
Functions
esp_err_t
tusb_cdc_acm_init(const
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
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
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
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
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
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
Read a content to the array, and defines it's size to the sz_store.
Espressif Systems
tinyusb_config_cdcacm_t
event_type,
cacm_event_type_t
in_size)
itf, uint8_t *out_buf, size_t out_buf_sz, size_t
*rx_data_size)
484
Submit Document Feedback
*cfg)
itf,
cdcacm_event_type_t
tusb_cdcacm_callback_t
callback)
itf,
event_type)
itf, char ch)
itf, const uint8_t *in_buf, size_t
itf, uint32_t timeout_ticks)
cd-
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