I'm using the communication framework on USBX, I've noticed that the read function ( that is SF_EL_UX_COMMS_Read) is blocking and wait for the given number of bytes to be read before returning.
I was wondering if there is a way to know in advance how many bytes are available in the RX buffer before calling this. Or eventually having a callback so that I know when there are some new bytes available on the RX buffer.
Is that possible?
In reply to garyj:
In reply to davide_hanhaa:
In reply to Richard:
Hello,Further to my post yesterday please find attached an example that shows USB CDC data read / write in a non blocking single thread application.
Please note that this does not use the comms framework. It operates one level down via the USBX Device Class CDC-ACM stack.
Additionally, its uses the function:
with two callback functions for handling data write and data read.
The use of the callbacks allow for non-blocking functionality.
In this example any data received is double buffered and the address of the active buffer is posted to a queue.
Any data sent to the queue is echoed back to the host
Hope this is of interest.