Please refer to the link for USBFS-UART code example given below:
This code example demonstrates the USBUART implementation. It echoes received data to the Virtual COM port terminal.
If you're interested, I've attached a link to contributed source code that uses the USBUART with a simplified interface.
The simplified USBUART interface was intend to help users that constructed a UART API calls primarily for the 059-Kit board to switch to the 059-Kit on-board USB port with minimal changes. It simplifies the additional coding needed to address USB-specific controls.
The source code has the following features:
- UART to USBUART simplied API call interface.
- GetString() function call to process input string data that can filter the input to only allow characters for a input string type. Input string types supported:
- Unsigned and signed integers.
- Signed and unsigned numbers with values after the decimal point.
- Unsigned Hexadecimal numbers.
- Strings. (of course)
- File-system allowed string characters.
- A character-based menu driven system for terminal support. This can be user expanded as needed.
As I could not open the attached project,
I reused my HC-SR04 project for CY8CKIT-059
and modified it for CY8CKIT-050 and USBUART.
During the task, what I noticed were
(1) I needed to add "USBUART_cdc.inf" file which was with the original application note.
(2) To use USBUART just like UART, I needed to do
/* Wait for Device to enumerate */
/* Enumeration is done, enable OUT endpoint for receive data from Host */