Reputation: 11
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:
callback_rx
just constantly triggers the function, it seemscallback_rx_wanted_char
I think triggers the event when it gets a wanted char (not sure from where)callback_line_state_changed
is when I stop quite understanding at all, because the event that triggers this is a line state change, and I'm unsure what that is or how to triggercallback_line_coding_changed
has me completely lostI 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
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