Hello Myke.
Based on Reference Manual USB Stack Host, there are two macros for this
• #define USB_HOST_CDC_CONTROL_LINE_STATE_DTR 0x01U
CDC class-specific request (SET_CONTROL_LINE_STATE) bitmap.
• #define USB_HOST_CDC_CONTROL_LINE_STATE_RTS 0x02U
CDC class-specific request (SET_CONTROL_LINE_STATE) bitmap.
to set the virtual handshaking signals, call USB_HostCdcSetAcmCtrlState() (see bellow) which is snippet from usb_host_cdc.c
usb_status_t USB_HostCdcSetAcmCtrlState(
usb_host_class_handle classHandle, uint8_t dtr, uint8_t rts, transfer_callback_t callbackFn, void *callbackParam)
{
uint16_t lineState = 0;
usb_host_cdc_instance_struct_t *cdcInstance = (usb_host_cdc_instance_struct_t *)classHandle;
lineState = dtr ? USB_HOST_CDC_CONTROL_LINE_STATE_DTR : 0;
lineState |= rts ? USB_HOST_CDC_CONTROL_LINE_STATE_RTS : 0;
return USB_HostCdcControl(
cdcInstance, USB_REQUEST_TYPE_DIR_OUT | USB_REQUEST_TYPE_TYPE_CLASS | USB_REQUEST_TYPE_RECIPIENT_INTERFACE,
USB_HOST_CDC_SET_CONTROL_LINE_STATE, USB_SHORT_GET_LOW(lineState), USB_SHORT_GET_HIGH(lineState), 0, NULL,
callbackFn, callbackParam);
}
To read the virtual handshaking signals, you can check the state->bmstate in USB_HostCdcInterruptPipeCallback() in usb_host_cdc.c.
void USB_HostCdcInterruptPipeCallback(void *param, usb_host_transfer_t *transfer, usb_status_t status)
{
usb_host_cdc_instance_struct_t *cdcInstance = (usb_host_cdc_instance_struct_t *)param;
USB_HostFreeTransfer(cdcInstance->hostHandle, transfer);
if (cdcInstance->interruptCallbackFn != NULL)
{
cdcInstance->interruptCallbackFn(cdcInstance->interruptCallbackParam, transfer->transferBuffer,
transfer->transferSofar, status);
}
}
This callback serves for an interrupt pipe so that it would be invoked periodically. As long as the device side had sent the handshaking signals through the interrupt pipe, the host side should read the incoming signals.
I hope this helps.
In case of any question, please let me know.
Best Regards,
Iva