Explorar o código

usb.h revised

Dmitry %!s(int64=9) %!d(string=hai) anos
pai
achega
c9ee86d6e7
Modificáronse 1 ficheiros con 52 adicións e 48 borrados
  1. 52 48
      usb.h

+ 52 - 48
usb.h

@@ -11,54 +11,58 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */
-
-
-#ifndef _USB_H_
-#define _USB_H_
-#if defined(__cplusplus)
-    extern "C" {
-#endif
-
-
-
-
-#if defined(STM32L052xx) && !defined(USE_C_DRIVER)
-    #define USE_STMV0A_DRIVER
-#elif defined(STM32L052xx)
-    #define USE_STMV0_DRIVER
-#elif defined(STM32L053xx) || defined(STM32F042xx) || defined(STM32F072xx) || \
-      defined(STM32L432xx) || defined(STM32L442xx) || defined(STM32L433xx) || \
-      defined(STM32L443xx)
-    #define USE_STMV0_DRIVER
-    #warning "Driver has not been tested with this MPU"
-#elif defined(STM32L100xC)
-    #define USE_STMV1A_DRIVER
-#else
-    #error "No supported MCU family selected"
-#endif
-
-
-#include "inc/usbd_core.h"
-#if !defined(__ASSEMBLER__)
-    #include "inc/usb_std.h"
-    #if defined(USE_STMV0A_DRIVER)
-        extern const struct usbd_driver usb_stmv0a;
-        #define usbd_hw usb_stmv0a
-    #elif defined(USE_STMV0_DRIVER)
-        extern const struct usbd_driver usb_stmv0;
+ */
+
+
+#ifndef _USB_H_
+#define _USB_H_
+#if defined(__cplusplus)
+    extern "C" {
+#endif
+
+#if defined(STM32L0)
+    #if defined(FORCE_C_DRIVER)
+        #define USE_STMV0_DRIVER
+    #elif defined(FORCE_ASM_DRIVER)
+        #define USE_STMV0A_DRIVER
+    #elif defined(STM32L052xx)
+        #define USE_STMV0A_DRIVER
+    #else
+        #define USE_STMV0_DRIVER
+    #endif
+#elif defined(STM32L1)
+    #if defined(FORCE_C_DRIVER)
+        #define USE_STMV1_DRIVER
+    #elif defined(FORCE_ASM_DRIVER)
+        #define USE_STMV1A_DRIVER
+    #elif defined(STM32L100xC)
+        #define USE_STMV1A_DRIVER
+    #else
+        #define USE_STMV1_DRIVER
+    #endif
+#else
+    #error "No supported MCU family selected"
+#endif
+
+#include "inc/usbd_core.h"
+#if !defined(__ASSEMBLER__)
+    #include "inc/usb_std.h"
+    #if defined(USE_STMV0A_DRIVER)
+        extern const struct usbd_driver usb_stmv0a;
+        #define usbd_hw usb_stmv0a
+    #elif defined(USE_STMV0_DRIVER)
+        extern const struct usbd_driver usb_stmv0;
         #define usbd_hw usb_stmv0
     #elif defined(USE_STMV1_DRIVER)
         extern const struct usbd_driver usb_stmv1;
-        #define usbd_hw usb_stmv1
-    #elif defined(USE_STMV1A_DRIVER)
-        extern const struct usbd_driver usb_stmv1a;
-        #define usbd_hw usb_stmv1a
-
-    #endif
-#endif
-
-#if defined (__cplusplus)
-    }
-#endif
-#endif //_USB_H_
+        #define usbd_hw usb_stmv1
+    #elif defined(USE_STMV1A_DRIVER)
+        extern const struct usbd_driver usb_stmv1a;
+        #define usbd_hw usb_stmv1a
+    #endif
+#endif
+
+#if defined (__cplusplus)
+    }
+#endif
+#endif //_USB_H_