Fern Mendiz
Fern Mendiz

Reputation: 11

ESP USB callback function functionality and event triggers

I was writing some code to interface with an ESP32s3 using the integrated USB ports, and I was playing around with the different callback function types in the tinyusb_config_cdcacm_t acm_cfg struct, but as I was looking through the code, I quickly realized that the main difference between the four is the event that triggers the callback function:

I was just wondering if anybody could help provide insight as to how to trigger these events (and, more importantly, how to set the wanted char for the callback_rx_wanted_char) so I can check which one works better for my needs.

there really aren't many results in Google at all about this, the API Reference sheet just mentions these things exist but doesn't explain them, and the code itself is also not very clear, so I've been left to ask a question here.

Upvotes: 0

Views: 307

Answers (1)

chrslg
chrslg

Reputation: 13316

RX is when you receive something. It is how to react to incoming data.

char_wanted means that the other end is ready to read some char from you (you won't wait if you try to write a char)

line state is whether the usb device is plugged or not, connected, etc. So this is, for example, how you can detect that line was unplugged (in the associated call back)

line coding are the parameters of the serial line. Speed, parity, number of bits, etc. So, I speculate here, but I take that this callback reacts to the fact that, for some reason, the parameters of the line changed.

Upvotes: 0

Related Questions