I have got a full SAMD21 CDC app working fine, though I cannot seem to find a way to know when the CDC host port is closed. That is, it has enumerated as a comport, but data is not currently being read.
As soon as the com port has been enumerated and the port is closed:
udi_cdc_is_tx_ready() will always pass
UDI_CDC_RX_NOTIFY(port) function is called to let me know that it is now operational.
When I try to send data via udi_cdc_write_buf, it buffers it 6 times, on the 7th it has obviously run out of buffer space and sits inside the write function waiting for space to become available.
My question is, how do I know when there is no more space available to write to these functions?