USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Revision:
70:2c525a50f1b6
Parent:
31:5bf05f9b3c7b
--- a/USBDevice/USBHAL.h	Fri Nov 11 17:59:00 2016 +0000
+++ b/USBDevice/USBHAL.h	Thu Jul 20 10:14:36 2017 +0100
@@ -21,7 +21,7 @@
 
 #include "mbed.h"
 #include "USBEndpoints.h"
-#include "toolchain.h"
+#include "mbed_toolchain.h"
 
 //#ifdef __GNUC__
 //#define __packed __attribute__ ((__packed__))
@@ -68,6 +68,23 @@
     virtual void suspendStateChanged(unsigned int suspended){};
     virtual void SOF(int frameNumber){};
 
+#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M453)
+    // NUC472/M453 USB doesn't support configuration of the same EP number for IN/OUT simultaneously.
+    virtual bool EP1_OUT_callback(){return false;};
+    virtual bool EP2_IN_callback(){return false;};
+    virtual bool EP3_OUT_callback(){return false;};
+    virtual bool EP4_IN_callback(){return false;};
+    virtual bool EP5_OUT_callback(){return false;};
+    virtual bool EP6_IN_callback(){return false;};
+#if ! (defined(TARGET_NUMAKER_PFM_M453))
+    virtual bool EP7_OUT_callback(){return false;};
+    virtual bool EP8_IN_callback(){return false;};
+    virtual bool EP9_OUT_callback(){return false;};
+    virtual bool EP10_IN_callback(){return false;};
+    virtual bool EP11_OUT_callback(){return false;};
+    virtual bool EP12_IN_callback(){return false;};
+#endif
+#else
     virtual bool EP1_OUT_callback(){return false;};
     virtual bool EP1_IN_callback(){return false;};
     virtual bool EP2_OUT_callback(){return false;};
@@ -102,6 +119,7 @@
     virtual bool EP15_IN_callback(){return false;};
 #endif
 #endif
+#endif
 
 private:
     void usbisr(void);
@@ -109,11 +127,15 @@
     static USBHAL * instance;
 
 #if defined(TARGET_LPC11UXX) || defined(TARGET_LPC11U6X) || defined(TARGET_LPC1347) || defined(TARGET_LPC1549)
-        bool (USBHAL::*epCallback[10 - 2])(void);
-#elif defined(TARGET_STM32F4)
-        bool (USBHAL::*epCallback[8 - 2])(void);
+    bool (USBHAL::*epCallback[10 - 2])(void);
+#elif (defined(TARGET_STM32F4) && !defined(USB_STM_HAL)) || defined(TARGET_NUMAKER_PFM_M453)
+    bool (USBHAL::*epCallback[8 - 2])(void);
+#elif defined(TARGET_STM)
+    PCD_HandleTypeDef hpcd;
+#elif defined(TARGET_NUMAKER_PFM_NUC472)
+    bool (USBHAL::*epCallback[14 - 2])(void);
 #else
-        bool (USBHAL::*epCallback[32 - 2])(void);
+    bool (USBHAL::*epCallback[32 - 2])(void);
 #endif