소스 검색

refactor: move CHERRYUSB_VERSION and CHERRYUSB_VERSION_STR into usb_version.h

sakumisu 1 년 전
부모
커밋
143a5ce3fd

+ 0 - 3
cherryusb_config_template.h

@@ -6,9 +6,6 @@
 #ifndef CHERRYUSB_CONFIG_H
 #define CHERRYUSB_CONFIG_H
 
-#define CHERRYUSB_VERSION     0x010301
-#define CHERRYUSB_VERSION_STR "v1.3.1"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)

+ 21 - 0
common/usb_version.h

@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2024, sakumisu
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef USB_VERSION_H
+#define USB_VERSION_H
+
+#ifdef CHERRYUSB_VERSION
+#warning "Please do not define CHERRYUSB_VERSION in usb_config.h"
+#undef CHERRYUSB_VERSION
+#endif
+#ifdef CHERRYUSB_VERSION_STR
+#warning "Please do not define CHERRYUSB_VERSION_STR in usb_config.h"
+#undef CHERRYUSB_VERSION_STR
+#endif
+
+#define CHERRYUSB_VERSION     0x010301
+#define CHERRYUSB_VERSION_STR "v1.3.1"
+
+#endif

+ 1 - 0
core/usbd_core.h

@@ -23,6 +23,7 @@ extern "C" {
 #include "usb_log.h"
 #include "usb_dc.h"
 #include "usb_memcpy.h"
+#include "usb_version.h"
 
 enum usbd_event_type {
     /* USB DCD IRQ */

+ 1 - 0
core/usbh_core.h

@@ -21,6 +21,7 @@
 #include "usb_osal.h"
 #include "usbh_hub.h"
 #include "usb_memcpy.h"
+#include "usb_version.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 0 - 3
osal/idf/usb_config.h

@@ -6,9 +6,6 @@
 
 #pragma once
 
-#define CHERRYUSB_VERSION     0x010301
-#define CHERRYUSB_VERSION_STR "v1.3.1"
-
 #include "sdkconfig.h"
 #include "esp_rom_sys.h"
 

+ 0 - 3
port/pusb2/freertos/usb_config.h

@@ -15,9 +15,6 @@
 #include "FreeRTOS.h"
 #include "task.h"
 
-#define CHERRYUSB_VERSION     0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)

+ 0 - 3
port/pusb2/rt-thread/usb_config.h

@@ -13,9 +13,6 @@
 
 #include "rtconfig.h"
 
-#define CHERRYUSB_VERSION     0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__)

+ 0 - 3
port/pusb2/standalone/usb_config.h

@@ -13,9 +13,6 @@
 
 #include "sdkconfig.h"
 
-#define CHERRYUSB_VERSION     0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)

+ 0 - 3
port/xhci/phytium/freertos/usb_config.h

@@ -16,9 +16,6 @@
 #include "FreeRTOS.h"
 #include "task.h"
 
-#define CHERRYUSB_VERSION     0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)

+ 0 - 3
port/xhci/phytium/rt-thread/usb_config.h

@@ -13,9 +13,6 @@
 
 #include "rtthread.h"
 
-#define CHERRYUSB_VERSION     0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
 /* ================ USB common Configuration ================ */
 
 #define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__)