keil_examples/USBCDC/vcomdemo.c
/*----------------------------------------------------------------------------
  Reads character from USB buffer and writes to serial port buffer
 *---------------------------------------------------------------------------*/
Reads character from USB buffer and writes to serial port buffer
Reads character from USB buffer and writes to serial port buffer
void VCOM_Usb2Serial(void) {
  static char serBuf [32];
         int  numBytesToRead, numBytesRead, numAvailByte;
  CDC_OutBufAvailChar (&numAvailByte);
  if (numAvailByte > 0) {
      numBytesToRead = numAvailByte > 32 ? 32 : numAvailByte; 
      numBytesRead = CDC_RdOutBuf (&serBuf[0], &numBytesToRead);
#if PORT_NUM
      ser_Write (1, &serBuf[0], &numBytesRead);
#else
      ser_Write (0, &serBuf[0], &numBytesRead);
#endif    
  }
}
void VCOM_Usb2Serial ( void ) { static char serBuf [ 32 ] ; int numBytesToRead , numBytesRead , numAvailByte ; CDC_OutBufAvailChar ( & numAvailByte ) ; if ( numAvailByte > 0 ) { numBytesToRead = numAvailByte > 32 ? 32 : numAvailByte ; numBytesRead = CDC_RdOutBuf ( & serBuf [ 0 ] , & numBytesToRead ) ; #if PORT_NUM ser_Write ( 1 , & serBuf [ 0 ] , & numBytesRead ) ; #else ser_Write ( 0 , & serBuf [ 0 ] , & numBytesRead ) ; #endif } }
Reads character from USB buffer and writes to serial port buffer
Reads character from USB buffer and writes to serial port buffer