stm32/usbd_desc: Rename USBD_xxx descriptor opts to MICROPY_HW_USB_xxx.

Signed-off-by: Damien George <damien@micropython.org>
pull/7603/head
Damien George 2021-08-05 12:01:01 +10:00
rodzic 96c6b8cae3
commit f28e8b9073
2 zmienionych plików z 53 dodań i 45 usunięć

Wyświetl plik

@ -180,9 +180,17 @@
/*****************************************************************************/
// USB configuration
// The USBD_xxx VID/PID macros have been renamed to MICROPY_HW_USB_xxx.
#ifdef USBD_VID
#error "Old USBD_VID configuration option used"
// The USBD_xxx macros have been renamed to MICROPY_HW_USB_xxx.
#if defined(USBD_VID) \
|| defined(USBD_LANGID_STRING) \
|| defined(USBD_MANUFACTURER_STRING) \
|| defined(USBD_PRODUCT_HS_STRING) \
|| defined(USBD_PRODUCT_FS_STRING) \
|| defined(USBD_CONFIGURATION_HS_STRING) \
|| defined(USBD_INTERFACE_HS_STRING) \
|| defined(USBD_CONFIGURATION_FS_STRING) \
|| defined(USBD_INTERFACE_FS_STRING)
#error "Old USBD_xxx configuration option used, renamed to MICROPY_HW_USB_xxx"
#endif
// Default VID and PID values to use for the USB device. If MICROPY_HW_USB_VID
@ -204,6 +212,38 @@
#define MICROPY_HW_USB_PID_CDC3_MSC_HID (0x980a)
#endif
#ifndef MICROPY_HW_USB_LANGID_STRING
#define MICROPY_HW_USB_LANGID_STRING 0x409
#endif
#ifndef MICROPY_HW_USB_MANUFACTURER_STRING
#define MICROPY_HW_USB_MANUFACTURER_STRING "MicroPython"
#endif
#ifndef MICROPY_HW_USB_PRODUCT_HS_STRING
#define MICROPY_HW_USB_PRODUCT_HS_STRING "Pyboard Virtual Comm Port in HS Mode"
#endif
#ifndef MICROPY_HW_USB_PRODUCT_FS_STRING
#define MICROPY_HW_USB_PRODUCT_FS_STRING "Pyboard Virtual Comm Port in FS Mode"
#endif
#ifndef MICROPY_HW_USB_CONFIGURATION_HS_STRING
#define MICROPY_HW_USB_CONFIGURATION_HS_STRING "Pyboard Config"
#endif
#ifndef MICROPY_HW_USB_INTERFACE_HS_STRING
#define MICROPY_HW_USB_INTERFACE_HS_STRING "Pyboard Interface"
#endif
#ifndef MICROPY_HW_USB_CONFIGURATION_FS_STRING
#define MICROPY_HW_USB_CONFIGURATION_FS_STRING "Pyboard Config"
#endif
#ifndef MICROPY_HW_USB_INTERFACE_FS_STRING
#define MICROPY_HW_USB_INTERFACE_FS_STRING "Pyboard Interface"
#endif
/*****************************************************************************/
// General configuration

Wyświetl plik

@ -36,46 +36,14 @@
// need this header just for MP_HAL_UNIQUE_ID_ADDRESS
#include "py/mphal.h"
// need this header for any overrides to the below constants
// Need this header for MICROPY_HW_USB_xxx configuration values.
#include "py/mpconfig.h"
#ifndef USBD_LANGID_STRING
#define USBD_LANGID_STRING 0x409
#endif
#ifndef USBD_MANUFACTURER_STRING
#define USBD_MANUFACTURER_STRING "MicroPython"
#endif
#ifndef USBD_PRODUCT_HS_STRING
#define USBD_PRODUCT_HS_STRING "Pyboard Virtual Comm Port in HS Mode"
#endif
#ifndef USBD_PRODUCT_FS_STRING
#define USBD_PRODUCT_FS_STRING "Pyboard Virtual Comm Port in FS Mode"
#endif
#ifndef USBD_CONFIGURATION_HS_STRING
#define USBD_CONFIGURATION_HS_STRING "Pyboard Config"
#endif
#ifndef USBD_INTERFACE_HS_STRING
#define USBD_INTERFACE_HS_STRING "Pyboard Interface"
#endif
#ifndef USBD_CONFIGURATION_FS_STRING
#define USBD_CONFIGURATION_FS_STRING "Pyboard Config"
#endif
#ifndef USBD_INTERFACE_FS_STRING
#define USBD_INTERFACE_FS_STRING "Pyboard Interface"
#endif
__ALIGN_BEGIN static const uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END = {
USB_LEN_LANGID_STR_DESC,
USB_DESC_TYPE_STRING,
LOBYTE(USBD_LANGID_STRING),
HIBYTE(USBD_LANGID_STRING),
LOBYTE(MICROPY_HW_USB_LANGID_STRING),
HIBYTE(MICROPY_HW_USB_LANGID_STRING),
};
// set the VID, PID and device release number
@ -140,14 +108,14 @@ STATIC uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16
return (uint8_t *)USBD_LangIDDesc; // the data should only be read from this buf
case USBD_IDX_MFC_STR:
str = USBD_MANUFACTURER_STRING;
str = MICROPY_HW_USB_MANUFACTURER_STRING;
break;
case USBD_IDX_PRODUCT_STR:
if (pdev->dev_speed == USBD_SPEED_HIGH) {
str = USBD_PRODUCT_HS_STRING;
str = MICROPY_HW_USB_PRODUCT_HS_STRING;
} else {
str = USBD_PRODUCT_FS_STRING;
str = MICROPY_HW_USB_PRODUCT_FS_STRING;
}
break;
@ -174,17 +142,17 @@ STATIC uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16
case USBD_IDX_CONFIG_STR:
if (pdev->dev_speed == USBD_SPEED_HIGH) {
str = USBD_CONFIGURATION_HS_STRING;
str = MICROPY_HW_USB_CONFIGURATION_HS_STRING;
} else {
str = USBD_CONFIGURATION_FS_STRING;
str = MICROPY_HW_USB_CONFIGURATION_FS_STRING;
}
break;
case USBD_IDX_INTERFACE_STR:
if (pdev->dev_speed == USBD_SPEED_HIGH) {
str = USBD_INTERFACE_HS_STRING;
str = MICROPY_HW_USB_INTERFACE_HS_STRING;
} else {
str = USBD_INTERFACE_FS_STRING;
str = MICROPY_HW_USB_INTERFACE_FS_STRING;
}
break;