I was using application AN00124 to take advatange of the CDC protocol and I was attempting to convert the app_virtual_com() API from xC to C, which I'm circling around and not finding a way to achieve that, as at the end of the day, I always get the error:
member reference base type 'unsigned int' is not a structure or union
char cdc_char = cdc.get_char();
Essentially the changes I've done are below:
Code: Select all
main.xc
...
extern void app_virtual_com(client interface usb_cdc_interface cdc);
/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
* if the endpoint wishes to be informed of USB bus resets
*/
XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_BUL};
XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_INT, XUD_EPTYPE_BUL};
/* Application task */
/*void app_virtual_com(client interface usb_cdc_interface cdc) -> Removed
{
while (1)
{
char cdc_char = cdc.get_char();
cdc.put_char(cdc_char);
if (cdc_char == '\r')
cdc.put_char('\n');
}
}*/
...
Code: Select all
#include <xccompat.h>
void app_virtual_com(CLIENT_INTERFACE(usb_cdc_interface, cdc))
{
while (1)
{
char cdc_char = cdc.get_char();
cdc.put_char(cdc_char);
if (cdc_char == '\r')
cdc.put_char('\n');
}
}
Thank you!