Creating a VCP driver, using a stream-buffer
The next example-program is in Src/mainVcpStreamBuffer.c. It implements a driver for sending messages over USB, to a VCP on the USB host. The driver uses a stream-buffer to hold messages that are waiting to be sent over USB. The messages are sent by a task that takes messages from the stream-buffer, and transmits them over the USB connection. After the task transmits a message, it waits for a signal that indicates the transmission process is done. The signal is generated by an ISR, which is run via an interrupt from the USB controller. The interrupt is generated when the USB transmission-process is done.
The driver is implemented in Drivers/HandsOnRTOS/vcpDriver.c, and the driver is referred to as the vcpDriver.
Understanding the app
From our current example-program (mainVcpStreamBuffer.c), the function main() is shown below.
mainVcpStreamBuffer.c is very similar to the prior example-program’s mainVcpSimple.c. Their...