Pinscape Controller version 1 fork. This is a fork to allow for ongoing bug fixes to the original controller version, from before the major changes for the expansion board project.

Dependencies:   FastIO FastPWM SimpleDMA mbed

Fork of Pinscape_Controller by Mike R

Files at this revision

API Documentation at this revision

Comitter:
mjr
Date:
Thu Feb 11 23:35:00 2016 +0000
Parent:
63:4d4c99ab8093
Child:
65:3b280c430660
Commit message:
USBHAL_KL25Z EP0 read tweaks

Changed in this revision

USBDevice/USBDevice/USBHAL_KL25Z.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice/USBDevice/USBHAL_KL25Z.cpp	Thu Feb 11 23:21:17 2016 +0000
+++ b/USBDevice/USBDevice/USBHAL_KL25Z.cpp	Thu Feb 11 23:35:00 2016 +0000
@@ -426,13 +426,23 @@
     uint32_t idx = EP_BDT_IDX(log_endpoint, RX, 0);
     bool iso = (USB0->ENDPOINT[log_endpoint].ENDPT & USB_ENDPT_EPHSHK_MASK) == 0;
 
-    // If it's not isochronous, check to see if we've received data, and
+    // check to see if the endpoint is ready to read
+    if (log_endpoint == 0)
+    {
+        // control endpoint - just make sure we own the BDT
+        if (bdt[idx].info & BD_OWN_MASK)
+            return EP_PENDING;
+    }
+    else
+    {
+        // If it's not isochronous, check to see if we've received data, and
     // return PENDING if not.  Isochronous endpoints don't use the TOKNE 
     // interrupt (they use SOF instead), so the 'complete' flag doesn't
     // apply if it's an iso endpoint.
-    if ((log_endpoint != 0) && !iso && !(epComplete & EP(endpoint)))
+    if (!iso && !(epComplete & EP(endpoint)))
         return EP_PENDING;
-        
+    }
+                
     ENTER_CRITICAL_SECTION
     {
         // note if we have a SETUP token
@@ -667,7 +677,7 @@
                 // assumes that we don't, so it's probably an error if this code
                 // actually does anything, but we make no provision for handling this)
                 bdt[EP_BDT_IDX(0, TX, EVEN)].info &= ~BD_OWN_MASK;
-                bdt[EP_BDT_IDX(0, TX, ODD)].info  &= ~BD_OWN_MASK;
+                bdt[EP_BDT_IDX(0, TX, ODD )].info &= ~BD_OWN_MASK;
 
                 // handle the EP0 SETUP event in the generic protocol layer
                 EP0setupCallback();