<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Modifying USB CDC example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41434/modifying-usb-cdc-example</link><description>Hi there, 
 
 I am trying to modify the USB CDC ACM example to work as a USB CCID. Right now the main issue that I&amp;#39;m facing is macros on top of macros. 
 It&amp;#39;s perfectly understandable that it&amp;#39;s easy and straightforward to have macros that you can use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Oct 2019 11:43:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41434/modifying-usb-cdc-example" /><item><title>RE: Modifying USB CDC example</title><link>https://devzone.nordicsemi.com/thread/215275?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2019 11:43:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a708337-c1a6-4b5a-8b5a-fdee9d2ef341</guid><dc:creator>Mohammad</dc:creator><description>&lt;p&gt;Hi Calculon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Is there any update in USB CCID class implementation. Have you completed it?&lt;/p&gt;
&lt;p&gt;Pls let me know that.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modifying USB CDC example</title><link>https://devzone.nordicsemi.com/thread/161256?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 15:19:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ffdaea8-33b0-4c82-91be-79bfe96b2d8a</guid><dc:creator>Calculon</dc:creator><description>&lt;p&gt;Okay, coming back to answer my own question.&lt;/p&gt;
&lt;p&gt;If&amp;nbsp;you add -H parameter to Optimization flags like&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Optimization flags
OPT = -O3 -g3 -H&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then recompile the code.&amp;nbsp;You will get a failure during linking, but then you can go to `_build` folder and open main.c.o file with your text editor and it will contain C code with all macros and definitions evaluated and expanded.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In case anyone is interested what does m_app_cdc_acm look like after evaluating macro, here it is;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint8_t m_app_ccid_ep =  { ((((NRF_DRV_USBD_EPIN2) &amp;gt;&amp;gt; 16) &amp;amp; 0x01) ? (((NRF_DRV_USBD_EPIN2) &amp;amp; 0xFF00) &amp;gt;&amp;gt; 8) : 0x10) };
static app_usbd_cdc_acm_data_t m_app_ccid_data; 
const app_usbd_cdc_acm_t m_app_ccid = 
{ 
    .specific = 
    { 
        .p_data = &amp;amp;m_app_ccid_data, 
        .p_class_methods = &amp;amp;app_usbd_cdc_acm_class_methods, 
        .iface = 
        { 
            .cnt = 2, 
            .config = 
            { 
                { 
                    .number = 0, 
                    .ep_cnt = 1, 
                    .ep_offset = (0 ) * sizeof(app_usbd_class_ep_conf_t) + ((2 - 0) * sizeof(app_usbd_class_iface_conf_t)) 
                }, 
                { 
                    .number = 1, 
                    .ep_cnt = 2, 
                    .ep_offset = (0 + (2 - 1)) * sizeof(app_usbd_class_ep_conf_t) + ((2 - 1) * sizeof(app_usbd_class_iface_conf_t)) 
                }, 
            }, 
            .ep = 
            { 
                {
                    (nrf_drv_usbd_ep_t) (NRF_DRV_USBD_EPIN2)
                }, 
                {
                    (nrf_drv_usbd_ep_t) (NRF_DRV_USBD_EPIN1)}, 
                    {
                        (nrf_drv_usbd_ep_t) (NRF_DRV_USBD_EPOUT1)}, 
            } 
        }, 
        .inst = 
        { 
            .user_ev_handler = cdc_acm_user_ev_handler, 
            .comm_interface = 0, 
            .comm_epin = 0, 
            .data_interface = 1, 
            .data_epin = NRF_DRV_USBD_EPIN1, 
            .data_epout = NRF_DRV_USBD_EPOUT1, 
            .protocol = 0, 
            .p_ep_interval = &amp;amp;m_app_ccid_ep 
        } 
    } 
}
;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I could still use some pointers on how to properly modify cdc example to show up as CCID device. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>