diff options
author | NicoHood <NicoHood@users.noreply.github.com> | 2015-08-07 19:45:18 +0200 |
---|---|---|
committer | NicoHood <NicoHood@users.noreply.github.com> | 2015-08-12 17:48:17 +0200 |
commit | d1fe40060e3c9b1f060e86221aeabf7f70a66316 (patch) | |
tree | 9f689cdf0c5db83cceccedf0e289d8ae0ccf2f50 /cores/arduino/USBCore.cpp | |
parent | 488ace3d138ef1eb183ab53b9b24fa9ea3eeb301 (diff) |
Added 16 byte endpoint support
Diffstat (limited to 'cores/arduino/USBCore.cpp')
-rw-r--r-- | cores/arduino/USBCore.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 05e2f24..fd25793 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -253,7 +253,7 @@ u8 USB_SendSpace(u8 ep) LockEP lock(ep); if (!ReadWriteAllowed()) return 0; - return 64 - FifoByteCount(); + return USB_EP_SIZE - FifoByteCount(); } // Blocking Send of data to an endpoint @@ -326,6 +326,7 @@ u8 _initEndpoints[] = #define EP_SINGLE_64 0x32 // EP0 #define EP_DOUBLE_64 0x36 // Other endpoints +#define EP_SINGLE_16 0x12 static void InitEP(u8 index, u8 type, u8 size) @@ -344,7 +345,13 @@ void InitEndpoints() UENUM = i; UECONX = (1<<EPEN); UECFG0X = _initEndpoints[i]; +#if USB_EP_SIZE == 16 + UECFG1X = EP_SINGLE_16; +#elif USB_EP_SIZE == 64 UECFG1X = EP_DOUBLE_64; +#else +#error Unsupported value for USB_EP_SIZE +#endif } UERST = 0x7E; // And reset them UERST = 0; |