Preview:
/*

On file: usbd_cdc_if.c 
*/

 typedef enum {
     isOpen,
     isClosed
 }
 VcpStatus;


 case CDC_SET_CONTROL_LINE_STATE:
    {
        USBD_SetupReqTypedef * req = (USBD_SetupReqTypedef *)pbuf;


        if(req->wValue &0x0001 != 0)
        {
            vcp_status = isOpen;
        }
        else
            vcp_status = isClosed;

        break;
    }
/*
Now it is possible to know if the "VCP connection" is open or not.
Make variable global or implement get method
*/
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter