For UART we have uart_write_bytes(), uart_read_bytes()/...
Question#1:
Do we have something simple for USB-CDC?
I have found these:
Code: Select all
ssize_t esp_usb_console_write_buf(const char* buf, size_t size);
ssize_t esp_usb_console_flush(void);
ssize_t esp_usb_console_read_buf(char* buf, size_t buf_size);
bool esp_usb_console_read_available(void);
bool esp_usb_console_write_available(void);
Question#2:
Why it is not recommended to use these functions?
My problem is that I have code, which has command line interface. Depending on the configuration it should be deployed either on UART0 or on USB (hardware CDC). For the uart it is simple (uart_write_bytes), however, for the USB I can't find simple write/read/available functions.
Comment in the code above also says that users are advised to use VFS to access USB, but I am not sure how to do that plus, I am not sure if ESP-IDF is compiled with VFS support (I use Arduino framework which is shipped with ESP-IDF precompiled)