diff --git a/cherryusb_config_template.h b/cherryusb_config_template.h index 013b85b..4f0517b 100644 --- a/cherryusb_config_template.h +++ b/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__) diff --git a/common/usb_version.h b/common/usb_version.h new file mode 100644 index 0000000..3bdf730 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/core/usbd_core.h b/core/usbd_core.h index 5b88494..ab7be7f 100644 --- a/core/usbd_core.h +++ b/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 */ diff --git a/core/usbh_core.h b/core/usbh_core.h index c2e98ea..6674fcb 100644 --- a/core/usbh_core.h +++ b/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" { diff --git a/osal/idf/usb_config.h b/osal/idf/usb_config.h index d761a92..a3d7945 100644 --- a/osal/idf/usb_config.h +++ b/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" diff --git a/port/pusb2/freertos/usb_config.h b/port/pusb2/freertos/usb_config.h index f8eade1..760759f 100644 --- a/port/pusb2/freertos/usb_config.h +++ b/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__) diff --git a/port/pusb2/rt-thread/usb_config.h b/port/pusb2/rt-thread/usb_config.h index 57eeff9..2a42c47 100644 --- a/port/pusb2/rt-thread/usb_config.h +++ b/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__) diff --git a/port/pusb2/standalone/usb_config.h b/port/pusb2/standalone/usb_config.h index 9665b0e..e4fbc4e 100644 --- a/port/pusb2/standalone/usb_config.h +++ b/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__) diff --git a/port/xhci/phytium/freertos/usb_config.h b/port/xhci/phytium/freertos/usb_config.h index addb09e..60a9ed1 100755 --- a/port/xhci/phytium/freertos/usb_config.h +++ b/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__) diff --git a/port/xhci/phytium/rt-thread/usb_config.h b/port/xhci/phytium/rt-thread/usb_config.h index 553b3ba..460d124 100644 --- a/port/xhci/phytium/rt-thread/usb_config.h +++ b/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__)