keil_examples/USBCDC/vcomdemo.c
/*----------------------------------------------------------------------------
  Reads character from serial port buffer and writes to USB buffer
 *---------------------------------------------------------------------------*/
Reads character from serial port buffer and writes to USB buffer
Reads character from serial port buffer and writes to USB buffer
void VCOM_Serial2Usb(void) {
  static char serBuf [USB_CDC_BUFSIZE];
         int  numBytesRead, numAvailByte;
  ser_AvailChar (&numAvailByte);
  if (numAvailByte > 0) {
    if (CDC_DepInEmpty) {
      numBytesRead = ser_Read (&serBuf[0], &numAvailByte);
      CDC_DepInEmpty = 0;
	  USB_WriteEP (CDC_DEP_IN, (unsigned char *)&serBuf[0], numBytesRead);
    }
  }
}
void VCOM_Serial2Usb ( void ) { static char serBuf [ USB_CDC_BUFSIZE ] ; int numBytesRead , numAvailByte ; ser_AvailChar ( & numAvailByte ) ; if ( numAvailByte > 0 ) { if ( CDC_DepInEmpty ) { numBytesRead = ser_Read ( & serBuf [ 0 ] , & numAvailByte ) ; CDC_DepInEmpty = 0 ; USB_WriteEP ( CDC_DEP_IN , ( unsigned char * ) & serBuf [ 0 ] , numBytesRead ) ; } } }
Reads character from serial port buffer and writes to USB buffer
Reads character from serial port buffer and writes to USB buffer