Exemplo n.º 1
0
uint32 USBSerial::read(void *buf, uint32 len) {
    if (!buf || gbUsbVcpStatus == USB_PORT_CLOSE) { //[ROBOTIS]2012-12-19 to prevent USB Blocking issue!
        return 0;
    }

    uint32 rxed = 0;
    while (rxed < len) {
        rxed += usbReceiveBytes((uint8*)buf + rxed, len - rxed);
    }

    return rxed;
}
Exemplo n.º 2
0
void usbSendHello(void) {
  uint8 bufin = 48 + recvBufIn;;
  uint8 bufout = 48 + recvBufOut;
  uint8 avail  = 48 + usbBytesAvailable();

  char *line = "\r\n";
  while(usbSendBytes(&bufin,1) == 0);
  while(usbSendBytes(&bufout,1) == 0);
  while(usbSendBytes(&avail,1) == 0);
  while(usbSendBytes((uint8*)line,2) == 0);

  uint8 recv[64];
  usbReceiveBytes(&recv[0],1);
}
Exemplo n.º 3
0
uint8 serialUsbRead(void) {
   uint8 ch;
   usbReceiveBytes(&ch, 1);
   return ch;
}
Exemplo n.º 4
0
uint32 serialUsbReadBuf(void *buf, uint32 len) {
   if (!buf) {
      return 0;
   }
   return usbReceiveBytes((uint8*)buf, len);
}