// Space in send EP u8 USB_SendSpace(u8 ep) { LockEP lock(ep); if (!ReadWriteAllowed()) return 0; return 64 - FifoByteCount(); }
void USB_Flush(uint8_t ep) { SetEP(ep); if (FifoByteCount()) ReleaseTX(); }
uint8_t USB_SendSpace(uint8_t ep) { LockEP lock(ep); if (!ReadWriteAllowed()) return (0); return (64 - FifoByteCount()); }
int USB_Recv(uint8_t ep, void* d, int len) { if (!_usbConfiguration || len < 0) return (-1); LockEP lock(ep); uint8_t n = FifoByteCount(); len = min(n,len); n = len; uint8_t* dst = (uint8_t*)d; while (n--) *dst++ = Recv8(); if (len && !FifoByteCount()) ReleaseRX(); return (len); }
// Non Blocking receive // Return number of bytes read int USB_Recv(u8 ep, void* d, int len) { if (!_usbConfiguration || len < 0) return -1; LockEP lock(ep); u8 n = FifoByteCount(); len = min(n,len); n = len; u8* dst = (u8*)d; while (n--) *dst++ = Recv8(); if (len && !FifoByteCount()) // release empty buffer ReleaseRX(); return len; }
// Space in send EP u8 USB_SendSpace(u8 ep) { LockEP lock(ep); if (!ReadWriteAllowed()) return 0; // subtract 1 from the EP size to never send a full packet, // this avoids dealing with ZLP's in USB_Send return USB_EP_SIZE - 1 - FifoByteCount(); }
// Space in send EP uint8_t USBD_SendSpace(uint8_t ep) { SetEP(ep); if (!ReadWriteAllowed()) { return 0; } return 64 - FifoByteCount(); }
// Number of bytes, assumes a rx endpoint u8 USB_Available(u8 ep) { LockEP lock(ep); return FifoByteCount(); }
// Number of bytes, assumes a rx endpoint uint8_t USBD_Available(uint8_t ep) { SetEP(ep); return FifoByteCount(); }
uint8_t USB_Available(uint8_t ep) { LockEP lock(ep); return (FifoByteCount()); }