USBUART_GetAll | Cypress Semiconductor
I want to control DAC Output through USBUART but have problems with getting data from USB.
I assume the function USBUART_GetAll () should get the whole null terminated string? It doesn't in my project. When I send 255 over serial line, the function returns 2 and then next time 55 or 25 and 55. I might have made mistake as this is the first time I am using USBUART.
And the next problem - atoi returns something odd. Even if I pass '2', it returns something but not 2. It must be something wrongh with my code:
/* check the icoming data through usbuart */
/* read incoming message */
/* convert ascii to int */
Wave_Value = (uint8)atoi(rdBuffer);
/* Set the value in VDAC_2 data register */
sprintf((char *)wrBuffer, "%u\r\n", Wave_Value);