Skip to content

Modified version of NXPUSBLib's VirtualSerial example to provide support for FILE stream

Notifications You must be signed in to change notification settings

thegouger/LPC_VirtualSerialStream

Repository files navigation

LPC Virtual Serial Stream Example

Modified VirtualSerial example and USB libraries from NXPUSBLib to provide support for C FILE streams. Note that this requires the use of Newlib or an arm libc which supports cookie based custom streams.

Usage

Include the modified CDCClassDevice.c and CDCClassDevice.h

Create a file stream:

static FILE* USBSerialStream; // global file stream

/* Create a blocking usb serial stream (blocks on fgetc) */
USBSerialStream = CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface);
setbuf(USBSerialStream, NULL);

Use file stream for input and output:

fprintf(USBSerialStream, "Hello\n");

About

Modified version of NXPUSBLib's VirtualSerial example to provide support for FILE stream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published